00001 /* 00002 * Copyright (C) 2009 by Ulrich Friedrich Klank <klank@in.tum.de> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 3 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00018 00019 #ifndef RELPOSEFACTORY_H 00020 #define RELPOSEFACTORY_H 00021 00022 #include "RelPose.h" 00023 #include "Comm.h" 00024 #define XML_NODE_RELPOSELIST "RelPoseList" 00025 00026 00027 namespace cop 00028 { 00029 #ifdef NO_LO_SERVICE_AVAILABLE 00030 static std::vector<RelPose*> s_relPoses; 00031 #else /*NO_LO_SERVICE_AVAILABLE*/ 00032 #endif /*NO_LO_SERVICE_AVAILABLE*/ 00033 00034 00035 00036 00040 class RelPoseFactory 00041 { 00042 private: 00043 RelPoseFactory(void); 00044 public: 00045 ~RelPoseFactory(void); 00046 00047 static RelPose* FRelPoseWorld(); 00048 static RelPose* FRelPose(jlo::LocatedObject& pose); 00049 static RelPose* FRelPose(XMLTag* tag); 00050 static RelPose* FRelPose(RelPose* pose, Matrix m, Matrix cov); 00051 static RelPose* FRelPose(LocatedObjectID_t parent, Matrix m, Matrix cov); 00052 static RelPose* FRelPose(RelPose* pose, LocatedObjectID_t parent, Matrix m, Matrix cov); 00056 static RelPose* FRelPoseIdentityChild(RelPose* parent); 00057 00058 static RelPose* GetRelPose(LocatedObjectID_t id, LocatedObjectID_t parent_if); 00059 static RelPose* GetRelPose(std::string name); 00060 00061 static RelPose* FRelPose(LocatedObjectID_t id); 00062 00063 static void DisposeList(); 00064 static void FreeRelPose(RelPose** pose, bool temporary = false); 00068 static RelPose* CloneRelPose(RelPose* pose); 00069 static RelPose* CloneRelPose(LocatedObjectID_t uniqueID); 00070 00071 private: 00072 static RelPose* GetRelPose(LocatedObjectID_t id); 00073 static int SetRelPose(RelPose* pose); 00074 00075 #ifdef NO_LO_SERVICE_AVAILABLE 00076 public: 00077 static XMLTag* SaveList(); 00078 static void LoadList( XMLTag* tag); 00079 private: 00080 static RelPose* GetRelPoseIndex(int index); 00081 static std::vector<RelPose*> s_relPoses; 00082 #else /*NO_LO_SERVICE_AVAILABLE*/ 00083 public: 00084 static Comm* s_loService; 00085 #endif /*NO_LO_SERVICE_AVAILABLE*/ 00086 private: 00087 friend class RelPoseHTuple; 00088 }; 00089 } 00090 #endif /*RELPOSEFACTORY_H*/