Ports manager

class CPortsManager

Manager of unit ports.

Public Functions

CUnitPort *AddPort(const std::string &_name, EUnitPort _type)

Adds a port and returns a pointer to it. If a port with this name already exist, does nothing and return nullptr.

Parameters
  • _name – Name of the port. Must be unique. If a port with this name already exist, does nothing.

  • _type – Type of the port.

Returns

Pointer to the created port. If a port with this name already exist, returns nullptr.

const CUnitPort *GetPort(const std::string &_name) const

Returns a port with the specified name.

Parameters

_name – Name of the port.

Returns

const pointer to the port. nullptr if such port does not exist.

CUnitPort *GetPort(const std::string &_name)

Returns a port with the specified name.

Parameters

_name – Name of the port.

Returns

Pointer to the port. nullptr if such port does not exist.

const CUnitPort *GetPort(size_t _index) const

Returns a port with the specified index.

Parameters

_index – Index of the port.

Returns

Const pointer to the port. nullptr if such port does not exist.

CUnitPort *GetPort(size_t _index)

Returns a port with the specified index.

Parameters

_index – Index of the port.

Returns

Pointer to the port. nullptr if such port does not exist.

std::vector<CUnitPort*> GetAllPorts()

Returns pointers to all defined ports.

Returns

Pointers to all defined ports.

std::vector<const CUnitPort*> GetAllPorts() const

Returns const pointers to all defined ports.

Returns

Const pointers to all defined ports.

std::vector<CUnitPort*> GetAllInputPorts()

Returns pointers to all defined input ports.

Returns

Pointers to all input ports.

std::vector<const CUnitPort*> GetAllInputPorts() const

Returns const pointers to all defined input ports.

Returns

Const pointers to all input ports.

std::vector<CUnitPort*> GetAllOutputPorts()

Returns pointers to all defined output ports.

Returns

Pointers to all output ports.

std::vector<const CUnitPort*> GetAllOutputPorts() const

Returns const pointers to all defined output ports.

Returns

Const pointers to all output ports.

size_t GetPortsNumber() const

Returns a number of defined ports.

Returns

Number of ports.