![]() |
|
Uniot Core
|
| 0.8.1 |
#include <ObjectRegister.h>
Public Member Functions | |
| ObjectRegister () | |
| Default constructor. | |
| virtual | ~ObjectRegister () |
| Virtual destructor. | |
| ObjectRegister (ObjectRegister const &)=delete | |
| Deleted copy constructor to prevent copying. | |
| void | operator= (ObjectRegister const &)=delete |
| Deleted assignment operator to prevent copying. | |
| bool | link (const String &name, RecordPtr link, uint32_t id=FOURCC(____)) |
| Links an object to a name in the register. | |
| template<typename T> | |
| T * | get (const String &name, size_t index) |
| Retrieves a registered object by name and index with type casting. | |
Public Member Functions inherited from uniot::Register< Pair< uint32_t, RecordPtr > > | |
| Register (Register const &)=delete | |
| Deleted copy constructor to prevent unintended copying. | |
| Register () | |
| Constructs an empty Register. | |
| void | operator= (Register const &)=delete |
| Deleted assignment operator to prevent unintended copying. | |
| bool | setRegister (const String &name, const Pair< uint32_t, RecordPtr > *values, size_t count) |
| Sets or replaces a register with the given name and array of values. | |
| bool | addToRegister (const String &name, const Pair< uint32_t, RecordPtr > &value) |
| Adds a single value to an existing register or creates a new one. | |
| bool | getRegisterValue (const String &name, size_t idx, Pair< uint32_t, RecordPtr > &outValue) const |
| Retrieves a value from the register by name and index. | |
| bool | setRegisterValue (const String &name, size_t idx, const Pair< uint32_t, RecordPtr > &value) |
| Updates a value in the register at the specified index. | |
| size_t | getRegisterLength (const String &name) const |
| Gets the number of values in the specified register. | |
| void | iterateRegisters (IteratorCallback callback) const |
| Iterates through all registers and calls the callback function for each one. | |
Additional Inherited Members | |
Public Types inherited from uniot::Register< Pair< uint32_t, RecordPtr > > | |
| using | IteratorCallback |
| Function type used for iterating through registers. | |
Protected Member Functions inherited from uniot::Register< Pair< uint32_t, RecordPtr > > | |
| virtual void | _processRegister (const String &name, const Pair< uint32_t, RecordPtr > &value) |
| Hook method called when a register value is added or modified. | |
|
inline |
Default constructor.
|
inlinevirtual |
Virtual destructor.
|
delete |
Deleted copy constructor to prevent copying.
|
inline |
Retrieves a registered object by name and index with type casting.
This method provides type-safe access to registered objects. It also performs validity checks to ensure the returned pointer is still valid. If the referenced object no longer exists, the entry is marked as dead and nullptr is returned.
| T | The type to cast the object to |
| name | The string identifier of the object |
| index | The index of the object if multiple objects share the same name |
| T* | Pointer to the requested object |
| nullptr | Object is not found or is invalid |
|
inline |
Links an object to a name in the register.
| name | The string identifier for the object |
| link | Pointer to the ObjectRegisterRecord to be registered |
| id | Optional numeric identifier for the object (default: FOURCC(____) |
|
delete |
Deleted assignment operator to prevent copying.