|
template<typename ReturnType > |
CallbackTypes< ReturnType >::Getter | getterCallback (const Entity *entity, const std::string &id) |
|
template<typename ReturnType > |
CallbackTypes< ReturnType >::ReadWrite | rwCallback (const Entity *entity, const std::string &id) |
|
template<typename ReturnType > |
CallbackTypes< ReturnType >::Setter | setterCallback (const Entity *entity, const std::string &id) |
|
template<typename ReturnType > |
const ReturnType & | get (const Entity *entity, const std::string &id) |
|
template<typename ReturnType > |
bool | canGet (const Entity *entity, const std::string &id) |
|
template<typename ReturnType > |
bool | canSet (const Entity *entity, const std::string &id) |
|
template<typename ReturnType > |
bool | canRw (const Entity *entity, const std::string &id) |
|
template<typename ReturnType > |
void | registerOutput (const Entity *entity, Component *comp, const std::string &id, const typename CallbackTypes< ReturnType >::Getter &cb) |
|
template<typename ReturnType > |
void | registerReadWrite (const Entity *entity, Component *comp, const std::string &id, const typename CallbackTypes< ReturnType >::ReadWrite &cb) |
|
template<typename ReturnType > |
void | registerInput (const Entity *entity, Component *comp, const std::string &id, const typename CallbackTypes< ReturnType >::Setter &cb) |
|
void | unregisterAll (const Entity *entity, Component *component) |
| unregister all callbacks attached to entity's component
|
|
This class allows components to communicate data to each other in a type safe way When a component is created, after being attached to an entity, it can declare output (get), input (set) or read/write functions on arbitrary type parameters. Then any component (typically belonging to the same entity) can try to access the given data through the functions. Declaring I/O is done by registering a function pointer with the correct prototype ( returning const T*
for getters, accepting const T*
for setters and returning a T*
for read/write getters). Each function is identified by its entity, a name and the return type. Then, another component can try to query the messenger to check if a data of the relevant type, entity and string-id is available, with the canGet(), canSet() and canRw() functions. It is then possible to directly read or write this data with the get(), set() and rw() functions. For more efficiency the underlying function pointers are directly accessible as well and can be queried with the same identifiers.
Definition at line 39 of file ComponentMessenger.hpp.