Go to the documentation of this file.
32 static std::atomic<int> cnt(0);
67 m_being_modified =
true;
69 std::unique_lock<std::mutex> lk(m_cs);
72 const auto it = registeredClasses.find(className);
73 if (it != registeredClasses.cend())
75 if (it->second != &
id)
78 "[MRPT class registry] Warning: overwriting already "
79 "registered className=`%s` with different "
80 "`TRuntimeClassId`!\n",
84 registeredClasses[className] = &
id;
86 m_being_modified =
false;
92 bool has_to_unlock =
false;
99 if (has_to_unlock) m_cs.unlock();
105 std::unique_lock<std::mutex> lk(m_cs);
107 std::vector<const TRuntimeClassId*> ret;
109 it != registeredClasses.end(); ++it)
110 ret.push_back(it->second);
144 if (ptrToPtr !=
nullptr)
183 std::vector<const TRuntimeClassId*>
187 std::vector<const TRuntimeClassId*>
res;
189 for (
const auto&
c : lst)
191 if (
c->derivedFrom(parent_id) &&
c != parent_id)
void registerClass(const mrpt::rtti::TRuntimeClassId *pNewClass)
Register a class into the MRPT internal list of "CObject" descendents.
A structure that holds runtime class type information.
void registerAllPendingClasses()
Register all pending classes - to be called just before de-serializing an object, for example.
A singleton with the central registry for CSerializable run-time classes: users do not use this class...
GLsizei GLsizei GLuint * obj
std::vector< const mrpt::rtti::TRuntimeClassId * > getAllRegisteredClasses()
Returns a list with all the classes registered in the system through mrpt::rtti::registerClass.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::atomic< bool > m_being_modified
TClassnameToRuntimeId registeredClasses
std::vector< const TRuntimeClassId * > getAllRegisteredClassesChildrenOf(const TRuntimeClassId *parent_id)
Like getAllRegisteredClasses(), but filters the list to only include children clases of a given base ...
void(*)() TRegisterFunction
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
queue_register_functions_t & pending_class_registers()
bool pending_class_registers_modified
Set to true if pending_class_registers() has been called after registerAllPendingClasses().
static CClassRegistry & Instance()
The unique access point point to the singleton instance.
bool get(TRegisterFunction &ret)
Retrieve the next message in the queue, or nullptr if there is no message.
std::map< std::string, const TRuntimeClassId * > TClassnameToRuntimeId
void registerClassCustomName(const char *customName, const TRuntimeClassId *pNewClass)
Mostly for internal use within mrpt sources, to handle exceptional cases with multiple serialization ...
GLsizei const GLchar ** string
const TRuntimeClassId * Get(const std::string &className)
void Add(const std::string &className, const TRuntimeClassId &id)
const TRuntimeClassId * findRegisteredClass(const std::string &className)
Return info about a given class by its name, or nullptr if the class is not registered.
std::vector< const TRuntimeClassId * > getListOfAllRegisteredClasses()
std::atomic< int > & pending_class_registers_count()
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |