Jpp  18.3.0
the software that should make you happy
 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 static information. More...

#include <JEvent_t.hh>

Public Member Functions

 JEvent_t ()
 Default constructor. More...
 
 JEvent_t (const std::string &name)
 Constructor. More...
 
 JEvent_t (const std::string &name, const std::string &info)
 Constructor. More...
 
const std::stringgetName () const
 Get event name. More...
 
bool hasInfo () const
 Check if this event has information. More...
 
const std::stringgetInfo () const
 Get event information. More...
 

Static Public Member Functions

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

Protected Attributes

std::string name
 
std::string info
 
bool more
 

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 static information.

Definition at line 23 of file JEvent_t.hh.

Constructor & Destructor Documentation

KM3NETDAQ::JEvent_t::JEvent_t ( )
inline

Default constructor.

Definition at line 27 of file JEvent_t.hh.

27  :
28  name("?"),
29  info(),
30  more(false)
31  {}
std::string info
Definition: JEvent_t.hh:165
std::string name
Definition: JEvent_t.hh:164
KM3NETDAQ::JEvent_t::JEvent_t ( const std::string name)
inline

Constructor.

Parameters
nameevent name

Definition at line 39 of file JEvent_t.hh.

39  :
40  name(name),
41  info(),
42  more(false)
43  {}
std::string info
Definition: JEvent_t.hh:165
std::string name
Definition: JEvent_t.hh:164
KM3NETDAQ::JEvent_t::JEvent_t ( const std::string name,
const std::string info 
)
inline

Constructor.

Parameters
nameevent name
infoevent information

Definition at line 52 of file JEvent_t.hh.

53  :
54  name(name),
55  info(info),
56  more(true)
57  {}
std::string info
Definition: JEvent_t.hh:165
std::string name
Definition: JEvent_t.hh:164

Member Function Documentation

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

Get event name.

Returns
event name

Definition at line 65 of file JEvent_t.hh.

66  {
67  return name;
68  }
std::string name
Definition: JEvent_t.hh:164
bool KM3NETDAQ::JEvent_t::hasInfo ( ) const
inline

Check if this event has information.

Returns
true if information is available; else false

Definition at line 76 of file JEvent_t.hh.

77  {
78  return more;
79  }
const std::string& KM3NETDAQ::JEvent_t::getInfo ( ) const
inline

Get event information.

Returns
event information.

Definition at line 87 of file JEvent_t.hh.

88  {
89  return info;
90  }
std::string info
Definition: JEvent_t.hh:165
static JEvent_t KM3NETDAQ::JEvent_t::toValue ( const std::string buffer)
inlinestatic

Convert string to event.

Parameters
bufferbuffer
Returns
event

Definition at line 99 of file JEvent_t.hh.

100  {
101  using namespace std;
102  using namespace JPP;
103 
104  JEvent_t object;
105 
106  const string::size_type sep = buffer.find(EVENTNAME_DELIMETER);
107 
108  if (sep != string::npos) {
109 
110  object.name = trim(buffer.substr(0, sep));
111  object.info = trim(buffer.substr(sep + 1));
112  object.more = true;
113 
114  } else {
115 
116  object.name = trim(buffer);
117  object.info = "";
118  object.more = false;
119  }
120 
121  return object;
122  }
static const char EVENTNAME_DELIMETER
Definition: JDAQTags.hh:51
std::string trim(const std::string &buffer)
Trim string.
Definition: JLangToolkit.hh:79
JEvent_t()
Default constructor.
Definition: JEvent_t.hh:27

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 132 of file JEvent_t.hh.

133  {
134  std::string buffer;
135 
136  in >> buffer;
137 
138  object = JEvent_t::toValue(buffer);
139 
140  return in;
141  }
static JEvent_t toValue(const std::string &buffer)
Convert string to event.
Definition: JEvent_t.hh:99
then awk string
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:48
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 151 of file JEvent_t.hh.

152  {
153  out << object.name;
154 
155  if (object.more) {
156  out << getEventnameDelimeter() << object.info;
157  }
158 
159  return out;
160  }
char getEventnameDelimeter()
Get the event name delimeter.

Member Data Documentation

std::string KM3NETDAQ::JEvent_t::name
protected

Definition at line 164 of file JEvent_t.hh.

std::string KM3NETDAQ::JEvent_t::info
protected

Definition at line 165 of file JEvent_t.hh.

bool KM3NETDAQ::JEvent_t::more
protected

Definition at line 166 of file JEvent_t.hh.


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