iceoryx_posh 2.0.5
Loading...
Searching...
No Matches
Public Member Functions | List of all members
iox::popo::ServerImpl< Req, Res, BaseServerT > Class Template Reference

The ServerImpl class implements the typed server API. More...

#include <iceoryx_posh/internal/popo/server_impl.hpp>

Inheritance diagram for iox::popo::ServerImpl< Req, Res, BaseServerT >:
Inheritance graph
[legend]
Collaboration diagram for iox::popo::ServerImpl< Req, Res, BaseServerT >:
Collaboration graph
[legend]

Public Member Functions

 ServerImpl (const capro::ServiceDescription &service, const ServerOptions &serverOptions={}) noexcept
 Constructor for a sserver.
 
 ServerImpl (const ServerImpl &)=delete
 
 ServerImpl (ServerImpl &&)=delete
 
ServerImploperator= (const ServerImpl &)=delete
 
ServerImploperator= (ServerImpl &&)=delete
 
cxx::expected< Request< const Req >, ServerRequestResulttake () noexcept
 Take the Request from the top of the receive queue.
 
template<typename... Args>
cxx::expected< Response< Res >, AllocationErrorloan (const Request< const Req > &request, Args &&... args) noexcept
 Get a Response from loaned shared memory and construct the data with the given arguments.
 
cxx::expected< ServerSendErrorsend (Response< Res > &&response) noexcept override
 Sends the given Response and then releases its loan.
 
- Public Member Functions inherited from iox::popo::BaseServer< PortT, TriggerHandleT >
 BaseServer (const BaseServer &other)=delete
 
BaseServeroperator= (const BaseServer &)=delete
 
 BaseServer (BaseServer &&rhs)=delete
 
BaseServeroperator= (BaseServer &&rhs)=delete
 
uid_t getUid () const noexcept
 Get the UID of the server.
 
const capro::ServiceDescriptiongetServiceDescription () const noexcept
 Get the service description of the server.
 
void offer () noexcept
 Offer the service to be connected to when not already offering, otherwise nothing.
 
void stopOffer () noexcept
 Stop offering the service when already offering, otherwise nothing.
 
bool isOffered () const noexcept
 Check if the server is offering.
 
bool hasClients () const noexcept
 Check if the server has clients.
 
bool hasRequests () const noexcept
 Check if requests are available.
 
bool hasMissedRequests () noexcept
 Check if requests has been missed since the last call of this method.
 
void releaseQueuedRequests () noexcept
 Releases any unread queued requests.
 

Additional Inherited Members

- Protected Types inherited from iox::popo::BaseServer< PortT, TriggerHandleT >
using SelfType = BaseServer< PortT, TriggerHandleT >
 
using PortType = PortT
 
- Protected Member Functions inherited from iox::popo::BaseServer< PortT, TriggerHandleT >
 BaseServer (const capro::ServiceDescription &service, const ServerOptions &serverOptions) noexcept
 
void invalidateTrigger (const uint64_t uniqueTriggerId) noexcept
 Only usable by the WaitSet/Listener, not for public use. Invalidates the internal triggerHandle.
 
void enableState (TriggerHandleT &&triggerHandle, const ServerState serverState) noexcept
 Only usable by the WaitSet/Listener, not for public use. Attaches the triggerHandle to the internal trigger.
 
WaitSetIsConditionSatisfiedCallback getCallbackForIsStateConditionSatisfied (const ServerState serverState) const noexcept
 Only usable by the WaitSet/Listener, not for public use. Returns method pointer to the event corresponding hasTriggered method callback.
 
void disableState (const ServerState serverState) noexcept
 Only usable by the WaitSet/Listener, not for public use. Resets the internal triggerHandle.
 
void enableEvent (TriggerHandleT &&triggerHandle, const ServerEvent serverEvent) noexcept
 Only usable by the WaitSet/Listener, not for public use. Attaches the triggerHandle to the internal trigger.
 
void disableEvent (const ServerEvent serverEvent) noexcept
 Only usable by the WaitSet/Listener, not for public use. Resets the internal triggerHandle.
 
const PortTport () const noexcept
 port
 
PortTport () noexcept
 port
 
- Protected Attributes inherited from iox::popo::BaseServer< PortT, TriggerHandleT >
PortT m_port
 
TriggerHandleT m_trigger
 

Detailed Description

template<typename Req, typename Res, typename BaseServerT = BaseServer<>>
class iox::popo::ServerImpl< Req, Res, BaseServerT >

The ServerImpl class implements the typed server API.

Note
Not intended for public usage! Use the Server instead!

Constructor & Destructor Documentation

◆ ServerImpl()

template<typename Req , typename Res , typename BaseServerT = BaseServer<>>
iox::popo::ServerImpl< Req, Res, BaseServerT >::ServerImpl ( const capro::ServiceDescription service,
const ServerOptions serverOptions = {} 
)
explicitnoexcept

Constructor for a sserver.

Parameters
[in]serviceis the ServiceDescription for the new server
[in]serverOptionslike the queue capacity and queue full policy by a server

Member Function Documentation

◆ loan()

template<typename Req , typename Res , typename BaseServerT = BaseServer<>>
template<typename... Args>
cxx::expected< Response< Res >, AllocationError > iox::popo::ServerImpl< Req, Res, BaseServerT >::loan ( const Request< const Req > &  request,
Args &&...  args 
)
noexcept

Get a Response from loaned shared memory and construct the data with the given arguments.

Parameters
[in]requestThe request to which the Response belongs to, to determine where to send the response
[in]argsArguments used to construct the data.
Returns
An instance of the Response that resides in shared memory or an error if unable to allocate memory to loan.

The loaned Response is automatically released when it goes out of scope.

◆ send()

template<typename Req , typename Res , typename BaseServerT = BaseServer<>>
cxx::expected< ServerSendError > iox::popo::ServerImpl< Req, Res, BaseServerT >::send ( Response< Res > &&  response)
overridenoexcept

Sends the given Response and then releases its loan.

Parameters
responseto send.
Returns
Error if sending was not successful

◆ take()

template<typename Req , typename Res , typename BaseServerT = BaseServer<>>
cxx::expected< Request< const Req >, ServerRequestResult > iox::popo::ServerImpl< Req, Res, BaseServerT >::take ( )
noexcept

Take the Request from the top of the receive queue.

Returns
Either a Request or a ServerRequestResult.

The Request takes care of the cleanup. Don't store the raw pointer to the content of the Request, but always the whole Request.


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