Router for mapping of string identifier to index.
More...
#include <JStringRouter.hh>
|
JHashEvaluator | getValue |
| Function object for evaluation of element.
|
|
Router for mapping of string identifier to index.
Definition at line 21 of file JStringRouter.hh.
◆ value_type
◆ evaluator_type
◆ container_type
◆ const_iterator
◆ const_reverse_iterator
◆ iterator
◆ reverse_iterator
◆ JStringRouter()
JDETECTOR::JStringRouter::JStringRouter |
( |
const JDetector & | detector | ) |
|
|
inline |
Constructor.
- Parameters
-
Definition at line 29 of file JStringRouter.hh.
30 {
31 for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
32 this->
insert(module->getString());
33 }
34 }
◆ clear()
Clear.
Definition at line 108 of file JHashCollection.hh.
109 {
112 }
113
114 container_type::clear();
115 }
◆ swap()
Swap hash collection.
- Parameters
-
collection | hash collection |
Definition at line 123 of file JHashCollection.hh.
124 {
125 router.swap(collection.router);
126
127 container_type::swap(collection);
128 }
◆ find() [1/2]
Find element with given value.
- Parameters
-
- Returns
- position of element with given value or end()
Definition at line 138 of file JHashCollection.hh.
139 {
140 const int ival = this->
getValue(value);
141
143 return this->begin() +
router.get(ival);
144 else
145 return this->end();
146 }
◆ find() [2/2]
Find element with given value.
- Parameters
-
- Returns
- position of element with given value or end()
Definition at line 156 of file JHashCollection.hh.
157 {
158 const int ival = this->
getValue(value);
159
161 return this->begin() +
router.get(ival);
162 else
163 return this->end();
164 }
◆ get() [1/2]
Get element with given value.
This method will throw an exception if given value is not present following the prerequisite of constness.
- Parameters
-
- Returns
- element
Definition at line 176 of file JHashCollection.hh.
177 {
178 const int ival = this->
getValue(value);
179
182 }
183
184 return container_type::operator[](
router.get(ival)).second;
185 }
◆ get() [2/2]
Get element with given value.
This method will throw an exception if given value is not present following the prerequisite of constness.
- Parameters
-
- Returns
- element
Definition at line 197 of file JHashCollection.hh.
198 {
199 const int ival = this->
getValue(value);
200
202 return container_type::operator[](
router.get(ival)).second;
203 }
204
205 THROW(JIndexOutOfRange,
"JHashCollection::get(): invalid value.");
206 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
◆ insert() [1/2]
Insert element.
- Parameters
-
- Returns
- true if inserted; else false
Definition at line 215 of file JHashCollection.hh.
216 {
217 const int ival = this->
getValue(element);
218
220
221 container_type::push_back(element);
222
223 router.put(ival, this->size() - 1);
224
225 return true;
226 }
227
228 return false;
229 }
◆ insert() [2/2]
Insert values.
- Parameters
-
__begin | begin of values |
__end | end of values |
Definition at line 239 of file JHashCollection.hh.
240 {
241 for (T i = __begin; i != __end; ++i) {
243 }
244 }
◆ erase() [1/3]
Erase element at given position.
- Parameters
-
Definition at line 252 of file JHashCollection.hh.
253 {
255
256 for (
iterator i = container_type::erase(pos); i != this->end(); ++i) {
258 }
259 }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
◆ erase() [2/3]
Erase elements in given range.
- Parameters
-
__begin | begin position (included) |
__end | end position (excluded) |
Definition at line 268 of file JHashCollection.hh.
269 {
270 for (
iterator i = __begin; i != __end; ++i) {
272 }
273
274 for (
iterator i = container_type::erase(__begin, __end); i != this->end(); ++i) {
276 }
277 }
◆ erase() [3/3]
Erase element with given value.
- Parameters
-
- Returns
- true if element has been erased; else false
Definition at line 287 of file JHashCollection.hh.
288 {
289 const int ival = this->
getValue(value);
290
292
294
295 return true;
296 }
297
298 return false;
299 }
◆ has()
Test whether given value is present.
- Parameters
-
- Returns
- true if present; else false
Definition at line 309 of file JHashCollection.hh.
◆ getIndex()
◆ operator[]()
◆ assign()
◆ resize()
◆ push_back()
◆ pop_back()
◆ getValue
◆ router
The documentation for this struct was generated from the following file: