iceoryx_doc  1.0.1
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Friends | List of all members
iox::runtime::PoshRuntime Class Reference

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

#include <posh_runtime.hpp>

Inheritance diagram for iox::runtime::PoshRuntime:
Inheritance graph
[legend]

Public Member Functions

RuntimeName_t getInstanceName () const noexcept
 get the name that was used to register with RouDi More...
 
void shutdown () noexcept
 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) noexcept
 find all services that match the provided service description More...
 
bool offerService (const capro::ServiceDescription &serviceDescription) noexcept
 offer the provided service, sends the offer from application to RouDi daemon More...
 
void stopOfferService (const capro::ServiceDescription &serviceDescription) noexcept
 stop offering the provided service More...
 
PublisherPortUserType::MemberType_tgetMiddlewarePublisher (const capro::ServiceDescription &service, const popo::PublisherOptions &publisherOptions=popo::PublisherOptions(), const PortConfigInfo &portConfigInfo=PortConfigInfo()) noexcept
 request the RouDi daemon to create a publisher port More...
 
SubscriberPortUserType::MemberType_tgetMiddlewareSubscriber (const capro::ServiceDescription &service, const popo::SubscriberOptions &subscriberOptions=popo::SubscriberOptions(), const PortConfigInfo &portConfigInfo=PortConfigInfo()) noexcept
 request the RouDi daemon to create a subscriber port More...
 
popo::InterfacePortDatagetMiddlewareInterface (const capro::Interfaces interface, const NodeName_t &nodeName={""}) noexcept
 request the RouDi daemon to create an interface port More...
 
popo::ApplicationPortDatagetMiddlewareApplication () noexcept
 request the RouDi daemon to create an application port More...
 
popo::ConditionVariableDatagetMiddlewareConditionVariable () noexcept
 request the RouDi daemon to create a condition variable More...
 
NodeDatacreateNode (const NodeProperty &nodeProperty) noexcept
 request the RouDi daemon to create a node More...
 
const std::atomic< uint64_t > * getServiceRegistryChangeCounter () noexcept
 requests the serviceRegistryChangeCounter from the shared memory More...
 
bool sendRequestToRouDi (const IpcMessage &msg, IpcMessage &answer) noexcept
 send a request to the RouDi daemon and get the response currently each request is followed by a response More...
 
 PoshRuntime (const PoshRuntime &)=delete
 
PoshRuntimeoperator= (const PoshRuntime &)=delete
 
 PoshRuntime (PoshRuntime &&)=delete
 
PoshRuntimeoperator= (PoshRuntime &&)=delete
 

Static Public Member Functions

static PoshRuntimegetInstance () noexcept
 returns active runtime More...
 
static PoshRuntimeinitRuntime (const RuntimeName_t &name) noexcept
 creates the runtime with given name More...
 

Protected Types

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

Protected Member Functions

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

Static Protected Member Functions

static PoshRuntimedefaultRuntimeFactory (cxx::optional< const RuntimeName_t * > name) noexcept
 
static RuntimeName_t & defaultRuntimeInstanceName () noexcept
 
static factory_t & getRuntimeFactory () noexcept
 gets current runtime factory. If the runtime factory is not yet initialized it is set to defaultRuntimeFactory. More...
 
static void setRuntimeFactory (const factory_t &factory) noexcept
 sets runtime factory, terminates if given factory is empty More...
 
static PoshRuntimegetInstance (cxx::optional< const RuntimeName_t * > name) noexcept
 creates the runtime or returns the already existing one -> Singleton More...
 

Friends

class roudi::RuntimeTestInterface
 

Detailed Description

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

Member Function Documentation

◆ createNode()

NodeData* iox::runtime::PoshRuntime::createNode ( const NodeProperty nodeProperty)
noexcept

request the RouDi daemon to create a node

Parameters
[in]nodePropertyclass which contains all properties which the node should have
Returns
pointer to the data of the node

◆ findService()

cxx::expected<InstanceContainer, FindServiceError> iox::runtime::PoshRuntime::findService ( const capro::ServiceDescription serviceDescription)
noexcept

find all services that match the provided service description

Parameters
[in]serviceDescriptionservice to search for
Returns
cxx::expected<InstanceContainer, FindServiceError> InstanceContainer: on success, container that is filled with all matching instances FindServiceError: if any, encountered during the operation

◆ getInstance() [1/2]

