29 if (pBaseClass ==
this)
return true;
36 while (pClassThis !=
nullptr)
38 if (pClassThis == pBaseClass)
return true;
57 pBaseClass !=
nullptr,
58 format(
"Class %s not registered??", pBaseClass_name));
61 if (pBaseClass ==
this)
return true;
65 while (pClassThis !=
nullptr)
67 if (pClassThis == pBaseClass)
return true;
85 "[TRuntimeClassId::createObject] Trying to create an object " 86 "without dynamic constructor. classname=`%s`\n",
93 CObject* ret = (*ptrCreateObject)();
96 catch (std::bad_alloc&)
112 if (!pR)
return nullptr;
113 return pR->createObject();
121 if (pR) ret.reset(pR->createObject());
void registerAllPendingClasses()
Register all pending classes - to be called just before de-serializing an object, for example...
mrpt::rtti::CObject *(* ptrCreateObject)()
Create an object of the related class, or nullptr if it is virtual.
A structure that holds runtime class type information.
const TRuntimeClassId *(* getBaseClass)()
Gets the base class runtime id.
The virtual base class of all MRPT classes with a unified RTTI system.
#define ASSERT_(f)
Defines an assertion mechanism.
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism.
GLsizei const GLchar ** string
int fprintf(FILE *fil, const char *format,...) noexcept MRPT_printf_format_check(2
An OS-independent version of fprintf.
const TRuntimeClassId * findRegisteredClass(const std::string &className)
Return info about a given class by its name, or nullptr if the class is not registered.
mrpt::rtti::CObject * classFactory(const std::string &className)
Creates an object given by its registered name.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
static const mrpt::rtti::TRuntimeClassId & GetRuntimeClassIdStatic()
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
static mrpt::rtti::TRuntimeClassId * _GetBaseClass()
bool derivedFrom(const TRuntimeClassId *pBaseClass) const
static const mrpt::rtti::TRuntimeClassId runtimeClassId
mrpt::rtti::CObject * createObject() const
mrpt::rtti::CObject::Ptr classFactoryPtr(const std::string &className)
Like classFactory() but returns a smart pointer.