GNode library (C++)
Loading...
Searching...
No Matches
gnode::Output< T > Class Template Reference

Template class for output ports, specialized by data type. More...

#include <port.hpp>

Inheritance diagram for gnode::Output< T >:
Collaboration diagram for gnode::Output< T >:

Public Member Functions

 Output ()
 Default constructor for Output.
 
template<typename... Args>
 Output (std::string label, Args &&...args)
 Constructs an Output port with the specified label and additional arguments.
 
virtual ~Output ()=default
 Virtual destructor for Output.
 
std::shared_ptr< BaseDataget_data_shared_ptr_downcasted () const override
 Retrieves a shared pointer to the data associated with this output port after downcasting.
 
std::string get_data_type () const
 Retrieves the type name of the data handled by this output port.
 
PortType get_port_type () const override
 Returns the type of the port as an output port.
 
T * get_value_ref () const
 Retrieves a reference to the data value stored in this output port.
 
voidget_value_ref_void () const override
 Retrieves a void* reference to the data value stored in this output port.
 
- Public Member Functions inherited from gnode::Port
 Port ()=default
 Default constructor for Port.
 
 Port (std::string label)
 Constructs a Port with the specified label.
 
virtual ~Port ()=default
 Virtual destructor for Port.
 
std::string get_data_type () const
 Retrieves the type name of the data handled by this port.
 
std::string get_label () const
 Retrieves the label of the port.
 
virtual void set_data (std::shared_ptr< BaseData >)
 Sets the data associated with the port.
 

Private Attributes

std::shared_ptr< Data< T > > data
 A shared pointer to the data associated with this output port.
 

Additional Inherited Members

- Protected Attributes inherited from gnode::Port
std::string data_type
 A string representing the type name.
 

Detailed Description

template<typename T>
class gnode::Output< T >

Template class for output ports, specialized by data type.

The Output class inherits from Port and provides methods for handling data specific to output ports.

Template Parameters
TThe data type that this output port will handle.

Constructor & Destructor Documentation

◆ Output() [1/2]

template<typename T >
gnode::Output< T >::Output ( )
inline

Default constructor for Output.

◆ Output() [2/2]

template<typename T >
template<typename... Args>
gnode::Output< T >::Output ( std::string  label,
Args &&...  args 
)
inlineexplicit

Constructs an Output port with the specified label and additional arguments.

Template Parameters
ArgsTypes of the arguments passed to the Data<T> constructor.
Parameters
labelA string representing the label of the output port.
argsAdditional arguments passed to the Data<T> constructor.

This constructor initializes an Output port with a given label and forwards any additional arguments to the Data<T> constructor using std::make_shared.

◆ ~Output()

template<typename T >
virtual gnode::Output< T >::~Output ( )
virtualdefault

Virtual destructor for Output.

Member Function Documentation

◆ get_data_shared_ptr_downcasted()

template<typename T >
std::shared_ptr< BaseData > gnode::Output< T >::get_data_shared_ptr_downcasted ( ) const
inlineoverridevirtual

Retrieves a shared pointer to the data associated with this output port after downcasting.

Returns
A shared pointer to the BaseData.

Reimplemented from gnode::Port.

◆ get_data_type()

template<typename T >
std::string gnode::Output< T >::get_data_type ( ) const
inline

Retrieves the type name of the data handled by this output port.

Returns
A string representing the type name.

◆ get_port_type()

template<typename T >
PortType gnode::Output< T >::get_port_type ( ) const
inlineoverridevirtual

Returns the type of the port as an output port.

This method overrides the base class implementation to indicate that this port is an output (PortType::OUT).

Returns
The port type, which is always PortType::OUT.

Implements gnode::Port.

◆ get_value_ref()

template<typename T >
T * gnode::Output< T >::get_value_ref ( ) const
inline

Retrieves a reference to the data value stored in this output port.

Returns
A pointer to the data value.

◆ get_value_ref_void()

template<typename T >
void * gnode::Output< T >::get_value_ref_void ( ) const
inlineoverridevirtual

Retrieves a void* reference to the data value stored in this output port.

Returns
A void* pointer to the data value.

Implements gnode::Port.

Member Data Documentation

◆ data

template<typename T >
std::shared_ptr<Data<T> > gnode::Output< T >::data
private

A shared pointer to the data associated with this output port.


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