Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
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.
 
 JEvent_t (const std::string &name)
 Constructor.
 
 JEvent_t (const std::string &name, const std::string &info)
 Constructor.
 
const std::string & getName () const
 Get event name.
 
bool hasInfo () const
 Check if this event has information.
 
const std::string & getInfo () const
 Get event information.
 

Static Public Member Functions

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

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.
 
std::ostream & operator<< (std::ostream &out, const JEvent_t &object)
 Write event to output stream.
 

Detailed Description

Auxiliary class for handling event name and optional static information.

Definition at line 23 of file JEvent_t.hh.

Constructor & Destructor Documentation

◆ JEvent_t() [1/3]

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 name
Definition JEvent_t.hh:164
std::string info
Definition JEvent_t.hh:165

◆ JEvent_t() [2/3]

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 {}

◆ JEvent_t() [3/3]

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 {}

Member Function Documentation

◆ getName()

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 }

◆ hasInfo()

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 }

◆ getInfo()

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 }

◆ toValue()

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 }
std::string trim(const std::string &buffer)
Trim string.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
static const char EVENTNAME_DELIMETER
Definition JDAQTags.hh:57
JEvent_t()
Default constructor.
Definition JEvent_t.hh:27

Friends And Related Symbol Documentation

◆ operator>>

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

◆ operator<<

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

◆ name

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

Definition at line 164 of file JEvent_t.hh.

◆ info

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

Definition at line 165 of file JEvent_t.hh.

◆ more

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: