MRPT  2.0.4
List of all members | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends
mrpt::hmtslam::CHMHMapNode Class Reference

Detailed Description

A class for representing a node in a hierarchical, multi-hypothesis map.

The node itself will be considered only if some given hypothesisID matchs its own ID.

Note
Create objects by invoking the class factory "::Create"
See also
CHierarchicalMHMap,CHMHMapArc

Definition at line 33 of file CHMHMapNode.h.

#include <mrpt/hmtslam/CHMHMapNode.h>

Inheritance diagram for mrpt::hmtslam::CHMHMapNode:

Public Types

using TNodeID = mrpt::graphs::TNodeID
 The type of the IDs of nodes. More...
 

Public Member Functions

 CHMHMapNode (CHierarchicalMHMap *parent=nullptr, const THypothesisIDSet &hyps=THypothesisIDSet())
 Constructor. More...
 
 ~CHMHMapNode () override
 Destructor. More...
 
TNodeID getID () const
 Reads the ID of the node (read-only property) More...
 
unsigned int getLevelInTheHierarchy ()
 Returns the level of this node in the hierarchy of arcs "arcType_Belongs", where level=0 is the ground level, 1=its parents, etc. More...
 
unsigned int getRelatedArcsCount ()
 Returns the number of arcs starting from/ending into this node. More...
 
void getArcs (TArcList &out) const
 Returns a list with the arcs from/to this node. More...
 
void getArcs (TArcList &out, const THypothesisID &hyp_id) const
 Returns a list with the arcs from/to this node existing in a given hypothesis ID. More...
 
void getArcs (TArcList &out, const char *arcType, const THypothesisID &hyp_id) const
 Returns a list with the arcs from/to this node existing in a given hypothesis ID and of a given type. More...
 
bool isNeighbor (const TNodeID &otherArea, const THypothesisID &hyp_id) const
 Check whether an arc exists towards the given area. More...
 
virtual mxArraywriteToMatlab () const
 Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class. More...
 
RTTI classes and functions for polymorphic hierarchies
mrpt::rtti::CObject::Ptr duplicateGetSmartPtr () const
 Makes a deep copy of the object and returns a smart pointer to it. More...
 

Public Attributes

THypothesisIDSet m_hypotheses
 The hypothesis IDs under which this node exists. More...
 
CMHPropertiesValuesList m_annotations
 The annotations of the node, see the general description of the class for possible properties and values. More...
 
std::string m_nodeType
 The type of the node, the possibilities are: More...
 
std::string m_label
 The label of the node, only for display it to the user. More...
 

Protected Member Functions

void onArcDestruction (CHMHMapArc *arc)
 Event handler for arc destruction: It should be only called for arcs from/to this node, altought other case must be handled without effects. More...
 
void onArcAddition (const std::shared_ptr< CHMHMapArc > &arc)
 Event handler for arc addition: It should be only called for arcs from/to this node, although other cases have no effects. More...
 
CSerializable virtual methods
uint8_t serializeGetVersion () const override
 Must return the current versioning number of the object. More...
 
void serializeTo (mrpt::serialization::CArchive &out) const override
 Pure virtual method for writing (serializing) to an abstract archive. More...
 
void serializeFrom (mrpt::serialization::CArchive &in, uint8_t serial_version) override
 Pure virtual method for reading (deserializing) from an abstract archive. More...
 
CSerializable virtual methods
virtual void serializeTo (CSchemeArchiveBase &out) const
 Virtual method for writing (serializing) to an abstract schema based archive. More...
 
virtual void serializeFrom (CSchemeArchiveBase &in)
 Virtual method for reading (deserializing) from an abstract schema based archive. More...
 

Protected Attributes

TNodeID m_ID {}
 An unique identifier for the node: it is randomly generated at construction or read from stream when loaded. More...
 
TArcList m_arcs
 The list of all arcs from/to this node: More...
 
mrpt::safe_ptr< CHierarchicalMHMapm_parent
 The hierarchical graph in which this object is into. More...
 

Friends

class CHierarchicalMHMap
 
class CHierarchicalMHMapPartition
 
class CHMHMapArc
 

RTTI stuff

using Ptr = std::shared_ptr< mrpt::hmtslam ::CHMHMapNode >
 
using ConstPtr = std::shared_ptr< const mrpt::hmtslam ::CHMHMapNode >
 
