GNode library (C++)
Loading...
Searching...
No Matches
gnode::BaseData Class Referenceabstract

Abstract base class representing generic data with type information. More...

#include <data.hpp>

Inheritance diagram for gnode::BaseData:

Public Member Functions

 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.
 
virtual void * get_value_ptr () const =0
 Pure virtual method to retrieve a pointer to the stored value.
 

Private Attributes

std::string type
 A string representing the type of the data.
 

Detailed Description

Abstract base class representing generic data with type information.

The BaseData class provides a common interface for handling data of different types. It stores a type identifier as a string and requires derived classes to implement a method to retrieve a pointer to the stored value.

Constructor & Destructor Documentation

◆ BaseData()

gnode::BaseData::BaseData ( std::string  type)
inlineexplicit

Constructs a BaseData object with the specified type.

Parameters
typeA string representing the type of the data.

◆ ~BaseData()

virtual gnode::BaseData::~BaseData ( )
virtualdefault

Virtual destructor for BaseData.

Member Function Documentation

◆ get_type()

std::string gnode::BaseData::get_type ( ) const
inline

Retrieves the type of the data as a string.

Returns
A string representing the type of the data.

◆ get_value_ptr()

virtual void * gnode::BaseData::get_value_ptr ( ) const
pure virtual

Pure virtual method to retrieve a pointer to the stored value.

Returns
A void pointer to the value.

Implemented in gnode::Data< T >.

◆ is_same_type()

bool gnode::BaseData::is_same_type ( const BaseData data) const
inline

Checks if the type of this data matches the type of another BaseData object.

Parameters
dataThe other BaseData object to compare with.
Returns
True if the types match, false otherwise.

Member Data Documentation

◆ type

std::string gnode::BaseData::type
private

A string representing the type of the data.


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