Fawkes API
Fawkes Development Version
|
CLIPS protobuf integration class. More...
#include <>>
Public Member Functions | |
ClipsProtobufCommunicator (CLIPS::Environment *env, fawkes::Mutex &env_mutex, fawkes::Logger *logger=NULL) | |
Constructor. More... | |
ClipsProtobufCommunicator (CLIPS::Environment *env, fawkes::Mutex &env_mutex, std::vector< std::string > &proto_path, fawkes::Logger *logger=NULL) | |
Constructor. More... | |
~ClipsProtobufCommunicator () | |
Destructor. More... | |
void | enable_server (int port) |
Enable protobuf stream server. More... | |
void | disable_server () |
Disable protobu stream server. More... | |
protobuf_comm::ProtobufStreamServer * | server () const |
Get Protobuf server. More... | |
const std::map< long int, protobuf_comm::ProtobufBroadcastPeer * > & | peers () const |
Get protobuf_comm peers. More... | |
protobuf_comm::MessageRegister & | message_register () |
Get the communicator's message register. More... | |
boost::signals2::signal< void(protobuf_comm::ProtobufStreamServer::ClientID, std::shared_ptr< google::protobuf::Message >)> & | signal_server_sent () |
Signal invoked for a message that has been sent to a server client. More... | |
boost::signals2::signal< void(std::string, unsigned short, std::shared_ptr< google::protobuf::Message >)> & | signal_client_sent () |
Signal invoked for a message that has been sent to a client. More... | |
boost::signals2::signal< void(long, std::shared_ptr< google::protobuf::Message >)> & | signal_peer_sent () |
Signal invoked for a message that has been sent via broadcast. More... | |
CLIPS protobuf integration class.
This class adds functionality related to protobuf to a given CLIPS environment. It supports the creation of communication channels through protobuf_comm. An instance maintains its own message register shared among server, peer, and clients.
Definition at line 61 of file communicator.h.
protobuf_clips::ClipsProtobufCommunicator::ClipsProtobufCommunicator | ( | CLIPS::Environment * | env, |
fawkes::Mutex & | env_mutex, | ||
fawkes::Logger * | logger = NULL |
||
) |
Constructor.
env | CLIPS environment to which to provide the protobuf functionality |
env_mutex | mutex to lock when operating on the CLIPS environment. |
logger | optional logger for informational output |
Definition at line 71 of file communicator.cpp.
protobuf_clips::ClipsProtobufCommunicator::ClipsProtobufCommunicator | ( | CLIPS::Environment * | env, |
fawkes::Mutex & | env_mutex, | ||
std::vector< std::string > & | proto_path, | ||
fawkes::Logger * | logger = NULL |
||
) |
Constructor.
env | CLIPS environment to which to provide the protobuf functionality |
env_mutex | mutex to lock when operating on the CLIPS environment. |
proto_path | proto path passed to a newly instantiated message register |
logger | optional logger for informational output |
Definition at line 87 of file communicator.cpp.
protobuf_clips::ClipsProtobufCommunicator::~ClipsProtobufCommunicator | ( | ) |
Destructor.
Definition at line 100 of file communicator.cpp.
References disable_server(), and enable_server().
void protobuf_clips::ClipsProtobufCommunicator::disable_server | ( | ) |
Disable protobu stream server.
Definition at line 188 of file communicator.cpp.
References protobuf_comm::MessageRegister::add_message_type(), protobuf_comm::ProtobufStreamClient::async_connect(), protobuf_comm::ProtobufStreamServer::disconnect(), fawkes::Logger::log_error(), fawkes::Logger::log_warn(), protobuf_comm::MessageRegister::new_message_for(), protobuf_comm::ProtobufStreamServer::send(), protobuf_comm::ProtobufStreamClient::signal_connected(), protobuf_comm::ProtobufStreamClient::signal_disconnected(), protobuf_comm::ProtobufStreamClient::signal_receive_failed(), protobuf_comm::ProtobufStreamClient::signal_received(), protobuf_comm::ProtobufBroadcastPeer::signal_received(), protobuf_comm::ProtobufBroadcastPeer::signal_recv_error(), protobuf_comm::ProtobufBroadcastPeer::signal_send_error(), and fawkes::Exception::what_no_backtrace().
Referenced by ~ClipsProtobufCommunicator().
void protobuf_clips::ClipsProtobufCommunicator::enable_server | ( | int | port | ) |
Enable protobuf stream server.
port | TCP port to listen on for connections |
Definition at line 168 of file communicator.cpp.
References protobuf_comm::ProtobufStreamServer::signal_connected(), protobuf_comm::ProtobufStreamServer::signal_disconnected(), protobuf_comm::ProtobufStreamServer::signal_receive_failed(), and protobuf_comm::ProtobufStreamServer::signal_received().
Referenced by ~ClipsProtobufCommunicator().
|
inline |
Get the communicator's message register.
Definition at line 87 of file communicator.h.
|
inline |
|
inline |
|
inline |
Signal invoked for a message that has been sent to a client.
Definition at line 102 of file communicator.h.
|
inline |
Signal invoked for a message that has been sent via broadcast.
Definition at line 109 of file communicator.h.
|
inline |
Signal invoked for a message that has been sent to a server client.
Definition at line 95 of file communicator.h.