Jpp  master_rocky
the software that should make you happy
Public Member Functions | Public Attributes | Friends | List of all members
JACOUSTICS::JEmitterID Struct Reference

Auxiliary class for emitter identification. More...

#include <JEmitterID.hh>

Inheritance diagram for JACOUSTICS::JEmitterID:
std::map< int, int >

Public Member Functions

int operator() (const int id) const
 Get emitter identifier for given waveform identifier. More...
 

Public Attributes

JComment comment
 

Friends

std::istream & operator>> (std::istream &in, JEmitterID &object)
 Read emitter data from input. More...
 
std::ostream & operator<< (std::ostream &out, const JEmitterID &object)
 Write emitter data to output. More...
 

Detailed Description

Auxiliary class for emitter identification.

This class can be used to map the identfier of a waveform (i.e. column "EMITTERID" the database table "toashort" or JDATABASE::JToAshort::EMITTERID) to the identifier of the corresponding emitter (c.q. tripod).

Definition at line 39 of file JEmitterID.hh.

Member Function Documentation

◆ operator()()

int JACOUSTICS::JEmitterID::operator() ( const int  id) const
inline

Get emitter identifier for given waveform identifier.

Parameters
idwaveform identifier
Returns
emitter identifier

Definition at line 48 of file JEmitterID.hh.

49  {
50  const_iterator p = this->find(id);
51 
52  if (p != this->end())
53  return p->second;
54  else
55  THROW(JValueOutOfRange, "Invalid waveform identifier " << id);
56  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
Exception for accessing a value in a collection that is outside of its range.
Definition: JException.hh:180

Friends And Related Function Documentation

◆ operator>>

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

Read emitter data from input.

Parameters
ininput stream
objectemitter data
Returns
input stream

Definition at line 66 of file JEmitterID.hh.

67  {
68  using namespace JPP;
69 
70  JStringStream is(in);
71 
72  if (getFileStatus(is.str().c_str())) {
73  is.load();
74  }
75 
76  object.clear();
77 
78  is >> object.comment;
79 
80  int waveform;
81  int emitter;
82 
83  while (is >> waveform >> emitter) {
84  object[waveform] = emitter;
85  }
86 
87  return in;
88  }
Wrapper class around STL stringstream class to facilitate optional loading of data from file.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
static JStat getFileStatus
Function object for file status.
Definition: JStat.hh:173

◆ operator<<

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

Write emitter data to output.

Parameters
outoutput stream
objectemitter data
Returns
output stream

Definition at line 98 of file JEmitterID.hh.

99  {
100  using namespace std;
101 
102  out << object.comment;
103 
104  for (JEmitterID::const_iterator i = object.begin(); i != object.end(); ++i) {
105  out << setw(3) << i->first << ' ' << setw(2) << i->second << endl;
106  }
107 
108  return out;
109  }
Definition: JSTDTypes.hh:14

Member Data Documentation

◆ comment

JComment JACOUSTICS::JEmitterID::comment

Definition at line 112 of file JEmitterID.hh.


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