Skip to content

iox::runtime::PoshRuntime🔗

The runtime that is needed for each application to communicate with the RouDi daemon.

#include <posh_runtime.hpp>

Inherited by iox::runtime::PoshRuntimeSingleProcess

Protected Types🔗

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

Public Functions🔗

Name
PoshRuntime & getInstance()
returns active runtime
PoshRuntime & initRuntime(const RuntimeName_t & name)
creates the runtime with given name
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 SubscriberTooSlowPolicy::WAIT_FOR_SUBSCRIBER option set
cxx::expected< InstanceContainer, FindServiceError > findService(const capro::ServiceDescription & serviceDescription)
find all services that match the provided service description
bool offerService(const capro::ServiceDescription & serviceDescription)
offer the provided service, sends the offer from application to RouDi daemon
void stopOfferService(const capro::ServiceDescription & serviceDescription)
stop offering the provided service
PublisherPortUserType::MemberType_t * getMiddlewarePublisher(const capro::ServiceDescription & service, const popo::PublisherOptions & publisherOptions =popo::PublisherOptions(), const PortConfigInfo & portConfigInfo =PortConfigInfo())
request the RouDi daemon to create a publisher port
SubscriberPortUserType::MemberType_t * getMiddlewareSubscriber(const capro::ServiceDescription & service, const popo::SubscriberOptions & subscriberOptions =popo::SubscriberOptions(), const PortConfigInfo & portConfigInfo =PortConfigInfo())
request the RouDi daemon to create a subscriber port
popo::InterfacePortData * getMiddlewareInterface(const capro::Interfaces interface, const NodeName_t & nodeName ={""})
request the RouDi daemon to create an interface port
popo::ApplicationPortData * getMiddlewareApplication()
request the RouDi daemon to create an application port
popo::ConditionVariableData * getMiddlewareConditionVariable()
request the RouDi daemon to create a condition variable
NodeData * createNode(const NodeProperty & nodeProperty)
request the RouDi daemon to create a node
const std::atomic< uint64_t > * getServiceRegistryChangeCounter()
requests the serviceRegistryChangeCounter from the shared memory
bool sendRequestToRouDi(const IpcMessage & msg, IpcMessage & answer)
send a request to the RouDi daemon and get the response currently each request is followed by a response
PoshRuntime(const PoshRuntime & )
PoshRuntime & operator=(const PoshRuntime & )
PoshRuntime(PoshRuntime && )
PoshRuntime & operator=(PoshRuntime && )
virtual ~PoshRuntime()

Protected Functions🔗

Name
PoshRuntime(cxx::optional< const RuntimeName_t * > name, const bool doMapSharedMemoryIntoThread =true)
PoshRuntime & defaultRuntimeFactory(cxx::optional< const RuntimeName_t * > name)
RuntimeName_t & defaultRuntimeInstanceName()
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

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

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 SubscriberTooSlowPolicy::WAIT_FOR_SUBSCRIBER option set

function findService🔗

cxx::expected< InstanceContainer, FindServiceError > findService(
    const capro::ServiceDescription & serviceDescription
)

find all services that match the provided service description

Parameters:

  • serviceDescription service to search for

Return: cxx::expected InstanceContainer: on success, container that is filled with all matching instances FindServiceError: if any, encountered during the operation

function offerService🔗

bool offerService(
    const capro::ServiceDescription & serviceDescription
)

offer the provided service, sends the offer from application to RouDi daemon

Parameters:

  • serviceDescription service to offer

Return: bool, if service is offered returns true else false

function stopOfferService🔗

void stopOfferService(
    const capro::ServiceDescription & serviceDescription
)

stop offering the provided service

Parameters:

  • serviceDescription of the service that shall be no more offered

function getMiddlewarePublisher🔗

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

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🔗

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

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 getMiddlewareInterface🔗

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

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 getMiddlewareApplication🔗

popo::ApplicationPortData * getMiddlewareApplication()

request the RouDi daemon to create an application port

Return: pointer to a created application port data

function getMiddlewareConditionVariable🔗

popo::ConditionVariableData * getMiddlewareConditionVariable()

request the RouDi daemon to create a condition variable

Return: pointer to a created condition variable data

function createNode🔗

NodeData * createNode(
    const NodeProperty & nodeProperty
)

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 getServiceRegistryChangeCounter🔗

const std::atomic< uint64_t > * getServiceRegistryChangeCounter()

requests the serviceRegistryChangeCounter from the shared memory

Return: pointer to the serviceRegistryChangeCounter

function sendRequestToRouDi🔗

bool sendRequestToRouDi(
    const IpcMessage & msg,
    IpcMessage & answer
)

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 PoshRuntime🔗

PoshRuntime(
    const PoshRuntime & 
)

function operator=🔗

PoshRuntime & operator=(
    const PoshRuntime & 
)

function PoshRuntime🔗

PoshRuntime(
    PoshRuntime && 
)

function operator=🔗

PoshRuntime & operator=(
    PoshRuntime && 
)

function ~PoshRuntime🔗

virtual ~PoshRuntime()

Protected Functions Documentation🔗

function PoshRuntime🔗

PoshRuntime(
    cxx::optional< const RuntimeName_t * > name,
    const bool doMapSharedMemoryIntoThread =true
)

function defaultRuntimeFactory🔗

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

function defaultRuntimeInstanceName🔗

static RuntimeName_t & defaultRuntimeInstanceName()

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

Friends🔗

friend roudi::RuntimeTestInterface🔗

friend class roudi::RuntimeTestInterface;

Updated on 17 June 2021 at 11:15:27 CEST