Product breakdown structure (PBS).
More...
#include <JPBS_t.hh>
|
| JPBS_t () |
| Default constructor.
|
|
| 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.
|
|
| JPBS_t (const std::string &input) |
| Constructor.
|
|
const JPBS_t & | getPBS () const |
| Get PBS.
|
|
bool | is_valid () const |
| Check validity.
|
|
| ClassDefNV (JPBS_t, 1) |
|
|
static const char | DOT = '.' |
| Separator between PBS values.
|
|
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 27 of file JPBS_t.hh.
◆ JPBS_t() [1/3]
JDATABASE::JPBS_t::JPBS_t |
( |
| ) |
|
|
inline |
Default constructor.
Definition at line 39 of file JPBS_t.hh.
◆ JPBS_t() [2/3]
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
-
i0 | PBS number |
i1 | PBS number |
i2 | PBS number |
i3 | PBS number |
i4 | PBS number |
i5 | PBS number |
i6 | PBS number |
i7 | PBS number |
i8 | PBS number |
i9 | PBS number |
Definition at line 59 of file JPBS_t.hh.
69 {
70 if (i0 >= 0) { push_back(i0); } else { return; }
71 if (i1 >= 0) { push_back(i1); } else { return; }
72 if (i2 >= 0) { push_back(i2); } else { return; }
73 if (i3 >= 0) { push_back(i3); } else { return; }
74 if (i4 >= 0) { push_back(i4); } else { return; }
75 if (i5 >= 0) { push_back(i5); } else { return; }
76 if (i6 >= 0) { push_back(i6); } else { return; }
77 if (i7 >= 0) { push_back(i7); } else { return; }
78 if (i8 >= 0) { push_back(i8); } else { return; }
79 if (i9 >= 0) { push_back(i9); } else { return; }
80 }
◆ JPBS_t() [3/3]
JDATABASE::JPBS_t::JPBS_t |
( |
const std::string & | input | ) |
|
|
inline |
Constructor.
- Parameters
-
Definition at line 88 of file JPBS_t.hh.
89 {
90 std::istringstream is(input);
91
92 is >> *this;
93 }
◆ getPBS()
const JPBS_t & JDATABASE::JPBS_t::getPBS |
( |
| ) |
const |
|
inline |
Get PBS.
- Returns
- PBS
Definition at line 101 of file JPBS_t.hh.
102 {
103 return static_cast<const JPBS_t&
>(*this);
104 }
JPBS_t()
Default constructor.
◆ is_valid()
bool JDATABASE::JPBS_t::is_valid |
( |
| ) |
const |
|
inline |
Check validity.
- Returns
- true if valid; else false
Definition at line 112 of file JPBS_t.hh.
113 {
114 return !this->empty();
115 }
◆ ClassDefNV()
JDATABASE::JPBS_t::ClassDefNV |
( |
JPBS_t | , |
|
|
1 | ) |
◆ operator==
bool operator== |
( |
const JPBS_t & | first, |
|
|
const JPBS_t & | second ) |
|
friend |
Equality operator.
- Parameters
-
first | first PBS |
second | second PBS |
- Returns
- true if PBS is equal; else false
Definition at line 125 of file JPBS_t.hh.
126 {
127 if (first.size() == second.size()) {
128
129 for (const_iterator p = first.begin(), q = second.begin(); p != first.end(); ++p, ++q) {
130 if (*p != *q) {
131 return false;
132 }
133 }
134
135 return true;
136 }
137
138 return false;
139 }
◆ operator<
bool operator< |
( |
const JPBS_t & | first, |
|
|
const JPBS_t & | second ) |
|
friend |
Less-than operator.
- Parameters
-
first | first PBS |
second | second PBS |
- Returns
- true if first PBS higher in hierarchy; else false
Definition at line 149 of file JPBS_t.hh.
150 {
151 for (const_iterator p = first.begin(), q = second.begin(); p != first.end() && q != second.end(); ++p, ++q) {
152 if (*p != *q) {
153 return *p < *q;
154 }
155 }
156
157 return first.size() < second.size();
158 }
◆ operator>>
std::istream & operator>> |
( |
std::istream & | in, |
|
|
JPBS_t & | object ) |
|
friend |
Read PBS from input stream.
- Parameters
-
- Returns
- input stream
Definition at line 168 of file JPBS_t.hh.
169 {
171
172 object.clear();
173
174 int pbs;
175
176 if (in >> pbs) {
177
178 object.push_back(pbs);
179
181 if (in.ignore() && in >> pbs)
182 object.push_back(pbs);
183 else
184 in.setstate(ios::failbit);
185 }
186
187 } else {
188
189 in.setstate(ios::failbit);
190 }
191
192 return in;
193 }
static const char DOT
Separator between PBS values.
◆ operator<<
std::ostream & operator<< |
( |
std::ostream & | out, |
|
|
const JPBS_t & | object ) |
|
friend |
Write PBS to output stream.
- Parameters
-
out | output stream |
object | PBS |
- Returns
- output stream
Definition at line 203 of file JPBS_t.hh.
204 {
207
208 ostringstream os;
209
210 if (!object.empty()) {
211
212 const_iterator i = object.begin();
213
214 os << *i;
215
216 while (++i != object.end()) {
218 }
219 }
220
221 return out << os.str();
222 }
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
◆ DOT
const char JDATABASE::JPBS_t::DOT = '.' |
|
static |
Separator between PBS values.
Definition at line 33 of file JPBS_t.hh.
The documentation for this struct was generated from the following file: