17 #ifndef SCIP2_PROTOCOL_H 18 #define SCIP2_PROTOCOL_H 24 #include <boost/asio.hpp> 25 #include <boost/bind/bind.hpp> 40 boost::asio::streambuf& buf,
41 const boost::posix_time::ptime& time_read)
43 std::istream stream(&buf);
44 std::string echo_back;
45 if (!std::getline(stream, echo_back))
51 if (!std::getline(stream, status))
61 while (std::getline(stream, line))
67 using Ptr = std::shared_ptr<Protocol>;
70 : connection_(connection)
72 connection_->registerReceiveCallback(
77 const std::string& command,
80 connection_->send(command +
"\n", cb);
83 template <
typename TResponse>
92 #endif // SCIP2_PROTOCOL_H void cbReceive(boost::asio::streambuf &buf, const boost::posix_time::ptime &time_read)
ResponseProcessor response_processor_
std::shared_ptr< Connection > Ptr
Protocol(Connection::Ptr connection)
Connection::Ptr connection_
void registerCallback(typename TResponse::Callback cb)
boost::function< void(const boost::posix_time::ptime &)> CallbackSend
std::shared_ptr< Protocol > Ptr
void sendCommand(const std::string &command, Connection::CallbackSend cb=Connection::CallbackSend())
void registerCallback(typename TResponse::Callback cb)