23 zmq::context_t context(1);
24 zmq::socket_t socket (context, ZMQ_REP);
25 socket.bind (
"tcp://*:6665");
29 zmq::message_t request;
32 socket.recv (&request);
33 const char* request_data = (
const char*)request.data();
35 if( strncmp( request_data,
"[get_data_names]", 16 ) == 0 )
41 std::map<QString, double>::iterator it;
44 string_reply.append( it->first + QString(
" "));
48 zmq::message_t reply ( string_reply.size() );
51 else if( strncmp( request_data,
"[get_data]", 10 ) == 0 )
54 QString string_request = QString::fromUtf8( &request_data [10], request.size() - 10);
55 QStringList names = string_request.split(
';');
60 for(
int i = 0;
i< names.count();
i++ )
62 std::map<QString, double>::iterator it =
_current_data.find( names.at(
i) );
69 double value = it->second;
70 string_reply.append( QString::number(value) + QString(
" "));
77 zmq::message_t reply (5);
78 memcpy (reply.data (),
"Error", 5);
82 zmq::message_t reply ( string_reply.size() );
87 zmq::message_t reply (5);
88 memcpy (reply.data (),
"Error", 5);
107 PlotDataMap::iterator it;
112 for ( it = datamap->begin(); it != datamap->end(); it++ )
114 const QString&
name = it->first;
115 PlotDataPtr plotdata = it->second;
virtual const char * name() const =0
virtual void updateState(PlotDataMap *datamap, double current_time)
virtual ~StatePublisherZMQ()
std::map< QString, double > _current_data
PlotDataMap * _prev_dataplot