using UniquePtr = std::unique_ptr< mrpt::hmtslam ::CHMHMapNode >
 
using ConstUniquePtr = std::unique_ptr< const mrpt::hmtslam ::CHMHMapNode >
 
static const mrpt::rtti::TRuntimeClassId runtimeClassId
 
static constexpr const char * className = "mrpt::hmtslam" "::" "CHMHMapNode"
 
static const mrpt::rtti::TRuntimeClassId_GetBaseClass ()
 
static constexpr auto getClassName ()
 
static const mrpt::rtti::TRuntimeClassIdGetRuntimeClassIdStatic ()
 
static std::shared_ptr< CObjectCreateObject ()
 
template<typename... Args>
static Ptr Create (Args &&... args)
 
template<typename Alloc , typename... Args>
static Ptr CreateAlloc (const Alloc &alloc, Args &&... args)
 
template<typename... Args>
static UniquePtr CreateUnique (Args &&... args)
 
virtual const mrpt::rtti::TRuntimeClassIdGetRuntimeClass () const override
 Returns information about the class of an object in runtime. More...
 
virtual mrpt::rtti::CObjectclone () const override
 Returns a deep copy (clone) of the object, indepently of its class. More...
 

Member Typedef Documentation

◆ ConstPtr

Definition at line 39 of file CHMHMapNode.h.

◆ ConstUniquePtr

using mrpt::hmtslam::CHMHMapNode::ConstUniquePtr = std::unique_ptr<const mrpt::hmtslam :: CHMHMapNode >

Definition at line 39 of file CHMHMapNode.h.

◆ Ptr

A type for the associated smart pointer

Definition at line 39 of file CHMHMapNode.h.

◆ TNodeID

The type of the IDs of nodes.

Definition at line 44 of file CHMHMapNode.h.

◆ UniquePtr

using mrpt::hmtslam::CHMHMapNode::UniquePtr = std::unique_ptr< mrpt::hmtslam :: CHMHMapNode >

Definition at line 39 of file CHMHMapNode.h.

Constructor & Destructor Documentation

◆ CHMHMapNode()

CHMHMapNode::CHMHMapNode ( CHierarchicalMHMap parent = nullptr,
const THypothesisIDSet hyps = THypothesisIDSet() 
)

Constructor.

Definition at line 23 of file CHMHMapNode.cpp.

◆ ~CHMHMapNode()

CHMHMapNode::~CHMHMapNode ( )
override

Destructor.

Definition at line 54 of file CHMHMapNode.cpp.

Member Function Documentation

◆ _GetBaseClass()

static const mrpt::rtti::TRuntimeClassId* mrpt::hmtslam::CHMHMapNode::_GetBaseClass ( )
staticprotected

◆ clone()

virtual mrpt::rtti::CObject* mrpt::hmtslam::CHMHMapNode::clone ( ) const
overridevirtual

Returns a deep copy (clone) of the object, indepently of its class.

Implements mrpt::rtti::CObject.

◆ Create()

template<typename... Args>
static Ptr mrpt::hmtslam::CHMHMapNode::Create ( Args &&...  args)
inlinestatic

Definition at line 39 of file CHMHMapNode.h.

◆ CreateAlloc()

template<typename Alloc , typename... Args>
static Ptr mrpt::hmtslam::CHMHMapNode::CreateAlloc ( const Alloc &  alloc,
Args &&...  args 
)
inlinestatic

Definition at line 39 of file CHMHMapNode.h.

◆ CreateObject()

static std::shared_ptr<CObject> mrpt::hmtslam::CHMHMapNode::CreateObject ( )
static

◆ CreateUnique()

template<typename... Args>
static UniquePtr mrpt::hmtslam::CHMHMapNode::CreateUnique ( Args &&...  args)
inlinestatic

Definition at line 39 of file CHMHMapNode.h.

◆ duplicateGetSmartPtr()

mrpt::rtti::CObject::Ptr CObject::duplicateGetSmartPtr ( ) const
inlineinherited

Makes a deep copy of the object and returns a smart pointer to it.

Definition at line 204 of file CObject.h.

References mrpt::rtti::CObject::clone().

Referenced by mrpt::obs::CRawlog::insert().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getArcs() [1/3]

void mrpt::hmtslam::CHMHMapNode::getArcs ( TArcList out) const
inline

