MRPT  1.9.9
CObject.h File Reference
#include <mrpt/core/aligned_allocator.h>
#include <mrpt/core/safe_pointers.h>
#include <mrpt/typemeta/static_string.h>
#include <functional>
#include <memory>
#include <vector>
Include dependency graph for CObject.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mrpt::rtti::TRuntimeClassId
 A structure that holds runtime class type information. More...
 
struct  mrpt::rtti::CLASS_ID_impl< T >
 
struct  mrpt::rtti::IS_CLASS_impl< T >
 
struct  mrpt::rtti::internal::CopyCtor< is_copy_ctrtible >
 
struct  mrpt::rtti::internal::CopyCtor< true >
 
struct  mrpt::rtti::internal::CopyCtor< false >
 
class  mrpt::rtti::CObject
 Virtual base to provide a compiler-independent RTTI system. More...
 
struct  mrpt::ptr_cast< CAST_TO >
 Converts a polymorphic smart pointer Base::Ptr to Derived::Ptr, in a way compatible with MRPT >=1.5.4 and MRPT 2.x series. More...
 

Namespaces

 mrpt
 This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
 
 mrpt::rtti
 
 mrpt::rtti::internal
 

RTTI classes and functions for polymorphic hierarchies

#define CLASS_ID(T)   mrpt::rtti::CLASS_ID_impl<T>::get()
 Access to runtime class ID for a defined class name. More...
 
#define CLASS_ID_TEMPLATE(class_name, T)   mrpt::rtti::CLASS_ID_impl<T>::get()
 
#define CLASS_ID_NAMESPACE(class_name, namespaceName)   mrpt::rtti::CLASS_ID_impl<namespaceName::class_name>::get()
 
#define IS_CLASS(obj, class_name)   mrpt::rtti::IS_CLASS_impl<class_name>::check(obj)
 True if the given reference to object (derived from mrpt::rtti::CObject) is of the given class. More...
 
#define IS_DERIVED(obj, class_name)   ((obj).GetRuntimeClass()->derivedFrom(CLASS_ID(class_name)))
 True if the given reference to object (derived from mrpt::rtti::CObject) is an instance of the given class OR any of its derived classes. More...
 
#define DEFINE_MRPT_OBJECT(class_name)
 This declaration must be inserted in all CObject classes definition, within the class declaration. More...
 
#define INTERNAL_IMPLEMENTS_MRPT_OBJECT( class_name, base, NameSpace, class_registry_name)
 
#define IMPLEMENTS_MRPT_OBJECT_NS_PREFIX(class_name, base, NameSpace)
 This must be inserted in all CObject classes implementation files. More...
 
#define IMPLEMENTS_MRPT_OBJECT(class_name, base, NameSpace)   INTERNAL_IMPLEMENTS_MRPT_OBJECT(class_name, base, NameSpace, #class_name)
 Must be added to all CObject-derived classes implementation file. More...
 
#define DEFINE_VIRTUAL_MRPT_OBJECT(class_name)
 This declaration must be inserted in virtual CObject classes definition: More...
 
#define INTERNAL_IMPLEMENTS_VIRTUAL_MRPT_OBJECT( class_name, base_name, NS, registered_name)
 This must be inserted as implementation of some required members for virtual CObject classes: More...
 
#define IMPLEMENTS_VIRTUAL_MRPT_OBJECT_NS_PREFIX(class_name, base, NS)
 
#define IMPLEMENTS_VIRTUAL_MRPT_OBJECT(class_name, base, NS)   INTERNAL_IMPLEMENTS_VIRTUAL_MRPT_OBJECT(class_name, base, NS, #class_name)
 
void mrpt::rtti::registerClass (const mrpt::rtti::TRuntimeClassId *pNewClass)
 Register a class into the MRPT internal list of "CObject" descendents. More...
 
void mrpt::rtti::registerClassCustomName (const char *customName, const TRuntimeClassId *pNewClass)
 Mostly for internal use within mrpt sources, to handle exceptional cases with multiple serialization names for backward compatibility (CMultiMetricMaps, CImage,...) More...
 
