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

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

#include <port.hpp>

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

Public Member Functions

 Input ()=default
 Default constructor for Input.
 
 Input (std::string label)
 Constructs an Input port with the specified label.
 
virtual ~Input ()=default
 Virtual destructor for Input.
 
PortType get_port_type () const override
 Returns the type of the port as an input port.
 
T * get_value_ref () const
 Retrieves a reference to the data value stored in this input port.
 
voidget_value_ref_void () const override
 Retrieves a void* reference to the data value stored in this output port.
 
void set_data (std::shared_ptr< BaseData > data) override
 Sets the data associated with this input 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 std::shared_ptr< BaseDataget_data_shared_ptr_downcasted () const
 Retrieves a shared pointer to the data associated with the port after downcasting.
 

Private Attributes

std::weak_ptr< Data< T > > data
 A weak pointer to the data associated with this input 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::Input< T >

Template class for input ports, specialized by data type.

The Input class inherits from Port and provides methods for handling data specific to input ports.

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

Constructor & Destructor Documentation

◆ Input() [1/2]

template<typename T >
gnode::Input< T >::Input ( )
default

Default constructor for Input.

◆ Input() [2/2]

template<typename T >
gnode::Input< T >::Input ( std::string  label)
inline

Constructs an Input port with the specified label.

Parameters
labelA string representing the label of the input port.

◆ ~Input()

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

Virtual destructor for Input.

Member Function Documentation

◆ get_port_type()

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

Returns the type of the port as an input port.

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

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

Implements gnode::Port.

◆ get_value_ref()

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

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

Returns
A pointer to the data value, or nullptr if the data is not available.

◆ get_value_ref_void()

template<typename T >
void * gnode::Input< 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.

◆ set_data()

template<typename T >
void gnode::Input< T >::set_data ( std::shared_ptr< BaseData data)
inlineoverridevirtual

Sets the data associated with this input port.

Parameters
dataA shared pointer to the BaseData to set.

Reimplemented from gnode::Port.

Member Data Documentation

◆ data

template<typename T >
std::weak_ptr<Data<T> > gnode::Input< T >::data
private

A weak pointer to the data associated with this input port.


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