Returns a list with the arcs from/to this node.

Definition at line 120 of file CHMHMapNode.h.

References m_arcs, and out.

◆ getArcs() [2/3]

void CHMHMapNode::getArcs ( TArcList out,
const THypothesisID hyp_id 
) const

Returns a list with the arcs from/to this node existing in a given hypothesis ID.

Definition at line 167 of file CHMHMapNode.cpp.

References out.

◆ getArcs() [3/3]

void CHMHMapNode::getArcs ( TArcList out,
const char *  arcType,
const THypothesisID hyp_id 
) const

Returns a list with the arcs from/to this node existing in a given hypothesis ID and of a given type.

Definition at line 177 of file CHMHMapNode.cpp.

References out.

◆ getClassName()

static constexpr auto mrpt::hmtslam::CHMHMapNode::getClassName ( )
inlinestatic

Definition at line 39 of file CHMHMapNode.h.

◆ getID()

CHMHMapNode::TNodeID CHMHMapNode::getID ( ) const

Reads the ID of the node (read-only property)

Definition at line 131 of file CHMHMapNode.cpp.

Referenced by mrpt::hmtslam::CHierarchicalMHMap::onNodeDestruction(), and mrpt::hmtslam::CHMHMapArc::onNodeDestruction().

Here is the caller graph for this function:

◆ getLevelInTheHierarchy()

unsigned int CHMHMapNode::getLevelInTheHierarchy ( )

Returns the level of this node in the hierarchy of arcs "arcType_Belongs", where level=0 is the ground level, 1=its parents, etc.

Definition at line 135 of file CHMHMapNode.cpp.

◆ getRelatedArcsCount()

unsigned int CHMHMapNode::getRelatedArcsCount ( )

Returns the number of arcs starting from/ending into this node.

Definition at line 159 of file CHMHMapNode.cpp.

◆ GetRuntimeClass()

virtual const mrpt::rtti::TRuntimeClassId* mrpt::hmtslam::CHMHMapNode::GetRuntimeClass ( ) const
overridevirtual

Returns information about the class of an object in runtime.

Reimplemented from mrpt::serialization::CSerializable.

◆ GetRuntimeClassIdStatic()

static const mrpt::rtti::TRuntimeClassId& mrpt::hmtslam::CHMHMapNode::GetRuntimeClassIdStatic ( )
static

◆ isNeighbor()

bool CHMHMapNode::isNeighbor ( const TNodeID otherArea,
const THypothesisID hyp_id 
) const

Check whether an arc exists towards the given area.

Definition at line 189 of file CHMHMapNode.cpp.

◆ onArcAddition()

void CHMHMapNode::onArcAddition ( const std::shared_ptr< CHMHMapArc > &  arc)
protected

Event handler for arc addition: It should be only called for arcs from/to this node, although other cases have no effects.

Definition at line 114 of file CHMHMapNode.cpp.

References MRPT_END, and MRPT_START.

◆ onArcDestruction()

void CHMHMapNode::onArcDestruction ( CHMHMapArc arc)
protected

Event handler for arc destruction: It should be only called for arcs from/to this node, altought other case must be handled without effects.

Note
At *addition we use a smart pointer to assure all the implied guys use the same smrt. pnt., but at destructors the objects don't know anything but "this", thus the usage of plain pointers.

Definition at line 93 of file CHMHMapNode.cpp.

References mrpt::hmtslam::CHMHMapArc::m_nodeFrom, mrpt::hmtslam::CHMHMapArc::m_nodeTo, MRPT_END, and MRPT_START.

◆ serializeFrom() [1/2]

void CHMHMapNode::serializeFrom ( mrpt::serialization::CArchive in,
uint8_t  serial_version 
)
overrideprotectedvirtual

Pure virtual method for reading (deserializing) from an abstract archive.

Users don't call this method directly. Instead, use stream >> object;.

Parameters
inThe input binary stream where the object data must read from.
versionThe version of the object stored in the stream: use this version number in your code to know how to read the incoming data.
Exceptions
std::exceptionOn any I/O error

Implements mrpt::serialization::CSerializable.

Definition at line 72 of file CHMHMapNode.cpp.

References MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION.

◆ serializeFrom() [2/2]

virtual void mrpt::serialization::CSerializable::serializeFrom ( CSchemeArchiveBase in)
inlineprotectedvirtualinherited