std::vector< const mrpt::rtti::TRuntimeClassId * > mrpt::rtti::getAllRegisteredClasses ()
 Returns a list with all the classes registered in the system through mrpt::rtti::registerClass. More...
 
std::vector< const TRuntimeClassId * > mrpt::rtti::getAllRegisteredClassesChildrenOf (const TRuntimeClassId *parent_id)
 Like getAllRegisteredClasses(), but filters the list to only include children clases of a given base one. More...
 
const TRuntimeClassIdmrpt::rtti::findRegisteredClass (const std::string &className)
 Return info about a given class by its name, or nullptr if the class is not registered. More...
 
void mrpt::rtti::registerAllPendingClasses ()
 Register all pending classes - to be called just before de-serializing an object, for example. More...
 
mrpt::rtti::CObject::Ptr mrpt::rtti::classFactory (const std::string &className)
 Creates an object given by its registered name. More...
 

Macro Definition Documentation

◆ CLASS_ID

#define CLASS_ID (   T)    mrpt::rtti::CLASS_ID_impl<T>::get()

Access to runtime class ID for a defined class name.

Examples:
rtti_example1/test.cpp.

Definition at line 89 of file CObject.h.

Referenced by mrpt::slam::CGridMapAligner::AlignPDF_correlation(), mrpt::hwdrivers::CGenericSensor::appendObservations(), mrpt::poses::CPoint2DPDFGaussian::bayesianFusion(), mrpt::poses::CPose3DPDFSOG::bayesianFusion(), mrpt::poses::CPosePDFGaussian::bayesianFusion(), mrpt::poses::CPointPDFGaussian::bayesianFusion(), mrpt::poses::CPosePDFGaussianInf::bayesianFusion(), mrpt::poses::CPointPDFSOG::bayesianFusion(), mrpt::poses::CPosePDFSOG::bayesianFusion(), mrpt::hmtslam::CLocalMetricHypothesis::changeCoordinateOrigin(), mrpt::maps::CBeaconMap::compute3DMatchingRatio(), mrpt::maps::CLandmarksMap::compute3DMatchingRatio(), mrpt::maps::CLandmarksMap::computeMatchingWith2D(), mrpt::poses::CPose3DPDFParticles::copyFrom(), mrpt::poses::CPosePDFParticles::copyFrom(), mrpt::poses::CPose3DPDFSOG::copyFrom(), mrpt::poses::CPointPDFSOG::copyFrom(), mrpt::poses::CPosePDFSOG::copyFrom(), mrpt::poses::CPose3DPDF::createFrom2D(), mrpt::maps::CBeaconMap::determineMatching2D(), mrpt::maps::COccupancyGridMap2D::determineMatching2D(), mrpt::maps::CPointsMap::determineMatching3D(), mrpt::obs::CRawlog::findObservationsByClassInRange(), mrpt::obs::CRawlog::getActionObservationPairOrObservation(), mrpt::obs::CRawlog::getAsAction(), mrpt::obs::CRawlog::getAsObservation(), mrpt::obs::CRawlog::getAsObservations(), mrpt::obs::CActionCollection::getBestMovementEstimation(), mrpt::obs::CActionCollection::getMovementEstimationByType(), mrpt::rtti::CObject::GetRuntimeClass(), mrpt::obs::CRawlog::getType(), mrpt::obs::CRawlog::iterator::getType(), mrpt::obs::CRawlog::const_iterator::getType(), mrpt::slam::CICP::ICP3D_Method_Classic(), mrpt::slam::CICP::ICP_Method_LM(), mrpt::maps::CBeaconMap::internal_computeObservationLikelihood(), mrpt::maps::CLandmarksMap::internal_computeObservationLikelihood(), mrpt::maps::CBeaconMap::internal_insertObservation(), mrpt::maps::CLandmarksMap::internal_insertObservation(), mrpt::poses::CPose3DPDFParticles::inverse(), mrpt::poses::CPose3DQuatPDFGaussianInf::inverse(), mrpt::poses::CPose3DQuatPDFGaussian::inverse(), mrpt::poses::CPose3DPDFSOG::inverse(), mrpt::poses::CPose3DPDFGaussianInf::inverse(), mrpt::poses::CPosePDFParticles::inverse(), mrpt::poses::CPosePDFGaussian::inverse(), mrpt::poses::CPose3DPDFGaussian::inverse(), mrpt::poses::CPosePDFGaussianInf::inverse(), mrpt::poses::CPosePDFSOG::inverse(), mrpt::obs::CRawlog::loadFromRawLogFile(), MRPT_INITIALIZER(), mrpt::topography::path_from_rtk_gps(), mrpt::detectors::CDetectorDoorCrossing::process(), mrpt::obs::CRawlog::readActionObservationPair(), mrpt::nav::CAbstractPTGBasedReactive::saveConfigFile(), mrpt::nav::CAbstractPTGBasedReactive::TAbstractPTGNavigatorParams::saveToConfigFile(), TEST(), and mrpt::hmtslam::CHMTSLAM::thread_LSLAM().

