DP3
ParameterSet.h
Go to the documentation of this file.
1 // ParameterSet.h: Implements a map of Key-Value pairs.
2 //
3 // Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy)
4 // SPDX-License-Identifier: GPL-3.0-or-later
5 
6 #ifndef DP3_COMMON_PARAMETERSET_H_
7 #define DP3_COMMON_PARAMETERSET_H_
8 
9 // Never #include <config.h> or #include <lofar_config.h> in a header file!
10 #include "ParameterSetImpl.h"
11 #include "KVpair.h"
12 
13 namespace dp3 {
14 namespace common {
15 
18 
20 
28 class ParameterSet {
29  public:
32 
37 
41 
44  explicit ParameterSet(bool caseInsensitive);
45 
49  explicit ParameterSet(const std::string& theFilename,
52  explicit ParameterSet(const char* theFilename,
55 
58  explicit ParameterSet(const std::string& theFilename, bool caseInsensitive);
59 
61  ParameterSet(const ParameterSet& that);
62 
66 
68  bool empty() const;
69 
71  int size() const;
72 
74 
75  iterator begin();
76  iterator end();
77  const_iterator begin() const;
78  const_iterator end() const;
80 
83  const ParameterValue& get(const std::string& aKey) const;
84  const ParameterValue& operator[](const std::string& aKey) const;
86 
89 
91  void clear();
92 
96 
101  void adoptFile(const std::string& theFilename,
102  const std::string& thePrefix = "");
103 
108  void adoptBuffer(const std::string& theBuffer,
109  const std::string& thePrefix = "");
110 
116  void adoptCollection(const ParameterSet& theCollection,
117  const std::string& thePrefix = "");
118 
121  void adoptArguments(const std::vector<std::string>& arguments);
123 
127 
129  void writeFile(const std::string& theFilename, bool append = false) const;
130 
133  void writeBuffer(std::string& theBuffer) const;
134 
137  void writeStream(std::ostream& os) const;
139 
144 
152  ParameterSet makeSubset(const std::string& baseKey,
153  const std::string& prefix = "") const;
154 
159  void subtractSubset(const std::string& fullPrefix);
161 
166 
169  void add(const std::string& aKey, const std::string& aValue);
170  void add(const KVpair& aPair);
171 
174  void replace(const std::string& aKey, const std::string& aValue);
175  void replace(const KVpair& aPair);
176 
178  void remove(const std::string& aKey);
180 
187 
189  iterator find(const std::string& searchKey);
190  const_iterator find(const std::string& searchKey) const;
191 
193  bool isDefined(const std::string& searchKey) const;
194 
197  std::string locateModule(const std::string& shortName) const;
198 
202  std::string fullModuleName(const std::string& shortName) const;
203 
206  std::vector<ParameterValue> getVector(const std::string& aKey) const;
207 
210  ParameterRecord getRecord(const std::string& aKey) const;
211 
214  bool getBool(const std::string& aKey) const;
215  bool getBool(const std::string& aKey, bool aValue) const;
216  int getInt(const std::string& aKey) const;
217  int getInt(const std::string& aKey, int aValue) const;
218  unsigned int getUint(const std::string& aKey) const;
219  unsigned int getUint(const std::string& aKey, unsigned int aValue) const;
220  int16_t getInt16(const std::string& aKey) const;
221  int16_t getInt16(const std::string& aKey, int16_t aValue) const;
222  uint16_t getUint16(const std::string& aKey) const;
223  uint16_t getUint16(const std::string& aKey, uint16_t aValue) const;
224  int32_t getInt32(const std::string& aKey) const;
225  int32_t getInt32(const std::string& aKey, int32_t aValue) const;
226  uint32_t getUint32(const std::string& aKey) const;
227  uint32_t getUint32(const std::string& aKey, uint32_t aValue) const;
228  int64_t getInt64(const std::string& aKey) const;
229  int64_t getInt64(const std::string& aKey, int64_t aValue) const;
230  uint64_t getUint64(const std::string& aKey) const;
231  uint64_t getUint64(const std::string& aKey, uint64_t aValue) const;
232  float getFloat(const std::string& aKey) const;
233  float getFloat(const std::string& aKey, float aValue) const;
234  double getDouble(const std::string& aKey) const;
235  double getDouble(const std::string& aKey, double aValue) const;
236  std::string getString(const std::string& aKey) const;
237  std::string getString(const std::string& aKey,
238  const std::string& aValue) const;
241  time_t getTime(const std::string& aKey) const;
242  time_t getTime(const std::string& aKey, const time_t& aValue) const;
245 
248  std::vector<bool> getBoolVector(const std::string& aKey,
249  bool expandable = false) const;
250  std::vector<bool> getBoolVector(const std::string& aKey,
251  const std::vector<bool>& aValue,
252  bool expandable = false) const;
253  std::vector<int> getIntVector(const std::string& aKey,
254  bool expandable = false) const;
255  std::vector<int> getIntVector(const std::string& aKey,
256  const std::vector<int>& aValue,
257  bool expandable = false) const;
258  std::vector<unsigned int> getUintVector(const std::string& aKey,
259  bool expandable = false) const;
260  std::vector<unsigned int> getUintVector(
261  const std::string& aKey, const std::vector<unsigned int>& aValue,
262  bool expandable = false) const;
263  std::vector<int16_t> getInt16Vector(const std::string& aKey,
264  bool expandable = false) const;
265  std::vector<int16_t> getInt16Vector(const std::string& aKey,
266  const std::vector<int16_t>& aValue,
267  bool expandable = false) const;
268  std::vector<uint16_t> getUint16Vector(const std::string& aKey,
269  bool expandable = false) const;
270  std::vector<uint16_t> getUint16Vector(const std::string& aKey,
271  const std::vector<uint16_t>& aValue,
272  bool expandable = false) const;
273  std::vector<int32_t> getInt32Vector(const std::string& aKey,
274  bool expandable = false) const;
275  std::vector<int32_t> getInt32Vector(const std::string& aKey,
276  const std::vector<int32_t>& aValue,
277  bool expandable = false) const;
278  std::vector<uint32_t> getUint32Vector(const std::string& aKey,
279  bool expandable = false) const;
280  std::vector<uint32_t> getUint32Vector(const std::string& aKey,
281  const std::vector<uint32_t>& aValue,
282  bool expandable = false) const;
283  std::vector<int64_t> getInt64Vector(const std::string& aKey,
284  bool expandable = false) const;
285  std::vector<int64_t> getInt64Vector(const std::string& aKey,
286  const std::vector<int64_t>& aValue,
287  bool expandable = false) const;
288  std::vector<uint64_t> getUint64Vector(const std::string& aKey,
289  bool expandable = false) const;
290  std::vector<uint64_t> getUint64Vector(const std::string& aKey,
291  const std::vector<uint64_t>& aValue,
292  bool expandable = false) const;
293  std::vector<size_t> getSizeTVector(const std::string& aKey,
294  bool expandable = false) const {
295  static_assert(sizeof(size_t) == 8 || sizeof(size_t) == 4);
296  // Lambda is necessary because returning the wrong type won't compile in the
297  // main function, even when inside a if constexpr.
298  auto pick_overload = [&](const std::string& aKey, bool expandable = false) {
299  if constexpr (sizeof(size_t) == 8) {
300  return getUint64Vector(aKey, expandable);
301  } else if constexpr (sizeof(size_t) == 4) {
302  return getUint32Vector(aKey, expandable);
303  }
304  };
305  return pick_overload(aKey, expandable);
306  }
307  std::vector<float> getFloatVector(const std::string& aKey,
308  bool expandable = false) const;
309  std::vector<float> getFloatVector(const std::string& aKey,
310  const std::vector<float>& aValue,
311  bool expandable = false) const;
312  std::vector<double> getDoubleVector(const std::string& aKey,
313  bool expandable = false) const;
314  std::vector<double> getDoubleVector(const std::string& aKey,
315  const std::vector<double>& aValue,
316  bool expandable = false) const;
317  std::vector<std::string> getStringVector(const std::string& aKey,
318  bool expandable = false) const;
319  std::vector<std::string> getStringVector(
320  const std::string& aKey, const std::vector<std::string>& aValue,
321  bool expandable = false) const;
322  std::vector<time_t> getTimeVector(const std::string& aKey,
323  bool expandable = false) const;
324  std::vector<time_t> getTimeVector(const std::string& aKey,
325  const std::vector<time_t>& aValue,
326  bool expandable = false) const;
328 
330 
333  std::vector<std::string> unusedKeys() const;
334 
338 
340  friend std::ostream& operator<<(std::ostream& os, const ParameterSet& thePS);
342 
343  private:
345  explicit ParameterSet(const std::shared_ptr<ParameterSetImpl>& set) {
346  itsSet = set;
347  }
348 
349  std::shared_ptr<ParameterSetImpl> itsSet;
350 };
351 
352 //
353 // ---------- inline functions ----------
354 //
355 inline bool ParameterSet::empty() const { return itsSet->empty(); }
356 inline int ParameterSet::size() const { return itsSet->size(); }
357 inline ParameterSet::iterator ParameterSet::begin() { return itsSet->begin(); }
358 inline ParameterSet::iterator ParameterSet::end() { return itsSet->end(); }
360  return itsSet->begin();
361 }
363  return itsSet->end();
364 }
365 
366 inline const ParameterValue& ParameterSet::get(const std::string& aKey) const {
367  return itsSet->get(aKey);
368 }
370  const std::string& aKey) const {
371  return itsSet->get(aKey);
372 }
373 
375  return itsSet->keyCompareMode();
376 }
377 
378 inline void ParameterSet::clear() { itsSet->clear(); }
379 
380 inline void ParameterSet::adoptFile(const std::string& theFilename,
381  const std::string& thePrefix) {
382  itsSet->adoptFile(theFilename, thePrefix);
383 }
384 
385 inline void ParameterSet::adoptBuffer(const std::string& theBuffer,
386  const std::string& thePrefix) {
387  itsSet->adoptBuffer(theBuffer, thePrefix);
388 }
389 
390 inline void ParameterSet::adoptCollection(const ParameterSet& theCollection,
391  const std::string& thePrefix) {
392  itsSet->adoptCollection(*theCollection.itsSet, thePrefix);
393 }
394 
396  const std::vector<std::string>& arguments) {
397  itsSet->adoptArguments(arguments);
398 }
399 
400 inline void ParameterSet::writeFile(const std::string& theFilename,
401  bool append) const {
402  itsSet->writeFile(theFilename, append);
403 }
404 
405 inline void ParameterSet::writeBuffer(std::string& theBuffer) const {
406  itsSet->writeBuffer(theBuffer);
407 }
408 
409 inline void ParameterSet::writeStream(std::ostream& os) const {
410  itsSet->writeStream(os);
411 }
412 
413 inline ParameterSet ParameterSet::makeSubset(const std::string& baseKey,
414  const std::string& prefix) const {
415  return ParameterSet(itsSet->makeSubset(baseKey, prefix));
416 }
417 
418 inline void ParameterSet::subtractSubset(const std::string& fullPrefix) {
419  itsSet->subtractSubset(fullPrefix);
420 }
421 
422 inline void ParameterSet::add(const std::string& aKey,
423  const std::string& aValue) {
424  itsSet->add(aKey, ParameterValue(aValue, false));
425 }
426 inline void ParameterSet::add(const KVpair& aPair) {
427  add(aPair.first, aPair.second);
428 }
429 
430 inline void ParameterSet::replace(const std::string& aKey,
431  const std::string& aValue) {
432  itsSet->replace(aKey, ParameterValue(aValue, false));
433 }
434 inline void ParameterSet::replace(const KVpair& aPair) {
435  replace(aPair.first, aPair.second);
436 }
437 
438 inline void ParameterSet::remove(const std::string& aKey) {
439  itsSet->remove(aKey);
440 }
441 
442 inline ParameterSet::iterator ParameterSet::find(const std::string& searchKey) {
443  return itsSet->find(searchKey);
444 }
445 
447  const std::string& searchKey) const {
448  return itsSet->find(searchKey);
449 }
450 
451 inline bool ParameterSet::isDefined(const std::string& searchKey) const {
452  return itsSet->isDefined(searchKey);
453 }
454 
455 inline std::string ParameterSet::locateModule(
456  const std::string& shortName) const {
457  return (itsSet->locateModule(shortName));
458 }
459 
460 inline std::string ParameterSet::fullModuleName(
461  const std::string& shortName) const {
462  return (itsSet->fullModuleName(shortName));
463 }
464 
465 inline std::vector<ParameterValue> ParameterSet::getVector(
466  const std::string& aKey) const {
467  return get(aKey).getVector();
468 }
469 
470 // getBool(key)
471 inline bool ParameterSet::getBool(const std::string& aKey) const {
472  return itsSet->getBool(aKey);
473 }
474 
475 // getBool(key, value), where value is returned when the key is not found
476 inline bool ParameterSet::getBool(const std::string& aKey, bool aValue) const {
477  return itsSet->getBool(aKey, aValue);
478 }
479 
480 // getInt(key)
481 inline int ParameterSet::getInt(const std::string& aKey) const {
482  return itsSet->getInt(aKey);
483 }
484 
485 // getInt(key, value), where value is returned when the key is not found
486 inline int ParameterSet::getInt(const std::string& aKey, int aValue) const {
487  return itsSet->getInt(aKey, aValue);
488 }
489 
490 // getUint(key)
491 inline unsigned int ParameterSet::getUint(const std::string& aKey) const {
492  return itsSet->getUint(aKey);
493 }
494 
495 // getUint(key, value), where value is returned when the key is not found
496 inline unsigned int ParameterSet::getUint(const std::string& aKey,
497  unsigned int aValue) const {
498  return itsSet->getUint(aKey, aValue);
499 }
500 
501 // getInt16(key)
502 inline int16_t ParameterSet::getInt16(const std::string& aKey) const {
503  return itsSet->getInt16(aKey);
504 }
505 
506 // getInt16(key, value), where value is returned when the key is not found
507 inline int16_t ParameterSet::getInt16(const std::string& aKey,
508  int16_t aValue) const {
509  return itsSet->getInt16(aKey, aValue);
510 }
511 
512 // getUint16(key)
513 inline uint16_t ParameterSet::getUint16(const std::string& aKey) const {
514  return itsSet->getUint16(aKey);
515 }
516 
517 // getUint16(key, value), where value is returned when the key is not found
518 inline uint16_t ParameterSet::getUint16(const std::string& aKey,
519  uint16_t aValue) const {
520  return itsSet->getUint16(aKey, aValue);
521 }
522 
523 // getInt32(key)
524 inline int32_t ParameterSet::getInt32(const std::string& aKey) const {
525  return itsSet->getInt32(aKey);
526 }
527 
528 // getInt32(key, value), where value is returned when the key is not found
529 inline int32_t ParameterSet::getInt32(const std::string& aKey,
530  int32_t aValue) const {
531  return itsSet->getInt32(aKey, aValue);
532 }
533 
534 // getUint32(key)
535 inline uint32_t ParameterSet::getUint32(const std::string& aKey) const {
536  return itsSet->getUint32(aKey);
537 }
538 
539 // getUint32(key, value), where value is returned when the key is not found
540 inline uint32_t ParameterSet::getUint32(const std::string& aKey,
541  uint32_t aValue) const {
542  return itsSet->getUint32(aKey, aValue);
543 }
544 
545 // getInt64(key)
546 inline int64_t ParameterSet::getInt64(const std::string& aKey) const {
547  return itsSet->getInt64(aKey);
548 }
549 
550 // getInt64(key, value), where value is returned when the key is not found
551 inline int64_t ParameterSet::getInt64(const std::string& aKey,
552  int64_t aValue) const {
553  return itsSet->getInt64(aKey, aValue);
554 }
555 
556 // getUint64(key)
557 inline uint64_t ParameterSet::getUint64(const std::string& aKey) const {
558  return itsSet->getUint64(aKey);
559 }
560 
561 // getUint64(key, value), where value is returned when the key is not found
562 inline uint64_t ParameterSet::getUint64(const std::string& aKey,
563  uint64_t aValue) const {
564  return itsSet->getUint64(aKey, aValue);
565 }
566 
567 // getFloat(key)
568 inline float ParameterSet::getFloat(const std::string& aKey) const {
569  return itsSet->getFloat(aKey);
570 }
571 
572 // getFloat(key, value), where value is returned when the key is not found
573 inline float ParameterSet::getFloat(const std::string& aKey,
574  float aValue) const {
575  return itsSet->getFloat(aKey, aValue);
576 }
577 
578 // getDouble(key)
579 inline double ParameterSet::getDouble(const std::string& aKey) const {
580  return itsSet->getDouble(aKey);
581 }
582 
583 // getDouble(key, value), where value is returned when the key is not found
584 inline double ParameterSet::getDouble(const std::string& aKey,
585  double aValue) const {
586  return itsSet->getDouble(aKey, aValue);
587 }
588 
589 // getString(key)
590 inline std::string ParameterSet::getString(const std::string& aKey) const {
591  return itsSet->getString(aKey);
592 }
593 
594 // getString(key, value), where value is returned when the key is not found
595 inline std::string ParameterSet::getString(const std::string& aKey,
596  const std::string& aValue) const {
597  return itsSet->getString(aKey, aValue);
598 }
599 
600 // getTime(key)
601 inline time_t ParameterSet::getTime(const std::string& aKey) const {
602  return itsSet->getTime(aKey);
603 }
604 
605 // getTime(key, value), where value is returned when the key is not found
606 inline time_t ParameterSet::getTime(const std::string& aKey,
607  const time_t& aValue) const {
608  return itsSet->getTime(aKey, aValue);
609 }
610 
611 // getBoolVector(key)
612 inline std::vector<bool> ParameterSet::getBoolVector(const std::string& aKey,
613  bool expandable) const {
614  return itsSet->getBoolVector(aKey, expandable);
615 }
616 
617 // getBoolVector(key, value), where value is returned when the key is not found
618 inline std::vector<bool> ParameterSet::getBoolVector(
619  const std::string& aKey, const std::vector<bool>& aValue,
620  bool expandable) const {
621  return itsSet->getBoolVector(aKey, aValue, expandable);
622 }
623 
624 // getIntVector(key)
625 inline std::vector<int> ParameterSet::getIntVector(const std::string& aKey,
626  bool expandable) const {
627  return itsSet->getIntVector(aKey, expandable);
628 }
629 
630 // getIntVector(key, value), where value is returned when the key is not found
631 inline std::vector<int> ParameterSet::getIntVector(
632  const std::string& aKey, const std::vector<int>& aValue,
633  bool expandable) const {
634  return itsSet->getIntVector(aKey, aValue, expandable);
635 }
636 
637 // getUintVector(key)
638 inline std::vector<unsigned int> ParameterSet::getUintVector(
639  const std::string& aKey, bool expandable) const {
640  return itsSet->getUintVector(aKey, expandable);
641 }
642 
643 // getUintVector(key, value), where value is returned when the key is not found
644 inline std::vector<unsigned int> ParameterSet::getUintVector(
645  const std::string& aKey, const std::vector<unsigned int>& aValue,
646  bool expandable) const {
647  return itsSet->getUintVector(aKey, aValue, expandable);
648 }
649 
650 // getInt16Vector(key)
651 inline std::vector<int16_t> ParameterSet::getInt16Vector(
652  const std::string& aKey, bool expandable) const {
653  return itsSet->getInt16Vector(aKey, expandable);
654 }
655 
656 // getInt16Vector(key, value), where value is returned when key is not found
657 inline std::vector<int16_t> ParameterSet::getInt16Vector(
658  const std::string& aKey, const std::vector<int16_t>& aValue,
659  bool expandable) const {
660  return itsSet->getInt16Vector(aKey, aValue, expandable);
661 }
662 
663 // getUint16Vector(key)
664 inline std::vector<uint16_t> ParameterSet::getUint16Vector(
665  const std::string& aKey, bool expandable) const {
666  return itsSet->getUint16Vector(aKey, expandable);
667 }
668 
669 // getUint16Vector(key, value), where value is returned when key is not found
670 inline std::vector<uint16_t> ParameterSet::getUint16Vector(
671  const std::string& aKey, const std::vector<uint16_t>& aValue,
672  bool expandable) const {
673  return itsSet->getUint16Vector(aKey, aValue, expandable);
674 }
675 
676 // getInt32Vector(key)
677 inline std::vector<int32_t> ParameterSet::getInt32Vector(
678  const std::string& aKey, bool expandable) const {
679  return itsSet->getInt32Vector(aKey, expandable);
680 }
681 
682 // getInt32Vector(key, value), where value is returned when key is not found
683 inline std::vector<int32_t> ParameterSet::getInt32Vector(
684  const std::string& aKey, const std::vector<int32_t>& aValue,
685  bool expandable) const {
686  return itsSet->getInt32Vector(aKey, aValue, expandable);
687 }
688 
689 // getUint32Vector(key)
690 inline std::vector<uint32_t> ParameterSet::getUint32Vector(
691  const std::string& aKey, bool expandable) const {
692  return itsSet->getUint32Vector(aKey, expandable);
693 }
694 
695 // getUint32Vector(key, value), where value is returned when key is not found
696 inline std::vector<uint32_t> ParameterSet::getUint32Vector(
697  const std::string& aKey, const std::vector<uint32_t>& aValue,
698  bool expandable) const {
699  return itsSet->getUint32Vector(aKey, aValue, expandable);
700 }
701 
702 // getInt64Vector(key)
703 inline std::vector<int64_t> ParameterSet::getInt64Vector(
704  const std::string& aKey, bool expandable) const {
705  return itsSet->getInt64Vector(aKey, expandable);
706 }
707 
708 // getInt64Vector(key, value), where value is returned when key is not found
709 inline std::vector<int64_t> ParameterSet::getInt64Vector(
710  const std::string& aKey, const std::vector<int64_t>& aValue,
711  bool expandable) const {
712  return itsSet->getInt64Vector(aKey, aValue, expandable);
713 }
714 
715 // getUint64Vector(key)
716 inline std::vector<uint64_t> ParameterSet::getUint64Vector(
717  const std::string& aKey, bool expandable) const {
718  return itsSet->getUint64Vector(aKey, expandable);
719 }
720 
721 // getUint64Vector(key, value), where value is returned when key is not found
722 inline std::vector<uint64_t> ParameterSet::getUint64Vector(
723  const std::string& aKey, const std::vector<uint64_t>& aValue,
724  bool expandable) const {
725  return itsSet->getUint64Vector(aKey, aValue, expandable);
726 }
727 
728 // getFloatVector(key)
729 inline std::vector<float> ParameterSet::getFloatVector(const std::string& aKey,
730  bool expandable) const {
731  return itsSet->getFloatVector(aKey, expandable);
732 }
733 
734 // getFloatVector(key, value), where value is returned when key is not found
735 inline std::vector<float> ParameterSet::getFloatVector(
736  const std::string& aKey, const std::vector<float>& aValue,
737  bool expandable) const {
738  return itsSet->getFloatVector(aKey, aValue, expandable);
739 }
740 
741 // getDoubleVector(key)
742 inline std::vector<double> ParameterSet::getDoubleVector(
743  const std::string& aKey, bool expandable) const {
744  return itsSet->getDoubleVector(aKey, expandable);
745 }
746 // getDoubleVector(key, value), where value is returned when key is not found
747 inline std::vector<double> ParameterSet::getDoubleVector(
748  const std::string& aKey, const std::vector<double>& aValue,
749  bool expandable) const {
750  return itsSet->getDoubleVector(aKey, aValue, expandable);
751 }
752 
753 // getStringVector(key)
754 inline std::vector<std::string> ParameterSet::getStringVector(
755  const std::string& aKey, bool expandable) const {
756  return itsSet->getStringVector(aKey, expandable);
757 }
758 
759 // getStringVector(key, value), where value is returned when key is not found
760 inline std::vector<std::string> ParameterSet::getStringVector(
761  const std::string& aKey, const std::vector<std::string>& aValue,
762  bool expandable) const {
763  return itsSet->getStringVector(aKey, aValue, expandable);
764 }
765 
766 // getTimeVector(key)
767 inline std::vector<time_t> ParameterSet::getTimeVector(const std::string& aKey,
768  bool expandable) const {
769  return itsSet->getTimeVector(aKey, expandable);
770 }
771 
772 // getTimeVector(key, value), where value is returned when key is not found
773 inline std::vector<time_t> ParameterSet::getTimeVector(
774  const std::string& aKey, const std::vector<time_t>& aValue,
775  bool expandable) const {
776  return itsSet->getTimeVector(aKey, aValue, expandable);
777 }
778 
779 inline std::vector<std::string> ParameterSet::unusedKeys() const {
780  return itsSet->unusedKeys();
781 }
782 
783 } // namespace common
784 } // namespace dp3
785 
786 #endif
Implements a KV pair as a pair<string, string>.
Definition: KVpair.h:24
A record of parameter values. The only difference with a ParameterSet is the output operator.
Definition: ParameterRecord.h:16
KVMap::iterator iterator
Definition: ParameterSetImpl.h:53
KVMap::const_iterator const_iterator
Definition: ParameterSetImpl.h:54
Implements a map of Key-Value pairs.
Definition: ParameterSet.h:28
KeyCompare::Mode keyCompareMode() const
Key comparison mode.
Definition: ParameterSet.h:374
std::vector< int > getIntVector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:625
uint16_t getUint16(const std::string &aKey) const
Definition: ParameterSet.h:513
void adoptArguments(const std::vector< std::string > &arguments)
Definition: ParameterSet.h:395
void writeFile(const std::string &theFilename, bool append=false) const
Writes the Key-Values pair from the current ParCollection to the file.
Definition: ParameterSet.h:400
std::string fullModuleName(const std::string &shortName) const
Definition: ParameterSet.h:460
ParameterSet(const std::string &theFilename, KeyCompare::Mode=KeyCompare::NORMAL)
void adoptFile(const std::string &theFilename, const std::string &thePrefix="")
Definition: ParameterSet.h:380
bool isDefined(const std::string &searchKey) const
Checks if the given Key is defined in the ParameterSet.
Definition: ParameterSet.h:451
std::vector< std::string > getStringVector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:754
iterator find(const std::string &searchKey)
Find a key.
Definition: ParameterSet.h:442
bool empty() const
Is the set empty?
Definition: ParameterSet.h:355
std::vector< uint64_t > getUint64Vector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:716
std::vector< double > getDoubleVector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:742
ParameterSet makeSubset(const std::string &baseKey, const std::string &prefix="") const
Definition: ParameterSet.h:413
std::vector< std::string > unusedKeys() const
Definition: ParameterSet.h:779
int16_t getInt16(const std::string &aKey) const
Definition: ParameterSet.h:502
void writeBuffer(std::string &theBuffer) const
Definition: ParameterSet.h:405
void replace(const std::string &aKey, const std::string &aValue)
Definition: ParameterSet.h:430
std::vector< unsigned int > getUintVector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:638
float getFloat(const std::string &aKey) const
Definition: ParameterSet.h:568
ParameterSetImpl::const_iterator const_iterator
Definition: ParameterSet.h:31
std::vector< size_t > getSizeTVector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:293
std::vector< int16_t > getInt16Vector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:651
std::string locateModule(const std::string &shortName) const
Definition: ParameterSet.h:455
void remove(const std::string &aKey)
Removes the pair with the given key. Removing a non-existing key is ok.
Definition: ParameterSet.h:438
unsigned int getUint(const std::string &aKey) const
Definition: ParameterSet.h:491
time_t getTime(const std::string &aKey) const
Definition: ParameterSet.h:601
std::vector< float > getFloatVector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:729
void add(const std::string &aKey, const std::string &aValue)
Definition: ParameterSet.h:422
std::vector< ParameterValue > getVector(const std::string &aKey) const
Definition: ParameterSet.h:465
ParameterSet(KeyCompare::Mode mode=KeyCompare::NORMAL)
const ParameterValue & operator[](const std::string &aKey) const
Definition: ParameterSet.h:369
ParameterSet(const std::string &theFilename, bool caseInsensitive)
std::vector< uint32_t > getUint32Vector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:690
std::vector< time_t > getTimeVector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:767
int32_t getInt32(const std::string &aKey) const
Definition: ParameterSet.h:524
std::vector< uint16_t > getUint16Vector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:664
int size() const
Get the number of parameters.
Definition: ParameterSet.h:356
std::vector< int32_t > getInt32Vector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:677
uint32_t getUint32(const std::string &aKey) const
Definition: ParameterSet.h:535
ParameterRecord getRecord(const std::string &aKey) const
bool getBool(const std::string &aKey) const
Definition: ParameterSet.h:471
int64_t getInt64(const std::string &aKey) const
Definition: ParameterSet.h:546
void clear()
Clear the set.
Definition: ParameterSet.h:378
const ParameterValue & get(const std::string &aKey) const
Definition: ParameterSet.h:366
uint64_t getUint64(const std::string &aKey) const
Definition: ParameterSet.h:557
std::vector< int64_t > getInt64Vector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:703
ParameterSet(bool caseInsensitive)
iterator begin()
Iteration.
Definition: ParameterSet.h:357
void writeStream(std::ostream &os) const
Definition: ParameterSet.h:409
ParameterSet(const ParameterSet &that)
Copying is allowed.
ParameterSet & operator=(const ParameterSet &that)
Copying is allowed.
void adoptCollection(const ParameterSet &theCollection, const std::string &thePrefix="")
Definition: ParameterSet.h:390
int getInt(const std::string &aKey) const
Definition: ParameterSet.h:481
std::vector< bool > getBoolVector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:612
void subtractSubset(const std::string &fullPrefix)
Definition: ParameterSet.h:418
double getDouble(const std::string &aKey) const
Definition: ParameterSet.h:579
iterator end()
Definition: ParameterSet.h:358
friend std::ostream & operator<<(std::ostream &os, const ParameterSet &thePS)
Allow printing the whole parameter collection.
ParameterSetImpl::iterator iterator
Definition: ParameterSet.h:30
void adoptBuffer(const std::string &theBuffer, const std::string &thePrefix="")
Definition: ParameterSet.h:385
ParameterSet(const char *theFilename, KeyCompare::Mode=KeyCompare::NORMAL)
This one is needed to avoid problems with the bool constructor above.
std::string getString(const std::string &aKey) const
Definition: ParameterSet.h:590
The value of a parameter.
Definition: ParameterValue.h:24
std::vector< ParameterValue > getVector() const
Get the parameter value as a vector of ParameterValues.
Mode
String comparison mode.
Definition: StringTools.h:46
@ NORMAL
Definition: StringTools.h:46
This file has generic helper routines for testing steps.
Definition: AntennaConfig.h:53