Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JDB::JReplyMessage Struct Reference

Auxiliary data structure for reply message. More...

#include <JReplyMessage.hh>

Public Member Functions

 JReplyMessage ()
 Default constructor.
 
 JReplyMessage (const JDatalogString &datalog)
 Copy constructor.
 
bool match (const JReplyMessage &message) const
 Get match.
 

Public Attributes

std::string tag
 
std::string key
 
std::string ip
 
std::string nickname
 
std::string event
 
std::string state
 

Friends

std::istream & operator>> (std::istream &in, JReplyMessage &object)
 Read message from input.
 
std::ostream & operator<< (std::ostream &out, const JReplyMessage &object)
 Write message to output.
 

Detailed Description

Auxiliary data structure for reply message.

Definition at line 31 of file JReplyMessage.hh.

Constructor & Destructor Documentation

◆ JReplyMessage() [1/2]

JDB::JReplyMessage::JReplyMessage ( )
inline

Default constructor.

Definition at line 35 of file JReplyMessage.hh.

36 {}

◆ JReplyMessage() [2/2]

JDB::JReplyMessage::JReplyMessage ( const JDatalogString & datalog)
inline

Copy constructor.

Parameters
datalogdata log

Definition at line 44 of file JReplyMessage.hh.

45 {
46 using namespace std;
47 using namespace JPP;
48 using namespace KM3NETDAQ;
49
50 if (datalog.source == RC_REPLY.toString()) {
51
52 this->tag = datalog.source;
53
54 istringstream is(datalog.data);
55
56 const locale loc(is.getloc(), new JWhiteSpacesFacet(is.getloc(), TOKEN_DELIMETER));
57
58 is.imbue(loc);
59
60 if (is >> this->key >> this->ip >> this->nickname >> this->event >>this->state && this->key == RUN_CONTROL_CLIENT) {
61
62 } else {
63
64 THROW(JParseError, "Invalid string " << datalog.source << " " << datalog.data);
65 }
66
67 } else {
68
69 THROW(JParseError, "Invalid source " << datalog.source);
70 }
71 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Exception for parsing value.
Auxiliary class to specify white space character(s) in currect locale.
char * loc(char *orig)
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
KM3NeT DAQ data structures and auxiliaries.
Definition DataQueue.cc:39

Member Function Documentation

◆ match()

bool JDB::JReplyMessage::match ( const JReplyMessage & message) const
inline

Get match.

Parameters
messagemessage
Returns
true if message matches; else false

Definition at line 80 of file JReplyMessage.hh.

81 {
82 if (!message.nickname.empty() && message.nickname != nickname) { return false; }
83 if (!message.ip .empty() && message.ip != ip) { return false; }
84 if (!message.event .empty() && message.event != event) { return false; }
85 if (!message.state .empty() && message.state != state) { return false; }
86
87 return true;
88 }

Friends And Related Symbol Documentation

◆ operator>>

std::istream & operator>> ( std::istream & in,
JReplyMessage & object )
friend

Read message from input.

Parameters
ininput stream
objectmessage
Returns
input stream

Definition at line 98 of file JReplyMessage.hh.

99 {
100 return in >> object.key
101 >> object.ip
102 >> object.nickname
103 >> object.event
104 >> object.state;
105 }

◆ operator<<

std::ostream & operator<< ( std::ostream & out,
const JReplyMessage & object )
friend

Write message to output.

Parameters
outoutput stream
objectmessage
Returns
output stream

Definition at line 115 of file JReplyMessage.hh.

116 {
117 return out << object.key
118 << object.ip
119 << object.nickname
120 << object.event
121 << object.state;
122 }

Member Data Documentation

◆ tag

std::string JDB::JReplyMessage::tag

Definition at line 125 of file JReplyMessage.hh.

◆ key

std::string JDB::JReplyMessage::key

Definition at line 126 of file JReplyMessage.hh.

◆ ip

std::string JDB::JReplyMessage::ip

Definition at line 127 of file JReplyMessage.hh.

◆ nickname

std::string JDB::JReplyMessage::nickname

Definition at line 128 of file JReplyMessage.hh.

◆ event

std::string JDB::JReplyMessage::event

Definition at line 129 of file JReplyMessage.hh.

◆ state

std::string JDB::JReplyMessage::state

Definition at line 130 of file JReplyMessage.hh.


The documentation for this struct was generated from the following file: