|
GNode library (C++)
|
Template class for holding data of a specific type. More...
#include <data.hpp>


Public Member Functions | |
| template<typename... Args> | |
| Data (Args &&...args) | |
| Constructs a Data object with the type name of T and initializes its value. | |
| T * | get_value_ref () |
| Retrieves a reference to the stored value. | |
| void * | get_value_ptr () const override |
| Retrieves a pointer to the stored value. | |
Public Member Functions inherited from gnode::BaseData | |
| BaseData (std::string type) | |
| Constructs a BaseData object with the specified type. | |
| virtual | ~BaseData ()=default |
| Virtual destructor for BaseData. | |
| bool | is_same_type (const BaseData &data) const |
| Checks if the type of this data matches the type of another BaseData object. | |
| std::string | get_type () const |
| Retrieves the type of the data as a string. | |
Private Attributes | |
| T | value {} |
| The value of type T stored in this object. | |
Template class for holding data of a specific type.
The Data class template inherits from BaseData and provides a concrete implementation for storing and accessing data of type T. It allows retrieval of the stored value as a pointer.
| T | The type of data to be stored. |
|
inlineexplicit |
Constructs a Data object with the type name of T and initializes its value.
| Args | Types of the arguments passed to the T constructor. |
| args | Arguments forwarded to the constructor of T to initialize the value. |
This constructor initializes the base class BaseData with the type name of T using typeid(T).name(). It then constructs this->value of type T using the forwarded arguments args.
|
inlineoverridevirtual |
Retrieves a pointer to the stored value.
Implements gnode::BaseData.
|
inline |
Retrieves a reference to the stored value.
|
private |
The value of type T stored in this object.