iceoryx_doc  1.0.1
Public Types | Public Member Functions | Protected Member Functions | List of all members
iox::popo::BasePort Class Reference

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 More...

#include <base_port.hpp>

Inheritance diagram for iox::popo::BasePort:
Inheritance graph
[legend]

Public Types

using MemberType_t = BasePortData
 

Public Member Functions

 BasePort (MemberType_t *const basePortDataPtr) noexcept
 
 BasePort (const BasePort &other)=delete
 
BasePortoperator= (const BasePort &)=delete
 
 BasePort (BasePort &&) noexcept
 
BasePortoperator= (BasePort &&) noexcept
 
 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 More...
 
capro::ServiceDescription getCaProServiceDescription () const noexcept
 Reads Type of actual CaPro Port (publisher/subscriber...) More...
 
RuntimeName_t getRuntimeName () const noexcept
 Gets name of the application's runtime for the active port. More...
 
UniquePortId getUniqueID () const noexcept
 Gets Id of the active port. More...
 
NodeName_t getNodeName () const noexcept
 returns node name for the active port More...
 
void destroy () noexcept
 Indicate that this port can be destroyed.
 
bool toBeDestroyed () const noexcept
 Checks whether port can be destroyed. More...
 

Protected Member Functions

const MemberType_tgetMembers () const noexcept
 
MemberType_tgetMembers () noexcept
 

Detailed Description

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
}

Member Function Documentation

◆ getCaProServiceDescription()

capro::ServiceDescription iox::popo::BasePort::getCaProServiceDescription ( ) const
noexcept

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

Returns
m_portType Type of Port in struct BasePortType

◆ getNodeName()

NodeName_t iox::popo::BasePort::getNodeName ( ) const
noexcept

returns node name for the active port

Returns
node name as a string

◆ getRuntimeName()

RuntimeName_t iox::popo::BasePort::getRuntimeName ( ) const
noexcept

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

Returns
runtime name as String

◆ getUniqueID()

UniquePortId iox::popo::BasePort::getUniqueID ( ) const
noexcept

Gets Id of the active port.

Returns
UniqueId name as Integer

◆ operator bool()

iox::popo::BasePort::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

◆ toBeDestroyed()

bool iox::popo::BasePort::toBeDestroyed ( ) const
noexcept

Checks whether port can be destroyed.

Returns
true if it shall be destroyed, false if not

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