◆ CLASS_ID_NAMESPACE

◆ CLASS_ID_TEMPLATE

#define CLASS_ID_TEMPLATE (   class_name,
 
)    mrpt::rtti::CLASS_ID_impl<T>::get()

Definition at line 91 of file CObject.h.

◆ DEFINE_MRPT_OBJECT

#define DEFINE_MRPT_OBJECT (   class_name)

This declaration must be inserted in all CObject classes definition, within the class declaration.

Examples:
rtti_example1/test.cpp.

Definition at line 198 of file CObject.h.

◆ DEFINE_VIRTUAL_MRPT_OBJECT

#define DEFINE_VIRTUAL_MRPT_OBJECT (   class_name)
Value:
/*! @name RTTI stuff */ \
/*! @{ */ \
protected: \
static const mrpt::rtti::TRuntimeClassId* _GetBaseClass(); \
static const mrpt::rtti::TRuntimeClassId runtimeClassId; \
\
public: \
virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() \
const override; \
static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); \
/*! @} */
A structure that holds runtime class type information.
Definition: CObject.h:31

This declaration must be inserted in virtual CObject classes definition:

Examples:
rtti_example1/test.cpp.

Definition at line 288 of file CObject.h.

◆ IMPLEMENTS_MRPT_OBJECT

#define IMPLEMENTS_MRPT_OBJECT (   class_name,
  base,
  NameSpace 
)    INTERNAL_IMPLEMENTS_MRPT_OBJECT(class_name, base, NameSpace, #class_name)

Must be added to all CObject-derived classes implementation file.

This version does NOT include the namespace in the name of the class when registering.

Definition at line 282 of file CObject.h.

◆ IMPLEMENTS_MRPT_OBJECT_NS_PREFIX

#define IMPLEMENTS_MRPT_OBJECT_NS_PREFIX (   class_name,
  base,
  NameSpace 
)
Value:
class_name, base, NameSpace, #NameSpace "::" #class_name)
#define INTERNAL_IMPLEMENTS_MRPT_OBJECT( class_name, base, NameSpace, class_registry_name)
Definition: CObject.h:240

This must be inserted in all CObject classes implementation files.

This version registers calss ns1::Foo as "ns1::Foo", where are IMPLEMENTS_MRPT_OBJECT() makes it for some random name.

Definition at line 274 of file CObject.h.

◆ IMPLEMENTS_VIRTUAL_MRPT_OBJECT

#define IMPLEMENTS_VIRTUAL_MRPT_OBJECT (   class_name,
  base,
  NS 
)    INTERNAL_IMPLEMENTS_VIRTUAL_MRPT_OBJECT(class_name, base, NS, #class_name)

Definition at line 328 of file CObject.h.

◆ IMPLEMENTS_VIRTUAL_MRPT_OBJECT_NS_PREFIX

#define IMPLEMENTS_VIRTUAL_MRPT_OBJECT_NS_PREFIX (   class_name,
  base,
  NS 
)
Value:
class_name, base, NS, #NS "::" #class_name)
#define INTERNAL_IMPLEMENTS_VIRTUAL_MRPT_OBJECT( class_name, base_name, NS, registered_name)
This must be inserted as implementation of some required members for virtual CObject classes: ...
Definition: CObject.h:306

