Jpp  15.0.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Attributes | Friends | List of all members
JDATABASE::JPBS_t Struct Reference

Product breakdown structure (PBS). More...

#include <JPBS_t.hh>

Inheritance diagram for JDATABASE::JPBS_t:
std::vector< int > JDATABASE::JUPI_t JDETECTOR::JHVCalibration_t JDETECTOR::JPMTThresholdCalibration_t

Public Member Functions

 JPBS_t ()
 Default constructor. More...
 
 JPBS_t (const int i0, const int i1=-1, const int i2=-1, const int i3=-1, const int i4=-1, const int i5=-1, const int i6=-1, const int i7=-1, const int i8=-1, const int i9=-1)
 Constructor. More...
 
 JPBS_t (const std::string &input)
 Constructor. More...
 
const JPBS_tgetPBS () const
 Get PBS. More...
 
bool is_valid () const
 Check validity. More...
 
 ClassDefNV (JPBS_t, 1)
 

Static Public Attributes

static const char DOT = '.'
 Separator between PBS values. More...
 

Friends

bool operator== (const JPBS_t &first, const JPBS_t &second)
 Equality operator. More...
 
bool operator< (const JPBS_t &first, const JPBS_t &second)
 Less-than operator. More...
 
std::istream & operator>> (std::istream &in, JPBS_t &object)
 Read PBS from input stream. More...
 
std::ostream & operator<< (std::ostream &out, const JPBS_t &object)
 Write PBS to output stream. More...
 

Detailed Description

Product breakdown structure (PBS).

The PBS consists of one (or more) integer value(s), separated by JPBS_t::DOT.
The corresponding ASCII format reads "<int>[.<int>]*".

Definition at line 25 of file JPBS_t.hh.

Constructor & Destructor Documentation

JDATABASE::JPBS_t::JPBS_t ( )
inline

Default constructor.

Definition at line 37 of file JPBS_t.hh.

38  {}
JDATABASE::JPBS_t::JPBS_t ( const int  i0,
const int  i1 = -1,
const int  i2 = -1,
const int  i3 = -1,
const int  i4 = -1,
const int  i5 = -1,
const int  i6 = -1,
const int  i7 = -1,
const int  i8 = -1,
const int  i9 = -1 
)
inline

Constructor.

Note that the parsing of arguments terminates at the first occurrence of a negative value.

Parameters
i0PBS number
i1PBS number
i2PBS number
i3PBS number
i4PBS number
i5PBS number
i6PBS number
i7PBS number
i8PBS number
i9PBS number

Definition at line 57 of file JPBS_t.hh.

67  {
68  if (i0 >= 0) { push_back(i0); } else { return; }
69  if (i1 >= 0) { push_back(i1); } else { return; }
70  if (i2 >= 0) { push_back(i2); } else { return; }
71  if (i3 >= 0) { push_back(i3); } else { return; }
72  if (i4 >= 0) { push_back(i4); } else { return; }
73  if (i5 >= 0) { push_back(i5); } else { return; }
74  if (i6 >= 0) { push_back(i6); } else { return; }
75  if (i7 >= 0) { push_back(i7); } else { return; }
76  if (i8 >= 0) { push_back(i8); } else { return; }
77  if (i9 >= 0) { push_back(i9); } else { return; }
78  }
JDATABASE::JPBS_t::JPBS_t ( const std::string &  input)
inline

Constructor.

Parameters
inputinput text

Definition at line 86 of file JPBS_t.hh.

87  {
88  std::istringstream is(input);
89 
90  is >> *this;
91  }
is
Definition: JDAQCHSM.chsm:167

Member Function Documentation

const JPBS_t& JDATABASE::JPBS_t::getPBS ( ) const
inline

Get PBS.

Returns
PBS

Definition at line 99 of file JPBS_t.hh.

100  {
101  return static_cast<const JPBS_t&>(*this);
102  }
Product breakdown structure (PBS).
Definition: JPBS_t.hh:25
bool JDATABASE::JPBS_t::is_valid ( ) const
inline

Check validity.

Returns
true if valid; else false

Definition at line 110 of file JPBS_t.hh.

111  {
112  return !this->empty();
113  }
JDATABASE::JPBS_t::ClassDefNV ( JPBS_t  ,
 
)

Friends And Related Function Documentation

bool operator== ( const JPBS_t first,
const JPBS_t second 
)
friend

Equality operator.

Parameters
firstfirst PBS
secondsecond PBS
Returns
true if PBS is equal; else false

Definition at line 123 of file JPBS_t.hh.

124  {
125  if (first.size() == second.size()) {
126 
127  for (const_iterator p = first.begin(), q = second.begin(); p != first.end(); ++p, ++q) {
128  if (*p != *q) {
129  return false;
130  }
131  }
132 
133  return true;
134  }
135 
136  return false;
137  }
bool operator< ( const JPBS_t first,
const JPBS_t second 
)
friend

Less-than operator.

Parameters
firstfirst PBS
secondsecond PBS
Returns
true if first PBS higher in hierarchy; else false

Definition at line 147 of file JPBS_t.hh.

148  {
149  for (const_iterator p = first.begin(), q = second.begin(); p != first.end() && q != second.end(); ++p, ++q) {
150  if (*p != *q) {
151  return *p < *q;
152  }
153  }
154 
155  return first.size() < second.size();
156  }
std::istream& operator>> ( std::istream &  in,
JPBS_t object 
)
friend

Read PBS from input stream.

Parameters
ininput stream
objectPBS
Returns
input stream

Definition at line 166 of file JPBS_t.hh.

167  {
168  using namespace std;
169 
170  object.clear();
171 
172  int pbs;
173 
174  if (in >> pbs) {
175 
176  object.push_back(pbs);
177 
178  while (in.peek() == (int) JPBS_t::DOT) {
179  if (in.ignore() && in >> pbs)
180  object.push_back(pbs);
181  else
182  in.setstate(ios::failbit);
183  }
184 
185  } else {
186 
187  in.setstate(ios::failbit);
188  }
189 
190  return in;
191  }
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 source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:41
static const char DOT
Separator between PBS values.
Definition: JPBS_t.hh:31
std::ostream& operator<< ( std::ostream &  out,
const JPBS_t object 
)
friend

Write PBS to output stream.

Parameters
outoutput stream
objectPBS
Returns
output stream

Definition at line 201 of file JPBS_t.hh.

202  {
203  using namespace std;
204  using namespace JPP;
205 
206  ostringstream os;
207 
208  if (!object.empty()) {
209 
210  const_iterator i = object.begin();
211 
212  os << *i;
213 
214  while (++i != object.end()) {
215  os << JPBS_t::DOT << *i;
216  }
217  }
218 
219  return out << os.str();
220  }
static const char DOT
Separator between PBS values.
Definition: JPBS_t.hh:31

Member Data Documentation

const char JDATABASE::JPBS_t::DOT = '.'
static

Separator between PBS values.

Definition at line 31 of file JPBS_t.hh.


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