00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 00005 | | 00006 | Copyright (C) 2005-2011 University of Malaga | 00007 | | 00008 | This software was written by the Machine Perception and Intelligent | 00009 | Robotics Lab, University of Malaga (Spain). | 00010 | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> | 00011 | | 00012 | This file is part of the MRPT project. | 00013 | | 00014 | MRPT is free software: you can redistribute it and/or modify | 00015 | it under the terms of the GNU General Public License as published by | 00016 | the Free Software Foundation, either version 3 of the License, or | 00017 | (at your option) any later version. | 00018 | | 00019 | MRPT is distributed in the hope that it will be useful, | 00020 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 00021 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 00022 | GNU General Public License for more details. | 00023 | | 00024 | You should have received a copy of the GNU General Public License | 00025 | along with MRPT. If not, see <http://www.gnu.org/licenses/>. | 00026 | | 00027 +---------------------------------------------------------------------------+ */ 00028 #ifndef CHMHMapArc_H 00029 #define CHMHMapArc_H 00030 00031 #include <mrpt/slam/CSensoryFrame.h> 00032 #include <mrpt/hmtslam/CHMHMapNode.h> 00033 #include <mrpt/utils/CSerializable.h> 00034 00035 namespace mrpt 00036 { 00037 namespace hmtslam 00038 { 00039 using namespace mrpt::slam; 00040 class HMTSLAM_IMPEXP CHierarchicalMHMap; 00041 00042 //DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CHMHMapArc, mrpt::utils::CSerializable, HMTSLAM_IMPEXP ) 00043 00044 /** A class for representing an arc between two nodes in a hierarchical, multi-hypothesis map. 00045 * The arc itself will be considered only if some given hypothesisID matchs its own ID. 00046 * \note Create objects by invoking the class factory "::Create" 00047 * 00048 * \sa CHierarchicalMHMap,CHMHMapNode 00049 */ 00050 class HMTSLAM_IMPEXP CHMHMapArc : public mrpt::utils::CSerializable 00051 { 00052 friend class HMTSLAM_IMPEXP CHierarchicalMHMap; 00053 friend class HMTSLAM_IMPEXP CHMHMapNode; 00054 friend class HMTSLAM_IMPEXP CHierarchicalMapMHPartition; 00055 friend class TArcList; 00056 00057 // This must be added to any CSerializable derived class: 00058 DEFINE_SERIALIZABLE( CHMHMapArc ) 00059 00060 public: 00061 /** The hypothesis IDs under which this arc exists. 00062 */ 00063 THypothesisIDSet m_hypotheses; 00064 00065 protected: 00066 /** The origin/target nodes for this arc. 00067 */ 00068 CHMHMapNode::TNodeID m_nodeFrom, m_nodeTo; 00069 00070 /** The hierarchical graph in which this object is into. 00071 */ 00072 safe_ptr<CHierarchicalMHMap> m_parent; 00073 00074 00075 /** Event handler to be called just before a node is being destroyed: it should be called only for nodes involved in the arc, altought other cases must be handled without effects 00076 * When a node involved in the arc is delected, the corresponding pointer in the arc will be set to NULL and the arc is no longer a valid one. 00077 */ 00078 void onNodeDestruction(CHMHMapNode *node); 00079 00080 private: 00081 /** Private constructor (see ::Create class factory) 00082 */ 00083 CHMHMapArc( 00084 const CHMHMapNode::TNodeID &from =0, 00085 const CHMHMapNode::TNodeID &to =0, 00086 const THypothesisIDSet &hyps = THypothesisIDSet(), 00087 CHierarchicalMHMap *parent=NULL); 00088 00089 /** Alternative constructor, using pointers for convenience. 00090 */ 00091 CHMHMapArc( 00092 CHMHMapNodePtr &from, 00093 CHMHMapNodePtr &to, 00094 const THypothesisIDSet &hyps, 00095 CHierarchicalMHMap *parent); 00096 00097 public: 00098 /** Constructor from node IDs 00099 */ 00100 static CHMHMapArcPtr Create( 00101 const CHMHMapNode::TNodeID &from, 00102 const CHMHMapNode::TNodeID &to, 00103 const THypothesisIDSet &hyps = THypothesisIDSet(), 00104 CHierarchicalMHMap *parent=NULL); 00105 00106 /** Alternative constructor, using pointers for convenience. 00107 */ 00108 static CHMHMapArcPtr Create( 00109 CHMHMapNodePtr &from, 00110 CHMHMapNodePtr &to, 00111 const THypothesisIDSet &hyps, 00112 CHierarchicalMHMap *parent); 00113 00114 /** Destructor 00115 */ 00116 virtual ~CHMHMapArc(); 00117 00118 /** Return the starting node of the arc: 00119 */ 00120 CHMHMapNode::TNodeID getNodeFrom() const { ASSERT_(m_nodeFrom!=AREAID_INVALID); return m_nodeFrom; } 00121 00122 /** Return the ending node of the arc: 00123 */ 00124 CHMHMapNode::TNodeID getNodeTo() const { ASSERT_(m_nodeTo!=AREAID_INVALID); return m_nodeTo; } 00125 00126 /** The type of the arc, the possibilities are: 00127 - "Membership": for abstractions 00128 - "Navegability" 00129 - "RelativePose" 00130 */ 00131 utils::CTypeSelector m_arcType; 00132 00133 /** The annotations of the arc, see the general description of the class for possible properties and values. 00134 */ 00135 utils::CMHPropertiesValuesList m_annotations; 00136 00137 }; // End of class def. 00138 00139 00140 } // End of namespace 00141 } // End of namespace 00142 00143 #endif
Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:16:28 UTC 2011 |