Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Protected Attributes | Friends | List of all members
KM3NETDAQ::JEvent_t Struct Reference

Auxiliary class for handling event name and optional number. More...

#include <JRuncontrolToolkit.hh>

Public Member Functions

 JEvent_t ()
 Default constructor. More...
 
 JEvent_t (const std::string &name, const int number)
 Constructor. More...
 
const std::string & getName () const
 Get event name. More...
 
int getNumber () const
 Get event number. More...
 

Static Public Member Functions

static JEvent_t toValue (const std::string &buffer)
 Convert string to event. More...
 

Protected Attributes

std::string event_name
 
int event_number
 

Friends

std::istream & operator>> (std::istream &in, JEvent_t &object)
 Read event name and optional number from input stream. More...
 
std::ostream & operator<< (std::ostream &out, const JEvent_t &object)
 Write event to output stream. More...
 

Detailed Description

Auxiliary class for handling event name and optional number.

Definition at line 64 of file JRuncontrolToolkit.hh.

Constructor & Destructor Documentation

KM3NETDAQ::JEvent_t::JEvent_t ( )
inline

Default constructor.

Definition at line 68 of file JRuncontrolToolkit.hh.

68  :
69  event_name ("?"),
70  event_number(0)
71  {}
KM3NETDAQ::JEvent_t::JEvent_t ( const std::string &  name,
const int  number 
)
inline

Constructor.

Parameters
nameevent name
numberevent number

Definition at line 80 of file JRuncontrolToolkit.hh.

81  :
82  event_name (name),
83  event_number(number)
84  {}

Member Function Documentation

const std::string& KM3NETDAQ::JEvent_t::getName ( ) const
inline

Get event name.

Returns
event name

Definition at line 92 of file JRuncontrolToolkit.hh.

93  {
94  return event_name;
95  }
int KM3NETDAQ::JEvent_t::getNumber ( ) const
inline

Get event number.

Returns
event number

Definition at line 103 of file JRuncontrolToolkit.hh.

104  {
105  return event_number;
106  }
static JEvent_t KM3NETDAQ::JEvent_t::toValue ( const std::string &  buffer)
inlinestatic

Convert string to event.

Parameters
bufferbuffer
Returns
event

Definition at line 115 of file JRuncontrolToolkit.hh.

116  {
117  using namespace std;
118 
119  JEvent_t object;
120 
121  const string::size_type sep = buffer.find(EVENTNAME_DELIMETER);
122 
123  if (sep != string::npos) {
124 
125  istringstream(buffer.substr(sep + 1)) >> object.event_number;
126 
127  object.event_name = buffer.substr(0, sep);
128 
129  } else {
130 
131  object.event_name = buffer;
132  object.event_number = -1;
133  }
134 
135  return object;
136  }
static const char EVENTNAME_DELIMETER
Definition: JDAQTags.hh:35
JEvent_t()
Default constructor.

Friends And Related Function Documentation

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

Read event name and optional number from input stream.

Parameters
ininput stream
objectevent
Returns
input stream

Definition at line 146 of file JRuncontrolToolkit.hh.

147  {
148  std::string buffer;
149 
150  in >> buffer;
151 
152  object = JEvent_t::toValue(buffer);
153 
154  return in;
155  }
static JEvent_t toValue(const std::string &buffer)
Convert string to event.
std::ostream& operator<< ( std::ostream &  out,
const JEvent_t object 
)
friend

Write event to output stream.

Parameters
outoutput stream
objectevent
Returns
output stream

Definition at line 165 of file JRuncontrolToolkit.hh.

166  {
167  out << object.event_name;
168 
169  if (object.event_number != -1) {
170  out << getEventnameDelimeter() << object.event_number;
171  }
172 
173  return out;
174  }
char getEventnameDelimeter()
Get the event name delimeter.

Member Data Documentation

std::string KM3NETDAQ::JEvent_t::event_name
protected

Definition at line 178 of file JRuncontrolToolkit.hh.

int KM3NETDAQ::JEvent_t::event_number
protected

Definition at line 179 of file JRuncontrolToolkit.hh.


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