|
Doxygen with github
|
Implements RTTI (run-time type information) for objects. More...
#include <ksRtti.h>
Inheritance diagram for ksf::ksRtti:Public Member Functions | |
| virtual | ~ksRtti ()=default |
| Destructor. | |
| virtual std::size_t | getInstanceType () const =0 |
| Retrieves type ID of the object. | |
| virtual bool | isA (const std::size_t id) const |
| Checks whether object is of given type. | |
| template<typename TType > | |
| TType * | as () |
| Tries to cast object to the type provided as a template parameter. | |
| template<typename TType > | |
| const TType * | as () const |
| Tries to cast object to the type provided as a template parameter (const version). | |
Implements RTTI (run-time type information) for objects.
This is a simple, fast, and lightweight implementation of the RTTI feature. It provides the ability to check whether an object is of a given type and to cast it to the type specified as a template parameter.
It is extensively used to implement components (ksComponent) and to easily manage components within the application (ksApplication).
|
inline |
Tries to cast object to the type provided as a template parameter.
| TType | Target type. |
References isA().
|
inline |
Tries to cast object to the type provided as a template parameter (const version).
| TType | Target type. |
References isA().
|
pure virtual |
Retrieves type ID of the object.
Implemented in ksf::comps::ksConfigProvider, ksf::comps::ksDevicePortal, ksf::comps::ksDevStatMqttReporter, ksf::comps::ksLed, ksf::comps::ksMqttConfigProvider, ksf::comps::ksMqttConnector, ksf::comps::ksResetButton, ksf::comps::ksWifiConfigurator, ksf::comps::ksWifiConnector, and ksf::ksComponent.
|
inlinevirtual |
Checks whether object is of given type.
| id | Type ID to check against. |
Reimplemented in ksf::comps::ksConfigProvider, ksf::comps::ksDevicePortal, ksf::comps::ksDevStatMqttReporter, ksf::comps::ksLed, ksf::comps::ksMqttConfigProvider, ksf::comps::ksMqttConnector, ksf::comps::ksResetButton, ksf::comps::ksWifiConfigurator, ksf::comps::ksWifiConnector, and ksf::ksComponent.