static PoshRuntime& iox::runtime::PoshRuntime::getInstance ( )
staticnoexcept

returns active runtime

Returns
active runtime

◆ getInstance() [2/2]

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

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

Parameters
[in]nameoptional containing the name used for registering with the RouDi daemon
Returns
active runtime

◆ getInstanceName()

RuntimeName_t iox::runtime::PoshRuntime::getInstanceName ( ) const
noexcept

get the name that was used to register with RouDi

Returns
name of the registered application

◆ getMiddlewareApplication()

popo::ApplicationPortData* iox::runtime::PoshRuntime::getMiddlewareApplication ( )
noexcept

request the RouDi daemon to create an application port

Returns
pointer to a created application port data

◆ getMiddlewareConditionVariable()

popo::ConditionVariableData* iox::runtime::PoshRuntime::getMiddlewareConditionVariable ( )
noexcept

request the RouDi daemon to create a condition variable

Returns
pointer to a created condition variable data

◆ getMiddlewareInterface()

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

request the RouDi daemon to create an interface port

Parameters
[in]interfaceinterface to create
[in]nodeNamename of the node where the interface should belong to
Returns
pointer to a created interface port data

◆ getMiddlewarePublisher()

PublisherPortUserType::MemberType_t* iox::runtime::PoshRuntime::getMiddlewarePublisher ( const capro::ServiceDescription service,
const popo::PublisherOptions publisherOptions = popo::PublisherOptions(),
const PortConfigInfo portConfigInfo = PortConfigInfo() 
)
noexcept

request the RouDi daemon to create a publisher port

Parameters
[in]serviceDescriptionservice description for the new publisher port
[in]publisherOptionslike the history capacity of a publisher
[in]portConfigInfoconfiguration information for the port (i.e. what type of port is requested, device where its payload memory is located on etc.)
Returns
pointer to a created publisher port user

◆ getMiddlewareSubscriber()

SubscriberPortUserType::MemberType_t* iox::runtime::PoshRuntime::getMiddlewareSubscriber ( const capro::ServiceDescription service,
const popo::SubscriberOptions subscriberOptions = popo::SubscriberOptions(),
const PortConfigInfo portConfigInfo = PortConfigInfo() 
)
noexcept

request the RouDi daemon to create a subscriber port

Parameters
[in]serviceDescriptionservice description for the new subscriber port
[in]subscriberOptionslike the queue capacity and history requested by a subscriber
[in]portConfigInfoconfiguration information for the port (what type of port is requested, device where its payload memory is located on etc.)
Returns
pointer to a created subscriber port data

◆ getRuntimeFactory()

static factory_t& iox::runtime::PoshRuntime::getRuntimeFactory ( )
staticprotectednoexcept

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

Returns
current runtime factory

◆ getServiceRegistryChangeCounter()

const std::atomic<uint64_t>* iox::runtime::PoshRuntime::getServiceRegistryChangeCounter ( )
noexcept

requests the serviceRegistryChangeCounter from the shared memory

Returns
pointer to the serviceRegistryChangeCounter

◆ initRuntime()

static PoshRuntime& iox::runtime::PoshRuntime::initRuntime ( const RuntimeName_t &  name)
staticnoexcept

creates the runtime with given name

Parameters
[in]nameused for registering the process with the RouDi daemon
Returns
active runtime

◆ offerService()

bool iox::runtime::PoshRuntime::offerService ( const capro::ServiceDescription serviceDescription)
noexcept

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

Parameters
[in]serviceDescriptionservice to offer
Returns
bool, if service is offered returns true else false

◆ sendRequestToRouDi()

bool iox::runtime::PoshRuntime::sendRequestToRouDi ( const IpcMessage msg,
IpcMessage answer 
)
noexcept

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

Parameters
[in]msgrequest message to send
[out]responsefrom the RouDi daemon
Returns
true if sucessful request/response, false on error

◆ setRuntimeFactory()

static void iox::runtime::PoshRuntime::setRuntimeFactory ( const factory_t &  factory)
staticprotectednoexcept

sets runtime factory, terminates if given factory is empty

Parameters
[in]factorystd::function to which the runtime factory should be set

◆ stopOfferService()

void iox::runtime::PoshRuntime::stopOfferService ( const capro::ServiceDescription serviceDescription)
noexcept

stop offering the provided service

Parameters
[in]serviceDescriptionof the service that shall be no more offered

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