Definition at line 324 of file CObject.h.

◆ INTERNAL_IMPLEMENTS_MRPT_OBJECT

#define INTERNAL_IMPLEMENTS_MRPT_OBJECT (   class_name,
  base,
  NameSpace,
  class_registry_name 
)
Value:
mrpt::rtti::CObject::Ptr NameSpace::class_name::CreateObject() \
{ \
return std::static_pointer_cast<CObject>( \
std::make_shared<NameSpace::class_name>()); \
} \
const mrpt::rtti::TRuntimeClassId* NameSpace::class_name::_GetBaseClass() \
{ \
return CLASS_ID(base); \
} \
NameSpace::class_name::GetRuntimeClassIdStatic() \
{ \
return NameSpace::class_name::runtimeClassId; \
} \
const mrpt::rtti::TRuntimeClassId NameSpace::class_name::runtimeClassId = \
{class_registry_name, NameSpace::class_name::CreateObject, \
&class_name::_GetBaseClass}; \
NameSpace::class_name::GetRuntimeClass() const \
{ \
return CLASS_ID_NAMESPACE(class_name, NameSpace); \
} \
mrpt::rtti::CObject* NameSpace::class_name::clone() const \
{ \
return mrpt::rtti::internal::CopyCtor<std::is_copy_constructible< \
NameSpace::class_name>::value>::clone(*this); \
}
A structure that holds runtime class type information.
Definition: CObject.h:31
#define CLASS_ID(T)
Access to runtime class ID for a defined class name.
Definition: CObject.h:89
#define CLASS_ID_NAMESPACE(class_name, namespaceName)
Definition: CObject.h:92
GLsizei const GLfloat * value
Definition: glext.h:4134

Definition at line 240 of file CObject.h.

◆ INTERNAL_IMPLEMENTS_VIRTUAL_MRPT_OBJECT

#define INTERNAL_IMPLEMENTS_VIRTUAL_MRPT_OBJECT (   class_name,
  base_name,
  NS,
  registered_name 
)
Value:
const mrpt::rtti::TRuntimeClassId* NS::class_name::_GetBaseClass() \
{ \
return CLASS_ID(base_name); \
} \
const mrpt::rtti::TRuntimeClassId NS::class_name::runtimeClassId = { \
registered_name, nullptr, &NS::class_name::_GetBaseClass}; \
const mrpt::rtti::TRuntimeClassId* NS::class_name::GetRuntimeClass() const \
{ \
return CLASS_ID(class_name); \
} \
NS::class_name::GetRuntimeClassIdStatic() \
{ \
return NS::class_name::runtimeClassId; \
}
A structure that holds runtime class type information.
Definition: CObject.h:31
#define CLASS_ID(T)
Access to runtime class ID for a defined class name.
Definition: CObject.h:89

This must be inserted as implementation of some required members for virtual CObject classes:

Definition at line 306 of file CObject.h.

◆ IS_CLASS

#define IS_CLASS (   obj,
  class_name 
)    mrpt::rtti::IS_CLASS_impl<class_name>::check(obj)

True if the given reference to object (derived from mrpt::rtti::CObject) is of the given class.

Examples:
rtti_example1/test.cpp.

Definition at line 133 of file CObject.h.