Virtual method for reading (deserializing) from an abstract schema based archive.

Definition at line 74 of file CSerializable.h.

References mrpt::serialization::CSerializable::GetRuntimeClass(), and THROW_EXCEPTION.

Here is the call graph for this function:

◆ serializeGetVersion()

uint8_t CHMHMapNode::serializeGetVersion ( ) const
overrideprotectedvirtual

Must return the current versioning number of the object.

Start in zero for new classes, and increments each time there is a change in the stored format.

Implements mrpt::serialization::CSerializable.

Definition at line 63 of file CHMHMapNode.cpp.

◆ serializeTo() [1/2]

void CHMHMapNode::serializeTo ( mrpt::serialization::CArchive out) const
overrideprotectedvirtual

Pure virtual method for writing (serializing) to an abstract archive.

Users don't call this method directly. Instead, use stream << object;.

Exceptions
std::exceptionOn any I/O error

Implements mrpt::serialization::CSerializable.

Definition at line 64 of file CHMHMapNode.cpp.

References out.

◆ serializeTo() [2/2]

virtual void mrpt::serialization::CSerializable::serializeTo ( CSchemeArchiveBase out) const
inlineprotectedvirtualinherited

Virtual method for writing (serializing) to an abstract schema based archive.

Definition at line 64 of file CSerializable.h.

References mrpt::serialization::CSerializable::GetRuntimeClass(), and THROW_EXCEPTION.

Here is the call graph for this function:

◆ writeToMatlab()

virtual mxArray* mrpt::serialization::CSerializable::writeToMatlab ( ) const
inlinevirtualinherited

Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class.

Returns
A new mxArray (caller is responsible of memory freeing) or nullptr is class does not support conversion to MATLAB.

Definition at line 90 of file CSerializable.h.

Friends And Related Function Documentation

◆ CHierarchicalMHMap

friend class CHierarchicalMHMap
friend

Definition at line 35 of file CHMHMapNode.h.

◆ CHierarchicalMHMapPartition

friend class CHierarchicalMHMapPartition
friend

Definition at line 36 of file CHMHMapNode.h.

◆ CHMHMapArc

friend class CHMHMapArc
friend

Definition at line 37 of file CHMHMapNode.h.

Member Data Documentation

◆ className

constexpr const char* mrpt::hmtslam::CHMHMapNode::className = "mrpt::hmtslam" "::" "CHMHMapNode"
static

Definition at line 39 of file CHMHMapNode.h.

◆ m_annotations

CMHPropertiesValuesList mrpt::hmtslam::CHMHMapNode::m_annotations

The annotations of the node, see the general description of the class for possible properties and values.

Definition at line 91 of file CHMHMapNode.h.

◆ m_arcs

TArcList mrpt::hmtslam::CHMHMapNode::m_arcs
protected

The list of all arcs from/to this node:

Definition at line 58 of file CHMHMapNode.h.

Referenced by getArcs().

◆ m_hypotheses

THypothesisIDSet mrpt::hmtslam::CHMHMapNode::m_hypotheses

The hypothesis IDs under which this node exists.

Definition at line 48 of file CHMHMapNode.h.

◆ m_ID

TNodeID mrpt::hmtslam::CHMHMapNode::m_ID {}
protected

An unique identifier for the node: it is randomly generated at construction or read from stream when loaded.

Definition at line 54 of file CHMHMapNode.h.

◆ m_label

std::string mrpt::hmtslam::CHMHMapNode::m_label

The label of the node, only for display it to the user.

Definition at line 107 of file CHMHMapNode.h.

◆ m_nodeType

std::string mrpt::hmtslam::CHMHMapNode::m_nodeType

The type of the node, the possibilities are:

  • Place
  • Area
  • TopologicalMap
  • Object

Definition at line 99 of file CHMHMapNode.h.

◆ m_parent

mrpt::safe_ptr<CHierarchicalMHMap> mrpt::hmtslam::CHMHMapNode::m_parent
protected

The hierarchical graph in which this object is into.

Definition at line 75 of file CHMHMapNode.h.

◆ runtimeClassId

const mrpt::rtti::TRuntimeClassId mrpt::hmtslam::CHMHMapNode::runtimeClassId
staticprotected

Definition at line 39 of file CHMHMapNode.h.




Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020