Class BasePort

Inheritance Relationships

Derived Types

Class Documentation

class BasePort

this class is the base for all ports. it is constructed from a member pointer and is only movable. only movable rational: a port has only one member, a pointer to its data. if a port is copied then both ports would work on the same data even though these are two independent copies. this would case a weird shared state, race conditions and so on

before using a port it is, depending on the use case, important to verify that the port member pointers are set

auto port = std::move(GetPortFromSomewhereElse());
if ( port ) {
    // do stuff
}

Subclassed by iox::popo::ClientPortRouDi, iox::popo::ClientPortUser, iox::popo::InterfacePort, iox::popo::PublisherPortRouDi, iox::popo::PublisherPortUser, iox::popo::ServerPortRouDi, iox::popo::ServerPortUser, iox::popo::SubscriberPortRouDi, iox::popo::SubscriberPortUser

Public Types

using MemberType_t = BasePortData

Public Functions

explicit BasePort(MemberType_t *const basePortDataPtr) noexcept
BasePort(const BasePort &other) = delete
BasePort &operator=(const BasePort&) = delete
BasePort(BasePort&&) noexcept
BasePort &operator=(BasePort&&) noexcept
virtual ~BasePort() = default
operator bool() const noexcept

a port can be constructed from a nullptr, additionally it also can be moved and in these cases the member methods would work on a nullptr. to circumvent this problem

Returns:

if the memberpointer is not null it returns true, otherwise false

const capro::ServiceDescription &getCaProServiceDescription() const noexcept

Reads Type of actual CaPro Port (publisher/subscriber…)

Returns:

m_portType Type of Port in struct BasePortType

const RuntimeName_t &getRuntimeName() const noexcept

Gets name of the application’s runtime for the active port.

Returns:

runtime name as String

UniquePortId getUniqueID() const noexcept

Gets Id of the active port.

Returns:

UniqueId name as Integer

const NodeName_t &getNodeName() const noexcept

returns node name for the active port

Returns:

node name as a string

void destroy() noexcept

Indicate that this port can be destroyed.

bool toBeDestroyed() const noexcept

Checks whether port can be destroyed.

Returns:

true if it shall be destroyed, false if not

Protected Functions

const MemberType_t *getMembers() const noexcept
MemberType_t *getMembers() noexcept