Referenced by mrpt::graphslam::CGraphSlamEngine< GRAPH_T >::_execGraphSlamStep(), mrpt::obs::CRawlog::addObservationMemoryReference(), mrpt::slam::CGridMapAligner::AlignPDF_robustMatch(), mrpt::graphslam::apps::TUserOptionsChecker< GRAPH_T >::checkOptimizerExists(), mrpt::graphslam::apps::TUserOptionsChecker< GRAPH_T >::checkRegistrationDeciderExists(), mrpt::maps::CMultiMetricMapPDF::clear(), mrpt::maps::COccupancyGridMap2D::computeObservationLikelihood_CellsDifference(), mrpt::maps::COccupancyGridMap2D::computeObservationLikelihood_Consensus(), mrpt::maps::COccupancyGridMap2D::computeObservationLikelihood_ConsensusOWA(), mrpt::maps::COccupancyGridMap2D::computeObservationLikelihood_likelihoodField_II(), mrpt::maps::COccupancyGridMap2D::computeObservationLikelihood_likelihoodField_Thrun(), mrpt::maps::COccupancyGridMap2D::computeObservationLikelihood_rayTracing(), mrpt::poses::CPosePDFGaussianInf::copyFrom(), mrpt::poses::CPose3DPDFGaussianInf::copyFrom(), mrpt::maps::CHeightGridMap2D_Base::dem_internal_insertObservation(), mrpt::detectors::CCascadeClassifierDetection::detectObjects_Impl(), mrpt::detectors::CFaceDetection::detectObjects_Impl(), mrpt::poses::CPoseRandomSampler::do_sample_2D(), mrpt::poses::CPoseRandomSampler::do_sample_3D(), mrpt::hmtslam::CHierarchicalMHMap::dumpAsXMLfile(), mrpt::obs::CRawlog::getActionObservationPairOrObservation(), mrpt::hwdrivers::CCameraSensor::getNextFrame(), mrpt::opengl::CSetOfObjects::initializeAllTextures(), mrpt::opengl::COpenGLViewport::initializeAllTextures(), mrpt::maps::COctoMapBase< octomap::OcTree, octomap::OcTreeNode >::internal_build_PointCloud_for_observation(), mrpt::obs::CSensoryFrame::internal_buildAuxPointsMap(), mrpt::maps::COccupancyGridMap2D::internal_canComputeObservationLikelihood(), mrpt::maps::CReflectivityGridMap2D::internal_computeObservationLikelihood(), mrpt::maps::CPointsMap::internal_computeObservationLikelihood(), mrpt::maps::COccupancyGridMap2D::internal_computeObservationLikelihood(), mrpt::maps::CWirelessPowerGridMap2D::internal_insertObservation(), mrpt::maps::CReflectivityGridMap2D::internal_insertObservation(), mrpt::maps::CGasConcentrationGridMap2D::internal_insertObservation(), mrpt::maps::CColouredOctoMap::internal_insertObservation(), mrpt::maps::COccupancyGridMap2D::internal_insertObservation(), mrpt::maps::CPointsMap::internal_insertObservation(), mrpt::opengl::COpenGLScene::internal_visitAllObjects(), mrpt::obs::CRawlog::loadFromRawLogFile(), mrpt::slam::observationsOverlap(), mrpt::opengl::CSetOfObjects::posePDF2opengl(), mrpt::maps::CMultiMetricMapPDF::prediction_and_update_pfOptimalProposal(), mrpt::obs::CActionRobotMovement2D::prepareFastDrawSingleSample_modelGaussian(), mrpt::slam::CMetricMapBuilderICP::processObservation(), mrpt::serialization::CArchive::ReadVariant_helper(), mrpt::poses::CPoseRandomSampler::setPosePDF(), mrpt::hmtslam::CHMTSLAM::TBI_main_method(), mrpt::hwdrivers::CCameraSensor::thread_save_images(), mrpt::graphslam::deciders::CFixedIntervalsNRD< GRAPH_T >::updateState(), mrpt::graphslam::deciders::CICPCriteriaERD< GRAPH_T >::updateState(), and mrpt::graphslam::deciders::CICPCriteriaNRD< GRAPH_T >::updateState().

◆ IS_DERIVED

#define IS_DERIVED (   obj,
  class_name 
)    ((obj).GetRuntimeClass()->derivedFrom(CLASS_ID(class_name)))



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 034c2ee2a Tue Aug 20 02:15:02 2019 +0200 at mar ago 20 02:20:10 CEST 2019