LogicObject¶
-
class
rlogic
::
LogicObject
¶ A base class for all rlogic API objects
Subclassed by rlogic::DataArray, rlogic::LogicNode, rlogic::LuaModule
Public Functions
-
std::string_view
getName
() const¶ Returns the name of this object.
- Return
the name of this object
-
bool
setName
(std::string_view name)¶ Sets the name of this object.
- Return
true if setting the name was successful, false if the object name can’t be changed (e.g. interface objects)
- Parameters
name
: new name of the object
-
uint64_t
getId
() const¶ Returns the id of this object. Every object gets a unique, immutable id assigned on object creation. The id is serialized and thus persisted on load.
- Return
the id of this object
-
bool
setUserId
(uint64_t highId, uint64_t lowId)¶ Set user ID for this object. User IDs are optional identifiers of logic objects stored as number of up to 128 bits. User IDs will be logged together with name (getName) and unique ID (getId) and are serialized, thus persistent. Note that user IDs do not have to be unique, it is user’s choice and responsibility if uniqueness is desired. User ID is logged only if other than [0,0] was set and the format is hexadecimal ‘highId|lowId’ with all digits printed.
- Return
true if successful, false if failed
- Parameters
highId
: high 64 bits of user ID to setlowId
: low 64 bits of user ID to set
-
std::pair<uint64_t, uint64_t>
getUserId
() const¶ Returns the user ID set using setUserId.
- Return
the user ID [highId, lowId] or [0, 0] if no user ID was set
-
template<typename
T
>
const T *as
() const¶ Casts this object to given type. Has same behavior as
dynamic_cast
, will return nullptr (without error) if given type does not match this object.- Return
logic object cast to given type or nullptr if wrong type provided
-
template<typename
T
>
T *as
()¶ Casts this object to given type. Has same behavior as
dynamic_cast
, will return nullptr (without error) if given type does not match this object.- Return
logic object cast to given type or nullptr if wrong type provided
-
LogicObject
(const LogicObject&) = delete¶ Deleted copy constructor
-
LogicObject &
operator=
(const LogicObject&) = delete¶ Deleted assignment operator
-
~LogicObject
() noexcept¶ Destructor of LogicObject
-
std::string_view