PortId Class Reference

#include <corenodes_helpers.h>

Inheritance diagram for PortId:

Detailed Description

A PortId identifies a port of a core node or micro node (see CoreNodeBaseInterface). It can be given either by a port name or by a port index. The subclasses InPortId and OutPortId have to be used unless the code shall be generic in the port direction.

Public Member Functions

 MAXON_OPERATOR_EQUALITY (PortId, _indexDir, _name)
 
Bool IsIndex () const
 
Bool IsName () const
 
Bool IsPopulated () const
 
Bool IsEmpty () const
 
Int GetIndex () const
 
const IdGetName () const
 
PORT_DIR GetDirection () const
 
 PortId (PORT_DIR dir, const Id &name)
 
 PortId (PORT_DIR dir, Int index)
 
 PortId (PORT_DIR dir=PORT_DIR::INPUT)
 
String ToString (const FormatStatement *fs=nullptr) const
 

Protected Attributes

Int _indexDir
 
Id _name
 

Constructor & Destructor Documentation

◆ PortId() [1/3]

PortId ( PORT_DIR  dir,
const Id name 
)

Constructs a new PortId given by a port name.

Parameters
[in]dirThe port direction.
[in]nameThe port name to use for the PortId.

◆ PortId() [2/3]

PortId ( PORT_DIR  dir,
Int  index 
)

Constructs a new PortId given by a port index.

Parameters
[in]dirThe port direction.
[in]indexThe port index to use for the PortId.

◆ PortId() [3/3]

PortId ( PORT_DIR  dir = PORT_DIR::INPUT)
explicit

Constructs an empty PortId of the given direction.

Parameters
[in]dirThe port direction.

Member Function Documentation

◆ MAXON_OPERATOR_EQUALITY()

MAXON_OPERATOR_EQUALITY ( PortId  ,
_indexDir  ,
_name   
)

◆ IsIndex()

Bool IsIndex ( ) const

Checks if this PortId is given by an Int index.

Returns
True if this PortId is given by an index, false otherwise.

◆ IsName()

Bool IsName ( ) const

Checks if this PortId is given by a name.

Returns
True if this PortId is given by a name, false otherwise.

◆ IsPopulated()

Bool IsPopulated ( void  ) const

Checks if this PortId has a name or an index. Note that in the case of a name it doesn't check if the name itself is non-empty.

Returns
True if this PortId has a name or an index, false otherwise.

◆ IsEmpty()

Bool IsEmpty ( ) const

Checks if this PortId has neither a name nor an index.

Returns
True if this PortId has neither a name nor an index, false otherwise.

◆ GetIndex()

Int GetIndex ( ) const

Returns the port index. This function must not be called if this PortId is given by a name.

Returns
The port index stored in this PortId.

◆ GetName()

const Id& GetName ( ) const

Returns the port name. This function must not be called if this PortId is given by an index.

Returns
The port name stored in this PortId.

◆ GetDirection()

PORT_DIR GetDirection ( ) const

Returns the direction of this PortId. PORT_DIR::INPUT stands for input ports, PORT_DIR::OUTPUT for output ports.

Returns
The port direction.

◆ ToString()

String ToString ( const FormatStatement fs = nullptr) const

Returns a String representation of this @CLASS.

Parameters
[in]formatStatementNullptr or additional formatting instruction.
Returns
String representation of this @CLASS.

Member Data Documentation

◆ _indexDir

Int _indexDir
protected

◆ _name

Id _name
protected