Class PoshRuntime

Inheritance Relationships

Derived Type

Class Documentation

class PoshRuntime

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

Subclassed by iox::runtime::PoshRuntimeImpl

Public Functions

PoshRuntime(const PoshRuntime&) = delete
PoshRuntime &operator=(const PoshRuntime&) = delete
PoshRuntime(PoshRuntime&&) = delete
PoshRuntime &operator=(PoshRuntime&&) = delete
virtual ~PoshRuntime() noexcept = default
RuntimeName_t getInstanceName() const noexcept

get the name that was used to register with RouDi

Returns:

name of the registered application

void shutdown() noexcept

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 = {}) noexcept = 0

request the RouDi daemon to create a publisher port

Parameters:
  • serviceDescription[in] service description for the new publisher port

  • publisherOptions[in] like the history capacity of a publisher

  • portConfigInfo[in] configuration 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

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

request the RouDi daemon to create a subscriber port

Parameters:
  • serviceDescription[in] service description for the new subscriber port

  • subscriberOptions[in] like the queue capacity and history requested by a subscriber

  • portConfigInfo[in] configuration 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

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

request the RouDi daemon to create a client port

Parameters:
  • serviceDescription[in] service description for the new client port

  • clientOptions[in] like the queue capacity and queue full policy by a client

  • portConfigInfo[in] configuration information for the port (what type of port is requested, device where its payload memory is located on etc.)

Returns:

pointer to a created client port data

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

request the RouDi daemon to create a server port

Parameters:
  • serviceDescription[in] service description for the new server port

  • serverOptions[in] like the queue capacity and queue full policy by a server

  • portConfigInfo[in] configuration information for the port (what type of port is requested, device where its payload memory is located on etc.)

Returns:

pointer to a created server port data

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

request the RouDi daemon to create an interface port

Parameters:
  • interface[in] interface to create

  • nodeName[in] name of the node where the interface should belong to

Returns:

pointer to a created interface port data

virtual popo::ConditionVariableData *getMiddlewareConditionVariable() noexcept = 0

request the RouDi daemon to create a condition variable

Returns:

pointer to a created condition variable data

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

request the RouDi daemon to create a node

Parameters:

nodeProperty[in] class which contains all properties which the node should have

Returns:

pointer to the data of the node

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

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

Parameters:
  • msg[in] request message to send

  • response[out] from the RouDi daemon

Returns:

true if sucessful request/response, false on error

Public Static Functions

static PoshRuntime &getInstance() noexcept

returns active runtime

Returns:

active runtime

static PoshRuntime &initRuntime(const RuntimeName_t &name) noexcept

creates the runtime with given name

Parameters:

name[in] used for registering the process with the RouDi daemon

Returns:

active runtime

Protected Types

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

Protected Functions

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

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

Protected Attributes

const RuntimeName_t m_appName
std::atomic<bool> m_shutdownRequested = {false}

Protected Static Functions

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

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

Returns:

current runtime factory

static void setRuntimeFactory(const factory_t &factory) noexcept

sets runtime factory, terminates if given factory is empty

Parameters:

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

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

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

Parameters:

name[in] optional containing the name used for registering with the RouDi daemon

Returns:

active runtime

Friends

friend class roudi::RuntimeTestInterface