Description
Stores type-casting functions between different type pairs, allowing to pick them at runtime from std::type_index or classname Converting pointers between different classes is usually possible by standard type casting, given that the source and destination class types are known at compile time. This class allows to typecast between class types that are known only at runtime. The requirement is that the typecasting function has to be prepared in advance (i.e. at compile time), when the types are still known. For each potential conversion an instance of ChCastingMap has to be declared, together with its typecasting function. This procedure is simplified by the macros CH_UPCASTING(FROM, TO) and CH_UPCASTING_SANITIZED(FROM, TO, UNIQUETAG) When the conversion should take place the following can be called: ConversionMap::Convert(std::string("source_classname"), std::string("destination_classname"), <void* to object>)
#include <ChClassFactory.h>
The documentation for this class was generated from the following files:
- /builds/uwsbel/chrono/src/chrono/core/ChClassFactory.h
- /builds/uwsbel/chrono/src/chrono/core/ChClassFactory.cpp