ifw
0.0.1-dev
|
#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 | |
MsgReplier & | operator= (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 | |
MsgReplier & | operator= (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 | |
MsgReplier & | operator= (const MsgReplier &)=delete |
template<typename TYPEREP > | |
size_t | Send (const std::string &identity, const TYPEREP &replyPayload) |
Class to receive requests and send replies.
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> |
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).
[in] | endpoint | Address and port to be used to receive requests. |
[in] | ios | Reference to the event loop. |
[in] | handlers | Map of handlers for given requests. |
[in] | fallback | Fallback handler. |
|
virtual |
Destructor
|
default |
|
delete |
rad::MsgReplier::MsgReplier | ( | const std::string & | endpoint, |
boost::asio::io_service & | ios, | ||
std::unique_ptr< MsgHandler > && | fallbackHandler | ||
) |
|
virtual |
|
default |
|
delete |
rad::MsgReplier::MsgReplier | ( | const std::string & | endpoint, |
boost::asio::io_service & | ios, | ||
std::unique_ptr< MsgHandler > && | fallbackHandler | ||
) |
|
virtual |
|
default |
|
delete |
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 | ||
) |
|
delete |
|
delete |
|
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.
[in] | identify | Identity of the originator of the request to reply to. |
[in] | replyType | Type of the payload to be sent with the reply. |
[in] | replyPayload | Payload to be sent with the reply. |
size_t rad::MsgReplier::Send | ( | const std::string & | identity, |
const std::string & | replyType, | ||
const std::string & | replyPayload | ||
) |
size_t rad::MsgReplier::Send | ( | const std::string & | identity, |
const REPLY & | replyPayload | ||
) |
size_t rad::MsgReplier::Send | ( | const std::string & | identity, |
const REPLY & | replyPayload | ||
) |
size_t rad::MsgReplier::Send | ( | const std::string & | identity, |
const REPLY & | replyPayload | ||
) |
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.
[in] | endpoint | Address and port to be used to receive requests. |
void MsgReplier::Stop | ( | ) |
Bind the socket to an IP address and port.
[in] | endpoint | Address and port to be used to receive requests. |
void rad::MsgReplier::Stop | ( | ) |
void rad::MsgReplier::Stop | ( | ) |