ifw  0.0.1-dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | List of all members
rad::MsgReplier Class Reference

#include <MsgReplier.hpp>

Public Types

using MsgHandler_t = std::function< void(const std::string &, const std::string &, const void *, size_t)>
 
using MsgHandlerMap_t = std::unordered_map< std::string, MsgHandler_t >
 
using MsgHandler_t = std::function< void(const std::string &, const std::string &, const void *, size_t)>
 
using MsgHandlerMap_t = std::unordered_map< std::string, MsgHandler_t >
 
using MsgHandler_t = std::function< void(const std::string &, const std::string &, const void *, size_t)>
 
using MsgHandlerMap_t = std::unordered_map< std::string, MsgHandler_t >
 

Public Member Functions

 MsgReplier (const std::string &endpoint, boost::asio::io_service &ios, std::unique_ptr< MsgHandler > &&fallbackHandler)
 
virtual ~MsgReplier ()
 
 MsgReplier (MsgReplier &&)=default
 
void Start ()
 
void Stop ()
 
void AddMsgHandler (const std::string &requestName, MsgHandler_t handler)
 
size_t Send (const std::string &identity, const std::string &replyType, const std::string &replyPayload)
 
template<typename REPLY >
size_t Send (const std::string &identity, const REPLY &replyPayload)
 
 MsgReplier (const MsgReplier &)=delete
 
MsgReplieroperator= (const MsgReplier &)=delete
 
 MsgReplier (const std::string &endpoint, boost::asio::io_service &ios, std::unique_ptr< MsgHandler > &&fallbackHandler)
 
virtual ~MsgReplier ()
 
 MsgReplier (MsgReplier &&)=default
 
void Start ()
 
void Stop ()
 
void AddMsgHandler (const std::string &requestName, MsgHandler_t handler)
 
size_t Send (const std::string &identity, const std::string &replyType, const std::string &replyPayload)
 
template<typename REPLY >
size_t Send (const std::string &identity, const REPLY &replyPayload)
 
 MsgReplier (const MsgReplier &)=delete
 
MsgReplieroperator= (const MsgReplier &)=delete
 
 MsgReplier (const std::string &endpoint, boost::asio::io_service &ios, std::unique_ptr< MsgHandler > &&fallbackHandler)
 
virtual ~MsgReplier ()
 
 MsgReplier (MsgReplier &&)=default
 
void Start ()
 
void Stop ()
 
void AddMsgHandler (const std::string &requestName, MsgHandler_t handler)
 
size_t Send (const std::string &identity, const std::string &replyType, const std::string &replyPayload)
 
template<typename REPLY >
size_t Send (const std::string &identity, const REPLY &replyPayload)
 
 MsgReplier (const MsgReplier &)=delete
 
MsgReplieroperator= (const MsgReplier &)=delete
 
template<typename TYPEREP >
size_t Send (const std::string &identity, const TYPEREP &replyPayload)
 

Detailed Description

Class to receive requests and send replies.

Member Typedef Documentation

using rad::MsgReplier::MsgHandler_t = std::function<void (const std::string&, const std::string&, const void*, size_t)>
using rad::MsgReplier::MsgHandler_t = std::function<void (const std::string&, const std::string&, const void*, size_t)>
using rad::MsgReplier::MsgHandler_t = std::function<void (const std::string&, const std::string&, const void*, size_t)>
using rad::MsgReplier::MsgHandlerMap_t = std::unordered_map<std::string, MsgHandler_t>
using rad::MsgReplier::MsgHandlerMap_t = std::unordered_map<std::string, MsgHandler_t>
using rad::MsgReplier::MsgHandlerMap_t = std::unordered_map<std::string, MsgHandler_t>

Constructor & Destructor Documentation

MsgReplier::MsgReplier ( const std::string &  endpoint,
boost::asio::io_service &  ios,
std::unique_ptr< MsgHandler > &&  fallback 
)

Configure socket and bind the socket to the given endpoint (IP address and port).

Parameters
[in]endpointAddress and port to be used to receive requests.
[in]iosReference to the event loop.
[in]handlersMap of handlers for given requests.
[in]fallbackFallback handler.
MsgReplier::~MsgReplier ( )
virtual

Destructor

rad::MsgReplier::MsgReplier ( MsgReplier &&  )
default
rad::MsgReplier::MsgReplier ( const MsgReplier )
delete
rad::MsgReplier::MsgReplier ( const std::string &  endpoint,
boost::asio::io_service &  ios,
std::unique_ptr< MsgHandler > &&  fallbackHandler 
)
virtual rad::MsgReplier::~MsgReplier ( )
virtual
rad::MsgReplier::MsgReplier ( MsgReplier &&  )
default
rad::MsgReplier::MsgReplier ( const MsgReplier )
delete
rad::MsgReplier::MsgReplier ( const std::string &  endpoint,
boost::asio::io_service &  ios,
std::unique_ptr< MsgHandler > &&  fallbackHandler 
)
virtual rad::MsgReplier::~MsgReplier ( )
virtual
rad::MsgReplier::MsgReplier ( MsgReplier &&  )
default
rad::MsgReplier::MsgReplier ( const MsgReplier )
delete

Member Function Documentation

void MsgReplier::AddMsgHandler ( const std::string &  requestName,
MsgHandler_t  handler 
)
void rad::MsgReplier::AddMsgHandler ( const std::string &  requestName,
MsgHandler_t  handler 
)
void rad::MsgReplier::AddMsgHandler ( const std::string &  requestName,
MsgHandler_t  handler 
)
MsgReplier& rad::MsgReplier::operator= ( const MsgReplier )
delete
MsgReplier& rad::MsgReplier::operator= ( const MsgReplier )
delete
MsgReplier& rad::MsgReplier::operator= ( const MsgReplier )
delete
size_t rad::MsgReplier::Send ( const std::string &  identity,
const std::string &  replyType,
const std::string &  replyPayload 
)
size_t MsgReplier::Send ( const std::string &  identity,
const std::string &  replyType,
const std::string &  replyPayload 
)

Method to reply to a request.

Parameters
[in]identifyIdentity of the originator of the request to reply to.
[in]replyTypeType of the payload to be sent with the reply.
[in]replyPayloadPayload to be sent with the reply.
Returns
the number of bytes sent with the reply.
size_t rad::MsgReplier::Send ( const std::string &  identity,
const std::string &  replyType,
const std::string &  replyPayload 
)
template<typename REPLY >
size_t rad::MsgReplier::Send ( const std::string &  identity,
const REPLY &  replyPayload 
)
template<typename REPLY >
size_t rad::MsgReplier::Send ( const std::string &  identity,
const REPLY &  replyPayload 
)
template<typename REPLY >
size_t rad::MsgReplier::Send ( const std::string &  identity,
const REPLY &  replyPayload 
)
template<typename TYPEREP >
size_t rad::MsgReplier::Send ( const std::string &  identity,
const TYPEREP &  replyPayload 
)
void rad::MsgReplier::Start ( )
void rad::MsgReplier::Start ( )
void MsgReplier::Start ( )

Register callback to the socket.

Parameters
[in]endpointAddress and port to be used to receive requests.
void MsgReplier::Stop ( )

Bind the socket to an IP address and port.

Parameters
[in]endpointAddress and port to be used to receive requests.
void rad::MsgReplier::Stop ( )
void rad::MsgReplier::Stop ( )

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