Uniot Core
0.8.1
Loading...
Searching...
No Matches
uniot::ObjectRegister Class Reference

#include <ObjectRegister.h>

Inheritance diagram for uniot::ObjectRegister:
[legend]

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.
 

Constructor & Destructor Documentation

◆ ObjectRegister() [1/2]

uniot::ObjectRegister::ObjectRegister ( )
inline

Default constructor.

◆ ~ObjectRegister()

virtual uniot::ObjectRegister::~ObjectRegister ( )
inlinevirtual

Virtual destructor.

◆ ObjectRegister() [2/2]

uniot::ObjectRegister::ObjectRegister ( ObjectRegister const & )
delete

Deleted copy constructor to prevent copying.

Member Function Documentation

◆ get()

template<typename T>
T * uniot::ObjectRegister::get ( const String & name,
size_t index )
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.

Template Parameters
TThe type to cast the object to
Parameters
nameThe string identifier of the object
indexThe index of the object if multiple objects share the same name
Return values
T*Pointer to the requested object
nullptrObject is not found or is invalid

◆ link()

bool uniot::ObjectRegister::link ( const String & name,
RecordPtr link,
uint32_t id = FOURCC(____) )
inline

Links an object to a name in the register.

Parameters
nameThe string identifier for the object
linkPointer to the ObjectRegisterRecord to be registered
idOptional numeric identifier for the object (default: FOURCC(____)
Return values
trueObject was linked successfully
falseObject could not be linked (e.g., memory allocation failed)

◆ operator=()

void uniot::ObjectRegister::operator= ( ObjectRegister const & )
delete

Deleted assignment operator to prevent copying.


The documentation for this class was generated from the following file: