Main MRPT website > C++ reference
MRPT logo
CHMHMapArc.h
Go to the documentation of this file.
00001 /* +---------------------------------------------------------------------------+
00002    |          The Mobile Robot Programming Toolkit (MRPT) C++ library          |
00003    |                                                                           |
00004    |                       http://www.mrpt.org/                                |
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                   * \ingroup mrpt_hmtslam_grp
00050                  */
00051                 class HMTSLAM_IMPEXP CHMHMapArc : public mrpt::utils::CSerializable
00052                 {
00053                         friend class HMTSLAM_IMPEXP CHierarchicalMHMap;
00054                         friend class HMTSLAM_IMPEXP CHMHMapNode;
00055                         friend class HMTSLAM_IMPEXP CHierarchicalMapMHPartition;
00056                         friend class TArcList;
00057 
00058                         // This must be added to any CSerializable derived class:
00059                         DEFINE_SERIALIZABLE( CHMHMapArc )
00060 
00061                 public:
00062                         /** The hypothesis IDs under which this arc exists.
00063                           */
00064                         THypothesisIDSet                m_hypotheses;
00065 
00066                 protected:
00067                         /** The origin/target nodes for this arc.
00068                           */
00069                         CHMHMapNode::TNodeID    m_nodeFrom, m_nodeTo;
00070 
00071                         /** The hierarchical graph in which this object is into.
00072                           */
00073                         safe_ptr<CHierarchicalMHMap>    m_parent;
00074 
00075 
00076                          /** 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
00077                           *   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.
00078                           */
00079                          void  onNodeDestruction(CHMHMapNode *node);
00080 
00081                 private:
00082                         /** Private constructor (see ::Create class factory)
00083                           */
00084                         CHMHMapArc(
00085                                 const CHMHMapNode::TNodeID              &from =0,
00086                                 const CHMHMapNode::TNodeID              &to   =0,
00087                                 const THypothesisIDSet                  &hyps = THypothesisIDSet(),
00088                                 CHierarchicalMHMap              *parent=NULL);
00089 
00090                         /** Alternative constructor, using pointers for convenience.
00091                           */
00092                         CHMHMapArc(
00093                                 CHMHMapNodePtr          &from,
00094                                 CHMHMapNodePtr          &to,
00095                                 const THypothesisIDSet          &hyps,
00096                                 CHierarchicalMHMap                      *parent);
00097 
00098                 public:
00099                         /** Constructor from node IDs
00100                           */
00101                         static CHMHMapArcPtr Create(
00102                                 const CHMHMapNode::TNodeID              &from,
00103                                 const CHMHMapNode::TNodeID              &to,
00104                                 const THypothesisIDSet                  &hyps = THypothesisIDSet(),
00105                                 CHierarchicalMHMap              *parent=NULL);
00106 
00107                         /** Alternative constructor, using pointers for convenience.
00108                           */
00109                         static CHMHMapArcPtr Create(
00110                                 CHMHMapNodePtr          &from,
00111                                 CHMHMapNodePtr          &to,
00112                                 const THypothesisIDSet          &hyps,
00113                                 CHierarchicalMHMap                      *parent);
00114 
00115                         /** Destructor
00116                           */
00117                         virtual ~CHMHMapArc();
00118 
00119                         /** Return the starting node of the arc:
00120                           */
00121                         CHMHMapNode::TNodeID     getNodeFrom() const { ASSERT_(m_nodeFrom!=AREAID_INVALID); return m_nodeFrom; }
00122 
00123                         /** Return the ending node of the arc:
00124                           */
00125                         CHMHMapNode::TNodeID     getNodeTo() const { ASSERT_(m_nodeTo!=AREAID_INVALID); return m_nodeTo; }
00126 
00127                         /** The type of the arc, the possibilities are:
00128                                         - "Membership": for abstractions
00129                                         - "Navegability"
00130                                         - "RelativePose"
00131                           */
00132                         utils::CTypeSelector                    m_arcType;
00133 
00134                         /** The annotations of the arc, see the general description of the class for possible properties and values.
00135                           */
00136                         utils::CMHPropertiesValuesList  m_annotations;
00137 
00138                 }; // End of class def.
00139 
00140 
00141         } // End of namespace
00142 } // End of namespace
00143 
00144 #endif



Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011