MRPT  2.0.1
Namespaces | Classes | Typedefs | Functions | Variables
mrpt::rtti Namespace Reference

Namespaces

 internal
 

Classes

class  CClassRegistry
 A singleton with the central registry for CSerializable run-time classes: users do not use this class in any direct way. More...
 
struct  CLASS_ID_impl
 
struct  CLASS_ID_impl< std::monostate >
 
class  CListOfClasses
 A list (actually based on a std::set) of MRPT classes, capable of keeping any class registered by the mechanism of CObject classes. More...
 
class  CObject
 Virtual base to provide a compiler-independent RTTI system. More...
 
struct  IS_CLASS_impl
 
struct  queue_register_functions_t
 
struct  TRuntimeClassId
 A structure that holds runtime class type information. More...
 

Typedefs

using TClassnameToRuntimeId = std::map< std::string, const TRuntimeClassId * >
 
using TRegisterFunction = void(*)()
 

Functions

std::atomic< int > & pending_class_registers_count ()
 
queue_register_functions_tpending_class_registers ()
 
RTTI classes and functions for polymorphic hierarchies
void registerClass (const mrpt::rtti::TRuntimeClassId *pNewClass)
 Register a class into the MRPT internal list of "CObject" descendents. More...
 
void 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 * > getAllRegisteredClasses ()
 Returns a list with all the classes registered in the system through mrpt::rtti::registerClass. More...
 
std::vector< const TRuntimeClassId * > getAllRegisteredClassesChildrenOf (const TRuntimeClassId *parent_id)
 Like getAllRegisteredClasses(), but filters the list to only include children clases of a given base one. More...
 
const TRuntimeClassIdfindRegisteredClass (const std::string &className, const bool allow_ignore_namespace=true)
 Return info about a given class by its name, or nullptr if the class is not registered. More...
 
void registerAllPendingClasses ()
 Register all pending classes - to be called just before de-serializing an object, for example. More...
 
mrpt::rtti::CObject::Ptr classFactory (const std::string &className)
 Creates an object given by its registered name. More...
 

Variables

bool pending_class_registers_modified = false
 Set to true if pending_class_registers() has been called after registerAllPendingClasses(). More...
 

Typedef Documentation

◆ TClassnameToRuntimeId

using mrpt::rtti::TClassnameToRuntimeId = typedef std::map<std::string, const TRuntimeClassId*>

Definition at line 46 of file internal_class_registry.cpp.

◆ TRegisterFunction

using mrpt::rtti::TRegisterFunction = typedef void (*)()

Definition at line 17 of file internal_class_registry.h.

Function Documentation

◆ classFactory()

mrpt::rtti::CObject::Ptr mrpt::rtti::classFactory ( const std::string &  className)

Creates an object given by its registered name.

See also
findRegisteredClass(), registerClass()
Examples:
rtti_example1/test.cpp.

Definition at line 108 of file CObject.cpp.

References findRegisteredClass().

Referenced by TEST().

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

◆ findRegisteredClass()

const TRuntimeClassId * mrpt::rtti::findRegisteredClass ( const std::string &  className,
const bool  allow_ignore_namespace = true 
)

Return info about a given class by its name, or nullptr if the class is not registered.

The list of registered "namespaces::class_name" will be looked up first. If no match is found, and allow_ignore_namespace=true, then a second search will be performed looking for a match of the class name without the namespace part. Note that this is enabled by default since namespaces were not used while serializing classes in MRPT older than v2.0, so this option allows reading from older datasets transparently. It could be set to false if it is ensured that only mrpt2 datasets will be read.

Parameters
[in]classNameThe name of the class to look up
[i]allow_ignore_namespace See discussion above
See also
registerClass, getAllRegisteredClasses

Definition at line 240 of file internal_class_registry.cpp.

References mrpt::rtti::CClassRegistry::Get(), and mrpt::rtti::CClassRegistry::Instance().

