Doxygen with github
|
Implements RTTI (run-time type information) for objects. More...
#include <ksRtti.h>
Public Member Functions | |
virtual const size_t | getInstanceType () const =0 |
Retrieves type ID of the object. | |
virtual bool | isA (const 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, but fast and lightweight implementation of RTTI feature. Provides the ability to check whether object is of given type and cast it to the type provided as a template parameter.
Extensively used to implement components - ksComponent and easily manage components in the application (ksApplication).
|
inline |
Tries to cast object to the type provided as a template parameter.
TType | Target type. |
|
inline |
Tries to cast object to the type provided as a template parameter (const version).
TType | Target type. |
|
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.