Skip to content

iox::runtime::PoshRuntime🔗

The runtime that is needed for each application to communicate with the RouDi daemon. #include <iceoryx_posh/runtime/posh_runtime.hpp>

Protected Types🔗

Name
using PoshRuntime &(*)(cxx::optional< const RuntimeName_t * >) factory_t

Public Functions🔗

Name
PoshRuntime(const PoshRuntime & )
PoshRuntime & operator=(const PoshRuntime & )
PoshRuntime(PoshRuntime && )
PoshRuntime & operator=(PoshRuntime && )
virtual ~PoshRuntime() =default
RuntimeName_t getInstanceName() const
get the name that was used to register with RouDi
void shutdown()
initiates the shutdown of the runtime to unblock all potentially blocking publisher with the ConsumerTooSlowPolicy::WAIT_FOR_CONSUMER option set
virtual PublisherPortUserType::MemberType_t * getMiddlewarePublisher(const capro::ServiceDescription & service, const popo::PublisherOptions & publisherOptions ={}, const PortConfigInfo & portConfigInfo ={}) =0
request the RouDi daemon to create a publisher port
virtual SubscriberPortUserType::MemberType_t * getMiddlewareSubscriber(const capro::ServiceDescription & service, const popo::SubscriberOptions & subscriberOptions ={}, const PortConfigInfo & portConfigInfo ={}) =0
request the RouDi daemon to create a subscriber port
virtual popo::ClientPortData * getMiddlewareClient(const capro::ServiceDescription & service, const popo::ClientOptions & clientOptions ={}, const PortConfigInfo & portConfigInfo =PortConfigInfo()) =0
request the RouDi daemon to create a client port
virtual popo::ServerPortData * getMiddlewareServer(const capro::ServiceDescription & service, const popo::ServerOptions & serverOptions ={}, const PortConfigInfo & portConfigInfo =PortConfigInfo()) =0
request the RouDi daemon to create a server port
virtual popo::InterfacePortData * getMiddlewareInterface(const capro::Interfaces interface, const NodeName_t & nodeName ={}) =0
request the RouDi daemon to create an interface port
virtual popo::ConditionVariableData * getMiddlewareConditionVariable() =0
request the RouDi daemon to create a condition variable
virtual NodeData * createNode(const NodeProperty & nodeProperty) =0
request the RouDi daemon to create a node
virtual bool sendRequestToRouDi(const IpcMessage & msg, IpcMessage & answer) =0
send a request to the RouDi daemon and get the response currently each request is followed by a response
PoshRuntime & getInstance()
returns active runtime
PoshRuntime & initRuntime(const RuntimeName_t & name)
creates the runtime with given name

Protected Functions🔗

Name
PoshRuntime(cxx::optional< const RuntimeName_t * > name)
const RuntimeName_t & verifyInstanceName(cxx::optional< const RuntimeName_t * > name)
checks the given application name for certain constraints like length or if is empty
PoshRuntime & defaultRuntimeFactory(cxx::optional< const RuntimeName_t * > name)
factory_t & getRuntimeFactory()
gets current runtime factory. If the runtime factory is not yet initialized it is set to defaultRuntimeFactory.
void setRuntimeFactory(const factory_t & factory)
sets runtime factory, terminates if given factory is empty
PoshRuntime & getInstance(cxx::optional< const RuntimeName_t * > name)
creates the runtime or returns the already existing one -> Singleton

Protected Attributes🔗

Name
const RuntimeName_t m_appName
std::atomic< bool > m_shutdownRequested

Friends🔗

Name
class roudi::RuntimeTestInterface

Protected Types Documentation🔗

using factory_t🔗

using iox::runtime::PoshRuntime::factory_t =  PoshRuntime& (*)(cxx::optional<const RuntimeName_t*>);

Public Functions Documentation🔗

function PoshRuntime🔗

PoshRuntime(
    const PoshRuntime & 
)

function operator=🔗

PoshRuntime & operator=(
    const PoshRuntime & 
)

function PoshRuntime🔗

PoshRuntime(
    PoshRuntime && 
)

function operator=🔗

PoshRuntime & operator=(
    PoshRuntime && 
)

function ~PoshRuntime🔗

virtual ~PoshRuntime() =default

function getInstanceName🔗

RuntimeName_t getInstanceName() const

get the name that was used to register with RouDi

Return: name of the registered application

function shutdown🔗

void shutdown()

initiates the shutdown of the runtime to unblock all potentially blocking publisher with the ConsumerTooSlowPolicy::WAIT_FOR_CONSUMER option set

function getMiddlewarePublisher🔗

virtual PublisherPortUserType::MemberType_t * getMiddlewarePublisher(
    const capro::ServiceDescription & service,
    const popo::PublisherOptions & publisherOptions ={},
    const PortConfigInfo & portConfigInfo ={}
) =0

request the RouDi daemon to create a publisher port

