96 bool setRegister(
const String& name,
const T* values,
size_t count) {
97 if (!values && count > 0) {
101 mRegisterMap.remove(name);
105 if ((*newArray).size() != count) {
108 mRegisterMap.put(name, std::move(newArray));
109 for (
size_t i = 0; i < count; ++i) {
134 mRegisterMap.put(name, reg);
136 if (reg->push(value)) {
156 auto reg = mRegisterMap.get(name,
nullptr);
158 return reg->get(idx, outValue);
177 auto reg = mRegisterMap.get(name,
nullptr);
178 if (reg && reg->set(idx, value)) {
193 auto reg = mRegisterMap.get(name,
nullptr);
216 if (!callback)
return;
218 mRegisterMap.begin();
219 while (!mRegisterMap.isEnd()) {
220 auto& item = mRegisterMap.current();
221 callback(item.first, item.second);
bool setRegister(const String &name, const T *values, size_t count)
Sets or replaces a register with the given name and array of values.
Definition Register.h:96
bool addToRegister(const String &name, const T &value)
Adds a single value to an existing register or creates a new one.
Definition Register.h:130
virtual void _processRegister(const String &name, const T &value)
Hook method called when a register value is added or modified.
Definition Register.h:236
std::function< void(const String &, SharedPointer< Array< T > >)> IteratorCallback
Function type used for iterating through registers.
Definition Register.h:65
Register()
Constructs an empty Register.
Definition Register.h:80
bool setRegisterValue(const String &name, size_t idx, const T &value)
Updates a value in the register at the specified index.
Definition Register.h:176
size_t getRegisterLength(const String &name) const
Gets the number of values in the specified register.
Definition Register.h:192
Register(Register const &)=delete
Deleted copy constructor to prevent unintended copying.
bool getRegisterValue(const String &name, size_t idx, T &outValue) const
Retrieves a value from the register by name and index.
Definition Register.h:155
void operator=(Register const &)=delete
Deleted assignment operator to prevent unintended copying.
void iterateRegisters(IteratorCallback callback) const
Iterates through all registers and calls the callback function for each one.
Definition Register.h:215
std::shared_ptr< T > SharedPointer
Type alias for std::shared_ptr with cleaner syntax.
Definition Common.h:160
auto MakeShared(Args &&...args) -> decltype(std::make_shared< T >(std::forward< Args >(args)...))
Creates a shared pointer instance, alias for std::make_shared.
Definition Common.h:174
Contains all classes and functions related to the Uniot Core.