Referenced by classFactory(), mrpt::nav::CParameterizedTrajectoryGenerator::CreatePTG(), mrpt::rtti::TRuntimeClassId::derivedFrom(), mrpt::nav::CMultiObjectiveMotionOptimizerBase::Factory(), mrpt::nav::CAbstractHolonomicReactiveMethod::Factory(), mrpt::rtti::CListOfClasses::fromString(), mrpt::serialization::CArchive::ReadObject(), and mrpt::serialization::CArchive::ReadVariant().

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

◆ getAllRegisteredClasses()

std::vector< const TRuntimeClassId * > mrpt::rtti::getAllRegisteredClasses ( )

Returns a list with all the classes registered in the system through mrpt::rtti::registerClass.

See also
registerClass, findRegisteredClass
Examples:
rtti_example1/test.cpp.

Definition at line 216 of file internal_class_registry.cpp.

References mrpt::rtti::CClassRegistry::getListOfAllRegisteredClasses(), and mrpt::rtti::CClassRegistry::Instance().

Referenced by getAllRegisteredClassesChildrenOf().

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

◆ getAllRegisteredClassesChildrenOf()

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.

See also
getAllRegisteredClasses(), getAllRegisteredClassesChildrenOf()

Definition at line 222 of file internal_class_registry.cpp.

References getAllRegisteredClasses().

Referenced by mrpt::nav::CAbstractPTGBasedReactive::saveConfigFile(), and mrpt::nav::CAbstractPTGBasedReactive::TAbstractPTGNavigatorParams::saveToConfigFile().

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

◆ pending_class_registers()

queue_register_functions_t & mrpt::rtti::pending_class_registers ( )

Definition at line 37 of file internal_class_registry.cpp.

References pending_class_registers_modified.

Referenced by registerAllPendingClasses().

Here is the caller graph for this function:

◆ pending_class_registers_count()

std::atomic< int > & mrpt::rtti::pending_class_registers_count ( )

Definition at line 30 of file internal_class_registry.cpp.

Referenced by registerAllPendingClasses().

Here is the caller graph for this function:

◆ registerAllPendingClasses()

void mrpt::rtti::registerAllPendingClasses ( )

Register all pending classes - to be called just before de-serializing an object, for example.

After calling this method, pending_class_registers_modified is set to false until pending_class_registers() is invoked.

Definition at line 161 of file internal_class_registry.cpp.

References mrpt::rtti::queue_register_functions_t::get(), pending_class_registers(), pending_class_registers_count(), and pending_class_registers_modified.

Referenced by mrpt::nav::CParameterizedTrajectoryGenerator::CreatePTG(), mrpt::rtti::TRuntimeClassId::derivedFrom(), mrpt::nav::CMultiObjectiveMotionOptimizerBase::Factory(), mrpt::nav::CAbstractHolonomicReactiveMethod::Factory(), registerClass(), and registerClassCustomName().

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

◆ registerClass()

void mrpt::rtti::registerClass ( const mrpt::rtti::TRuntimeClassId pNewClass)

Register a class into the MRPT internal list of "CObject" descendents.

Used internally in the macros DEFINE_SERIALIZABLE, etc...

See also
getAllRegisteredClasses
Examples:
rtti_example1/test.cpp.

Definition at line 183 of file internal_class_registry.cpp.

References mrpt::rtti::CClassRegistry::Add(), mrpt::rtti::TRuntimeClassId::className, mrpt::system::os::fprintf(), mrpt::rtti::CClassRegistry::Instance(), and registerAllPendingClasses().

Referenced by do_register(), MRPT_INITIALIZER(), and TEST().

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

◆ registerClassCustomName()

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,...)

For internal use within mrpt sources, and only in exceptional cases (CMultiMetricMaps, CImage,...)

Examples:
rtti_example1/test.cpp.

Definition at line 206 of file internal_class_registry.cpp.

References mrpt::rtti::CClassRegistry::Add(), mrpt::rtti::CClassRegistry::Instance(), and registerAllPendingClasses().

Here is the call graph for this function:

Variable Documentation

◆ pending_class_registers_modified

bool mrpt::rtti::pending_class_registers_modified = false

Set to true if pending_class_registers() has been called after registerAllPendingClasses().

Startup value is false.

Definition at line 27 of file internal_class_registry.cpp.

Referenced by pending_class_registers(), and registerAllPendingClasses().




Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020