Parameters:

  • serviceDescription service description for the new publisher port
  • publisherOptions like the history capacity of a publisher
  • portConfigInfo configuration information for the port (i.e. what type of port is requested, device where its payload memory is located on etc.)

Return: pointer to a created publisher port user

function getMiddlewareSubscriber🔗

virtual SubscriberPortUserType::MemberType_t * getMiddlewareSubscriber(
    const capro::ServiceDescription & service,
    const popo::SubscriberOptions & subscriberOptions ={},
    const PortConfigInfo & portConfigInfo ={}
) =0

request the RouDi daemon to create a subscriber port

Parameters:

  • serviceDescription service description for the new subscriber port
  • subscriberOptions like the queue capacity and history requested by a subscriber
  • portConfigInfo configuration information for the port (what type of port is requested, device where its payload memory is located on etc.)

Return: pointer to a created subscriber port data

function getMiddlewareClient🔗

virtual popo::ClientPortData * getMiddlewareClient(
    const capro::ServiceDescription & service,
    const popo::ClientOptions & clientOptions ={},
    const PortConfigInfo & portConfigInfo =PortConfigInfo()
) =0

request the RouDi daemon to create a client port

Parameters:

  • serviceDescription service description for the new client port
  • clientOptions like the queue capacity and queue full policy by a client
  • portConfigInfo configuration information for the port (what type of port is requested, device where its payload memory is located on etc.)

Return: pointer to a created client port data

function getMiddlewareServer🔗

virtual popo::ServerPortData * getMiddlewareServer(
    const capro::ServiceDescription & service,
    const popo::ServerOptions & serverOptions ={},
    const PortConfigInfo & portConfigInfo =PortConfigInfo()
) =0

request the RouDi daemon to create a server port

Parameters:

  • serviceDescription service description for the new server port
  • serverOptions like the queue capacity and queue full policy by a server
  • portConfigInfo configuration information for the port (what type of port is requested, device where its payload memory is located on etc.)

Return: pointer to a created server port data

function getMiddlewareInterface🔗

virtual popo::InterfacePortData * getMiddlewareInterface(
    const capro::Interfaces interface,
    const NodeName_t & nodeName ={}
) =0

request the RouDi daemon to create an interface port

Parameters:

  • interface interface to create
  • nodeName name of the node where the interface should belong to

Return: pointer to a created interface port data

function getMiddlewareConditionVariable🔗

virtual popo::ConditionVariableData * getMiddlewareConditionVariable() =0

request the RouDi daemon to create a condition variable

Return: pointer to a created condition variable data

function createNode🔗

virtual NodeData * createNode(
    const NodeProperty & nodeProperty
) =0

request the RouDi daemon to create a node

Parameters:

  • nodeProperty class which contains all properties which the node should have

Return: pointer to the data of the node

function sendRequestToRouDi🔗

virtual bool sendRequestToRouDi(
    const IpcMessage & msg,
    IpcMessage & answer
) =0

send a request to the RouDi daemon and get the response currently each request is followed by a response

Parameters:

  • msg request message to send
  • response from the RouDi daemon

Return: true if sucessful request/response, false on error

function getInstance🔗

static PoshRuntime & getInstance()

returns active runtime

Return: active runtime

function initRuntime🔗

static PoshRuntime & initRuntime(
    const RuntimeName_t & name
)

creates the runtime with given name

Parameters:

  • name used for registering the process with the RouDi daemon

Return: active runtime

Protected Functions Documentation🔗

function PoshRuntime🔗

PoshRuntime(
    cxx::optional< const RuntimeName_t * > name
)

function verifyInstanceName🔗

const RuntimeName_t & verifyInstanceName(
    cxx::optional< const RuntimeName_t * > name
)

checks the given application name for certain constraints like length or if is empty

function defaultRuntimeFactory🔗

static PoshRuntime & defaultRuntimeFactory(
    cxx::optional< const RuntimeName_t * > name
)

function getRuntimeFactory🔗

static factory_t & getRuntimeFactory()

gets current runtime factory. If the runtime factory is not yet initialized it is set to defaultRuntimeFactory.

Return: current runtime factory

function setRuntimeFactory🔗

static void setRuntimeFactory(
    const factory_t & factory
)

sets runtime factory, terminates if given factory is empty

Parameters:

  • factory std::function to which the runtime factory should be set

function getInstance🔗

static PoshRuntime & getInstance(
    cxx::optional< const RuntimeName_t * > name
)

creates the runtime or returns the already existing one -> Singleton

Parameters:

  • name optional containing the name used for registering with the RouDi daemon

Return: active runtime

Protected Attributes Documentation🔗

variable m_appName🔗

const RuntimeName_t m_appName;

variable m_shutdownRequested🔗

std::atomic< bool > m_shutdownRequested {false};

Friends🔗

friend roudi::RuntimeTestInterface🔗

friend class roudi::RuntimeTestInterface;

Updated on 18 December 2023 at 13:11:43 CET