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 #include "blob/BlobIStream.h"
10 #include "blob/BlobOStream.h"
11 
12 // Never #include <config.h> or #include <lofar_config.h> in a header file!
13 #include "ParameterSetImpl.h"
14 #include "KVpair.h"
15 
16 namespace dp3 {
17 namespace common {
18 
21 
23 
31 class ParameterSet {
32  public:
35 
40 
44 
47  explicit ParameterSet(bool caseInsensitive);
48 
52  explicit ParameterSet(const std::string& theFilename,
55  explicit ParameterSet(const char* theFilename,
58 
61  explicit ParameterSet(const std::string& theFilename, bool caseInsensitive);
62 
64  ParameterSet(const ParameterSet& that);
65 
69 
71  bool empty() const;
72 
74  int size() const;
75 
77 
78  iterator begin();
79  iterator end();
80  const_iterator begin() const;
81  const_iterator end() const;
83 
86  const ParameterValue& get(const std::string& aKey) const;
87  const ParameterValue& operator[](const std::string& aKey) const;
89 
92 
94  void clear();
95 
99 
104  void adoptFile(const std::string& theFilename,
105  const std::string& thePrefix = "");
106 
111  void adoptBuffer(const std::string& theBuffer,
112  const std::string& thePrefix = "");
113 
119  void adoptCollection(const ParameterSet& theCollection,
120  const std::string& thePrefix = "");
121 
124  void adoptArguments(const std::vector<std::string>& arguments);
126 
130 
132  void writeFile(const std::string& theFilename, bool append = false) const;
133 
136  void writeBuffer(std::string& theBuffer) const;
137 
140  void writeStream(std::ostream& os) const;
142 
147 
155  ParameterSet makeSubset(const std::string& baseKey,
156  const std::string& prefix = "") const;
157 
162  void subtractSubset(const std::string& fullPrefix);
164 
169 
172  void add(const std::string& aKey, const std::string& aValue);
173  void add(const KVpair& aPair);
174 
177  void replace(const std::string& aKey, const std::string& aValue);
178  void replace(const KVpair& aPair);
179 
181  void remove(const std::string& aKey);
183 
190 
192  iterator find(const std::string& searchKey);
193  const_iterator find(const std::string& searchKey) const;
194 
196  bool isDefined(const std::string& searchKey) const;
197 
200  std::string locateModule(const std::string& shortName) const;
201 
205  std::string fullModuleName(const std::string& shortName) const;
206 
209  std::vector<ParameterValue> getVector(const std::string& aKey) const;
210 
213  ParameterRecord getRecord(const std::string& aKey) const;
214 
217  bool getBool(const std::string& aKey) const;
218  bool getBool(const std::string& aKey, bool aValue) const;
219  int getInt(const std::string& aKey) const;
220  int getInt(const std::string& aKey, int aValue) const;
221  unsigned int getUint(const std::string& aKey) const;
222  unsigned int getUint(const std::string& aKey, unsigned int aValue) const;
223  int16_t getInt16(const std::string& aKey) const;
224  int16_t getInt16(const std::string& aKey, int16_t aValue) const;
225  uint16_t getUint16(const std::string& aKey) const;
226  uint16_t getUint16(const std::string& aKey, uint16_t aValue) const;
227  int32_t getInt32(const std::string& aKey) const;
228  int32_t getInt32(const std::string& aKey, int32_t aValue) const;
229  uint32_t getUint32(const std::string& aKey) const;
230  uint32_t getUint32(const std::string& aKey, uint32_t aValue) const;
231  int64_t getInt64(const std::string& aKey) const;
232  int64_t getInt64(const std::string& aKey, int64_t aValue) const;
233  uint64_t getUint64(const std::string& aKey) const;
234  uint64_t getUint64(const std::string& aKey, uint64_t aValue) const;
235  float getFloat(const std::string& aKey) const;
236  float getFloat(const std::string& aKey, float aValue) const;
237  double getDouble(const std::string& aKey) const;
238  double getDouble(const std::string& aKey, double aValue) const;
239  std::string getString(const std::string& aKey) const;
240  std::string getString(const std::string& aKey,
241  const std::string& aValue) const;
244  time_t getTime(const std::string& aKey) const;
245  time_t getTime(const std::string& aKey, const time_t& aValue) const;
248 
251  std::vector<bool> getBoolVector(const std::string& aKey,
252  bool expandable = false) const;
253  std::vector<bool> getBoolVector(const std::string& aKey,
254  const std::vector<bool>& aValue,
255  bool expandable = false) const;
256  std::vector<int> getIntVector(const std::string& aKey,
257  bool expandable = false) const;
258  std::vector<int> getIntVector(const std::string& aKey,
259  const std::vector<int>& aValue,
260  bool expandable = false) const;
261  std::vector<unsigned int> getUintVector(const std::string& aKey,
262  bool expandable = false) const;
263  std::vector<unsigned int> getUintVector(
264  const std::string& aKey, const std::vector<unsigned int>& aValue,
265  bool expandable = false) const;
266  std::vector<int16_t> getInt16Vector(const std::string& aKey,
267  bool expandable = false) const;
268  std::vector<int16_t> getInt16Vector(const std::string& aKey,
269  const std::vector<int16_t>& aValue,
270  bool expandable = false) const;
271  std::vector<uint16_t> getUint16Vector(const std::string& aKey,
272  bool expandable = false) const;
273  std::vector<uint16_t> getUint16Vector(const std::string& aKey,
274  const std::vector<uint16_t>& aValue,
275  bool expandable = false) const;
276  std::vector<int32_t> getInt32Vector(const std::string& aKey,
277  bool expandable = false) const;
278  std::vector<int32_t> getInt32Vector(const std::string& aKey,
279  const std::vector<int32_t>& aValue,
280  bool expandable = false) const;
281  std::vector<uint32_t> getUint32Vector(const std::string& aKey,
282  bool expandable = false) const;
283  std::vector<uint32_t> getUint32Vector(const std::string& aKey,
284  const std::vector<uint32_t>& aValue,
285  bool expandable = false) const;
286  std::vector<int64_t> getInt64Vector(const std::string& aKey,
287  bool expandable = false) const;
288  std::vector<int64_t> getInt64Vector(const std::string& aKey,
289  const std::vector<int64_t>& aValue,
290  bool expandable = false) const;
291  std::vector<uint64_t> getUint64Vector(const std::string& aKey,
292  bool expandable = false) const;
293  std::vector<uint64_t> getUint64Vector(const std::string& aKey,
294  const std::vector<uint64_t>& aValue,
295  bool expandable = false) const;
296  std::vector<size_t> getSizeTVector(const std::string& aKey,
297  bool expandable = false) const {
298  static_assert(sizeof(size_t) == 8 || sizeof(size_t) == 4);
299  // Lambda is necessary because returning the wrong type won't compile in the
300  // main function, even when inside a if constexpr.
301  auto pick_overload = [&](const std::string& aKey, bool expandable = false) {
302  if constexpr (sizeof(size_t) == 8) {
303  return getUint64Vector(aKey, expandable);
304  } else if constexpr (sizeof(size_t) == 4) {
305  return getUint32Vector(aKey, expandable);
306  }
307  };
308  return pick_overload(aKey, expandable);
309  }
310  std::vector<float> getFloatVector(const std::string& aKey,
311  bool expandable = false) const;
312  std::vector<float> getFloatVector(const std::string& aKey,
313  const std::vector<float>& aValue,
314  bool expandable = false) const;
315  std::vector<double> getDoubleVector(const std::string& aKey,
316  bool expandable = false) const;
317  std::vector<double> getDoubleVector(const std::string& aKey,
318  const std::vector<double>& aValue,
319  bool expandable = false) const;
320  std::vector<std::string> getStringVector(const std::string& aKey,
321  bool expandable = false) const;
322  std::vector<std::string> getStringVector(
323  const std::string& aKey, const std::vector<std::string>& aValue,
324  bool expandable = false) const;
325  std::vector<time_t> getTimeVector(const std::string& aKey,
326  bool expandable = false) const;
327  std::vector<time_t> getTimeVector(const std::string& aKey,
328  const std::vector<time_t>& aValue,
329  bool expandable = false) const;
331 
333 
336  std::vector<std::string> unusedKeys() const;
337 
341 
343  friend std::ostream& operator<<(std::ostream& os, const ParameterSet& thePS);
345 
346  private:
348  explicit ParameterSet(const std::shared_ptr<ParameterSetImpl>& set) {
349  itsSet = set;
350  }
351 
352  std::shared_ptr<ParameterSetImpl> itsSet;
353 };
354 
360 
361 //
362 // ---------- inline functions ----------
363 //
364 inline bool ParameterSet::empty() const { return itsSet->empty(); }
365 inline int ParameterSet::size() const { return itsSet->size(); }
366 inline ParameterSet::iterator ParameterSet::begin() { return itsSet->begin(); }
367 inline ParameterSet::iterator ParameterSet::end() { return itsSet->end(); }
369  return itsSet->begin();
370 }
372  return itsSet->end();
373 }
374 
375 inline const ParameterValue& ParameterSet::get(const std::string& aKey) const {
376  return itsSet->get(aKey);
377 }
379  const std::string& aKey) const {
380  return itsSet->get(aKey);
381 }
382 
384  return itsSet->keyCompareMode();
385 }
386 
387 inline void ParameterSet::clear() { itsSet->clear(); }
388 
389 inline void ParameterSet::adoptFile(const std::string& theFilename,
390  const std::string& thePrefix) {
391  itsSet->adoptFile(theFilename, thePrefix);
392 }
393 
394 inline void ParameterSet::adoptBuffer(const std::string& theBuffer,
395  const std::string& thePrefix) {
396  itsSet->adoptBuffer(theBuffer, thePrefix);
397 }
398 
399 inline void ParameterSet::adoptCollection(const ParameterSet& theCollection,
400  const std::string& thePrefix) {
401  itsSet->adoptCollection(*theCollection.itsSet, thePrefix);
402 }
403 
405  const std::vector<std::string>& arguments) {
406  itsSet->adoptArguments(arguments);
407 }
408 
409 inline void ParameterSet::writeFile(const std::string& theFilename,
410  bool append) const {
411  itsSet->writeFile(theFilename, append);
412 }
413 
414 inline void ParameterSet::writeBuffer(std::string& theBuffer) const {
415  itsSet->writeBuffer(theBuffer);
416 }
417 
418 inline void ParameterSet::writeStream(std::ostream& os) const {
419  itsSet->writeStream(os);
420 }
421 
422 inline ParameterSet ParameterSet::makeSubset(const std::string& baseKey,
423  const std::string& prefix) const {
424  return ParameterSet(itsSet->makeSubset(baseKey, prefix));
425 }
426 
427 inline void ParameterSet::subtractSubset(const std::string& fullPrefix) {
428  itsSet->subtractSubset(fullPrefix);
429 }
430 
431 inline void ParameterSet::add(const std::string& aKey,
432  const std::string& aValue) {
433  itsSet->add(aKey, ParameterValue(aValue, false));
434 }
435 inline void ParameterSet::add(const KVpair& aPair) {
436  add(aPair.first, aPair.second);
437 }
438 
439 inline void ParameterSet::replace(const std::string& aKey,
440  const std::string& aValue) {
441  itsSet->replace(aKey, ParameterValue(aValue, false));
442 }
443 inline void ParameterSet::replace(const KVpair& aPair) {
444  replace(aPair.first, aPair.second);
445 }
446 
447 inline void ParameterSet::remove(const std::string& aKey) {
448  itsSet->remove(aKey);
449 }
450 
451 inline ParameterSet::iterator ParameterSet::find(const std::string& searchKey) {
452  return itsSet->find(searchKey);
453 }
454 
456  const std::string& searchKey) const {
457  return itsSet->find(searchKey);
458 }
459 
460 inline bool ParameterSet::isDefined(const std::string& searchKey) const {
461  return itsSet->isDefined(searchKey);
462 }
463 
464 inline std::string ParameterSet::locateModule(
465  const std::string& shortName) const {
466  return (itsSet->locateModule(shortName));
467 }
468 
469 inline std::string ParameterSet::fullModuleName(
470  const std::string& shortName) const {
471  return (itsSet->fullModuleName(shortName));
472 }
473 
474 inline std::vector<ParameterValue> ParameterSet::getVector(
475  const std::string& aKey) const {
476  return get(aKey).getVector();
477 }
478 
479 // getBool(key)
480 inline bool ParameterSet::getBool(const std::string& aKey) const {
481  return itsSet->getBool(aKey);
482 }
483 
484 // getBool(key, value), where value is returned when the key is not found
485 inline bool ParameterSet::getBool(const std::string& aKey, bool aValue) const {
486  return itsSet->getBool(aKey, aValue);
487 }
488 
489 // getInt(key)
490 inline int ParameterSet::getInt(const std::string& aKey) const {
491  return itsSet->getInt(aKey);
492 }
493 
494 // getInt(key, value), where value is returned when the key is not found
495 inline int ParameterSet::getInt(const std::string& aKey, int aValue) const {
496  return itsSet->getInt(aKey, aValue);
497 }
498 
499 // getUint(key)
500 inline unsigned int ParameterSet::getUint(const std::string& aKey) const {
501  return itsSet->getUint(aKey);
502 }
503 
504 // getUint(key, value), where value is returned when the key is not found
505 inline unsigned int ParameterSet::getUint(const std::string& aKey,
506  unsigned int aValue) const {
507  return itsSet->getUint(aKey, aValue);
508 }
509 
510 // getInt16(key)
511 inline int16_t ParameterSet::getInt16(const std::string& aKey) const {
512  return itsSet->getInt16(aKey);
513 }
514 
515 // getInt16(key, value), where value is returned when the key is not found
516 inline int16_t ParameterSet::getInt16(const std::string& aKey,
517  int16_t aValue) const {
518  return itsSet->getInt16(aKey, aValue);
519 }
520 
521 // getUint16(key)
522 inline uint16_t ParameterSet::getUint16(const std::string& aKey) const {
523  return itsSet->getUint16(aKey);
524 }
525 
526 // getUint16(key, value), where value is returned when the key is not found
527 inline uint16_t ParameterSet::getUint16(const std::string& aKey,
528  uint16_t aValue) const {
529  return itsSet->getUint16(aKey, aValue);
530 }
531 
532 // getInt32(key)
533 inline int32_t ParameterSet::getInt32(const std::string& aKey) const {
534  return itsSet->getInt32(aKey);
535 }
536 
537 // getInt32(key, value), where value is returned when the key is not found
538 inline int32_t ParameterSet::getInt32(const std::string& aKey,
539  int32_t aValue) const {
540  return itsSet->getInt32(aKey, aValue);
541 }
542 
543 // getUint32(key)
544 inline uint32_t ParameterSet::getUint32(const std::string& aKey) const {
545  return itsSet->getUint32(aKey);
546 }
547 
548 // getUint32(key, value), where value is returned when the key is not found
549 inline uint32_t ParameterSet::getUint32(const std::string& aKey,
550  uint32_t aValue) const {
551  return itsSet->getUint32(aKey, aValue);
552 }
553 
554 // getInt64(key)
555 inline int64_t ParameterSet::getInt64(const std::string& aKey) const {
556  return itsSet->getInt64(aKey);
557 }
558 
559 // getInt64(key, value), where value is returned when the key is not found
560 inline int64_t ParameterSet::getInt64(const std::string& aKey,
561  int64_t aValue) const {
562  return itsSet->getInt64(aKey, aValue);
563 }
564 
565 // getUint64(key)
566 inline uint64_t ParameterSet::getUint64(const std::string& aKey) const {
567  return itsSet->getUint64(aKey);
568 }
569 
570 // getUint64(key, value), where value is returned when the key is not found
571 inline uint64_t ParameterSet::getUint64(const std::string& aKey,
572  uint64_t aValue) const {
573  return itsSet->getUint64(aKey, aValue);
574 }
575 
576 // getFloat(key)
577 inline float ParameterSet::getFloat(const std::string& aKey) const {
578  return itsSet->getFloat(aKey);
579 }
580 
581 // getFloat(key, value), where value is returned when the key is not found
582 inline float ParameterSet::getFloat(const std::string& aKey,
583  float aValue) const {
584  return itsSet->getFloat(aKey, aValue);
585 }
586 
587 // getDouble(key)
588 inline double ParameterSet::getDouble(const std::string& aKey) const {
589  return itsSet->getDouble(aKey);
590 }
591 
592 // getDouble(key, value), where value is returned when the key is not found
593 inline double ParameterSet::getDouble(const std::string& aKey,
594  double aValue) const {
595  return itsSet->getDouble(aKey, aValue);
596 }
597 
598 // getString(key)
599 inline std::string ParameterSet::getString(const std::string& aKey) const {
600  return itsSet->getString(aKey);
601 }
602 
603 // getString(key, value), where value is returned when the key is not found
604 inline std::string ParameterSet::getString(const std::string& aKey,
605  const std::string& aValue) const {
606  return itsSet->getString(aKey, aValue);
607 }
608 
609 // getTime(key)
610 inline time_t ParameterSet::getTime(const std::string& aKey) const {
611  return itsSet->getTime(aKey);
612 }
613 
614 // getTime(key, value), where value is returned when the key is not found
615 inline time_t ParameterSet::getTime(const std::string& aKey,
616  const time_t& aValue) const {
617  return itsSet->getTime(aKey, aValue);
618 }
619 
620 // getBoolVector(key)
621 inline std::vector<bool> ParameterSet::getBoolVector(const std::string& aKey,
622  bool expandable) const {
623  return itsSet->getBoolVector(aKey, expandable);
624 }
625 
626 // getBoolVector(key, value), where value is returned when the key is not found
627 inline std::vector<bool> ParameterSet::getBoolVector(
628  const std::string& aKey, const std::vector<bool>& aValue,
629  bool expandable) const {
630  return itsSet->getBoolVector(aKey, aValue, expandable);
631 }
632 
633 // getIntVector(key)
634 inline std::vector<int> ParameterSet::getIntVector(const std::string& aKey,
635  bool expandable) const {
636  return itsSet->getIntVector(aKey, expandable);
637 }
638 
639 // getIntVector(key, value), where value is returned when the key is not found
640 inline std::vector<int> ParameterSet::getIntVector(
641  const std::string& aKey, const std::vector<int>& aValue,
642  bool expandable) const {
643  return itsSet->getIntVector(aKey, aValue, expandable);
644 }
645 
646 // getUintVector(key)
647 inline std::vector<unsigned int> ParameterSet::getUintVector(
648  const std::string& aKey, bool expandable) const {
649  return itsSet->getUintVector(aKey, expandable);
650 }
651 
652 // getUintVector(key, value), where value is returned when the key is not found
653 inline std::vector<unsigned int> ParameterSet::getUintVector(
654  const std::string& aKey, const std::vector<unsigned int>& aValue,
655  bool expandable) const {
656  return itsSet->getUintVector(aKey, aValue, expandable);
657 }
658 
659 // getInt16Vector(key)
660 inline std::vector<int16_t> ParameterSet::getInt16Vector(
661  const std::string& aKey, bool expandable) const {
662  return itsSet->getInt16Vector(aKey, expandable);
663 }
664 
665 // getInt16Vector(key, value), where value is returned when key is not found
666 inline std::vector<int16_t> ParameterSet::getInt16Vector(
667  const std::string& aKey, const std::vector<int16_t>& aValue,
668  bool expandable) const {
669  return itsSet->getInt16Vector(aKey, aValue, expandable);
670 }
671 
672 // getUint16Vector(key)
673 inline std::vector<uint16_t> ParameterSet::getUint16Vector(
674  const std::string& aKey, bool expandable) const {
675  return itsSet->getUint16Vector(aKey, expandable);
676 }
677 
678 // getUint16Vector(key, value), where value is returned when key is not found
679 inline std::vector<uint16_t> ParameterSet::getUint16Vector(
680  const std::string& aKey, const std::vector<uint16_t>& aValue,
681  bool expandable) const {
682  return itsSet->getUint16Vector(aKey, aValue, expandable);
683 }
684 
685 // getInt32Vector(key)
686 inline std::vector<int32_t> ParameterSet::getInt32Vector(
687  const std::string& aKey, bool expandable) const {
688  return itsSet->getInt32Vector(aKey, expandable);
689 }
690 
691 // getInt32Vector(key, value), where value is returned when key is not found
692 inline std::vector<int32_t> ParameterSet::getInt32Vector(
693  const std::string& aKey, const std::vector<int32_t>& aValue,
694  bool expandable) const {
695  return itsSet->getInt32Vector(aKey, aValue, expandable);
696 }
697 
698 // getUint32Vector(key)
699 inline std::vector<uint32_t> ParameterSet::getUint32Vector(
700  const std::string& aKey, bool expandable) const {
701  return itsSet->getUint32Vector(aKey, expandable);
702 }
703 
704 // getUint32Vector(key, value), where value is returned when key is not found
705 inline std::vector<uint32_t> ParameterSet::getUint32Vector(
706  const std::string& aKey, const std::vector<uint32_t>& aValue,
707  bool expandable) const {
708  return itsSet->getUint32Vector(aKey, aValue, expandable);
709 }
710 
711 // getInt64Vector(key)
712 inline std::vector<int64_t> ParameterSet::getInt64Vector(
713  const std::string& aKey, bool expandable) const {
714  return itsSet->getInt64Vector(aKey, expandable);
715 }
716 
717 // getInt64Vector(key, value), where value is returned when key is not found
718 inline std::vector<int64_t> ParameterSet::getInt64Vector(
719  const std::string& aKey, const std::vector<int64_t>& aValue,
720  bool expandable) const {
721  return itsSet->getInt64Vector(aKey, aValue, expandable);
722 }
723 
724 // getUint64Vector(key)
725 inline std::vector<uint64_t> ParameterSet::getUint64Vector(
726  const std::string& aKey, bool expandable) const {
727  return itsSet->getUint64Vector(aKey, expandable);
728 }
729 
730 // getUint64Vector(key, value), where value is returned when key is not found
731 inline std::vector<uint64_t> ParameterSet::getUint64Vector(
732  const std::string& aKey, const std::vector<uint64_t>& aValue,
733  bool expandable) const {
734  return itsSet->getUint64Vector(aKey, aValue, expandable);
735 }
736 
737 // getFloatVector(key)
738 inline std::vector<float> ParameterSet::getFloatVector(const std::string& aKey,
739  bool expandable) const {
740  return itsSet->getFloatVector(aKey, expandable);
741 }
742 
743 // getFloatVector(key, value), where value is returned when key is not found
744 inline std::vector<float> ParameterSet::getFloatVector(
745  const std::string& aKey, const std::vector<float>& aValue,
746  bool expandable) const {
747  return itsSet->getFloatVector(aKey, aValue, expandable);
748 }
749 
750 // getDoubleVector(key)
751 inline std::vector<double> ParameterSet::getDoubleVector(
752  const std::string& aKey, bool expandable) const {
753  return itsSet->getDoubleVector(aKey, expandable);
754 }
755 // getDoubleVector(key, value), where value is returned when key is not found
756 inline std::vector<double> ParameterSet::getDoubleVector(
757  const std::string& aKey, const std::vector<double>& aValue,
758  bool expandable) const {
759  return itsSet->getDoubleVector(aKey, aValue, expandable);
760 }
761 
762 // getStringVector(key)
763 inline std::vector<std::string> ParameterSet::getStringVector(
764  const std::string& aKey, bool expandable) const {
765  return itsSet->getStringVector(aKey, expandable);
766 }
767 
768 // getStringVector(key, value), where value is returned when key is not found
769 inline std::vector<std::string> ParameterSet::getStringVector(
770  const std::string& aKey, const std::vector<std::string>& aValue,
771  bool expandable) const {
772  return itsSet->getStringVector(aKey, aValue, expandable);
773 }
774 
775 // getTimeVector(key)
776 inline std::vector<time_t> ParameterSet::getTimeVector(const std::string& aKey,
777  bool expandable) const {
778  return itsSet->getTimeVector(aKey, expandable);
779 }
780 
781 // getTimeVector(key, value), where value is returned when key is not found
782 inline std::vector<time_t> ParameterSet::getTimeVector(
783  const std::string& aKey, const std::vector<time_t>& aValue,
784  bool expandable) const {
785  return itsSet->getTimeVector(aKey, aValue, expandable);
786 }
787 
788 inline std::vector<std::string> ParameterSet::unusedKeys() const {
789  return itsSet->unusedKeys();
790 }
791 
792 } // namespace common
793 } // namespace dp3
794 
795 #endif
Input stream for a blob.
Definition: BlobIStream.h:43
Output stream for a blob.
Definition: BlobOStream.h:40
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:31
KeyCompare::Mode keyCompareMode() const
Key comparison mode.
Definition: ParameterSet.h:383
std::vector< int > getIntVector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:634
uint16_t getUint16(const std::string &aKey) const
Definition: ParameterSet.h:522
void adoptArguments(const std::vector< std::string > &arguments)
Definition: ParameterSet.h:404
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:409
std::string fullModuleName(const std::string &shortName) const
Definition: ParameterSet.h:469
ParameterSet(const std::string &theFilename, KeyCompare::Mode=KeyCompare::NORMAL)
void adoptFile(const std::string &theFilename, const std::string &thePrefix="")
Definition: ParameterSet.h:389
bool isDefined(const std::string &searchKey) const
Checks if the given Key is defined in the ParameterSet.
Definition: ParameterSet.h:460
std::vector< std::string > getStringVector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:763
iterator find(const std::string &searchKey)
Find a key.
Definition: ParameterSet.h:451
bool empty() const
Is the set empty?
Definition: ParameterSet.h:364
std::vector< uint64_t > getUint64Vector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:725
std::vector< double > getDoubleVector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:751
ParameterSet makeSubset(const std::string &baseKey, const std::string &prefix="") const
Definition: ParameterSet.h:422
std::vector< std::string > unusedKeys() const
Definition: ParameterSet.h:788
int16_t getInt16(const std::string &aKey) const
Definition: ParameterSet.h:511
void writeBuffer(std::string &theBuffer) const
Definition: ParameterSet.h:414
void replace(const std::string &aKey, const std::string &aValue)
Definition: ParameterSet.h:439
std::vector< unsigned int > getUintVector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:647
float getFloat(const std::string &aKey) const
Definition: ParameterSet.h:577
ParameterSetImpl::const_iterator const_iterator
Definition: ParameterSet.h:34
std::vector< size_t > getSizeTVector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:296
std::vector< int16_t > getInt16Vector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:660
std::string locateModule(const std::string &shortName) const
Definition: ParameterSet.h:464
void remove(const std::string &aKey)
Removes the pair with the given key. Removing a non-existing key is ok.
Definition: ParameterSet.h:447
unsigned int getUint(const std::string &aKey) const
Definition: ParameterSet.h:500
time_t getTime(const std::string &aKey) const
Definition: ParameterSet.h:610
std::vector< float > getFloatVector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:738
void add(const std::string &aKey, const std::string &aValue)
Definition: ParameterSet.h:431
std::vector< ParameterValue > getVector(const std::string &aKey) const
Definition: ParameterSet.h:474
ParameterSet(KeyCompare::Mode mode=KeyCompare::NORMAL)
const ParameterValue & operator[](const std::string &aKey) const
Definition: ParameterSet.h:378
ParameterSet(const std::string &theFilename, bool caseInsensitive)
std::vector< uint32_t > getUint32Vector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:699
std::vector< time_t > getTimeVector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:776
int32_t getInt32(const std::string &aKey) const
Definition: ParameterSet.h:533
std::vector< uint16_t > getUint16Vector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:673
int size() const
Get the number of parameters.
Definition: ParameterSet.h:365
std::vector< int32_t > getInt32Vector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:686
uint32_t getUint32(const std::string &aKey) const
Definition: ParameterSet.h:544
ParameterRecord getRecord(const std::string &aKey) const
bool getBool(const std::string &aKey) const
Definition: ParameterSet.h:480
int64_t getInt64(const std::string &aKey) const
Definition: ParameterSet.h:555
void clear()
Clear the set.
Definition: ParameterSet.h:387
const ParameterValue & get(const std::string &aKey) const
Definition: ParameterSet.h:375
uint64_t getUint64(const std::string &aKey) const
Definition: ParameterSet.h:566
std::vector< int64_t > getInt64Vector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:712
ParameterSet(bool caseInsensitive)
iterator begin()
Iteration.
Definition: ParameterSet.h:366
void writeStream(std::ostream &os) const
Definition: ParameterSet.h:418
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:399
int getInt(const std::string &aKey) const
Definition: ParameterSet.h:490
std::vector< bool > getBoolVector(const std::string &aKey, bool expandable=false) const
Definition: ParameterSet.h:621
void subtractSubset(const std::string &fullPrefix)
Definition: ParameterSet.h:427
double getDouble(const std::string &aKey) const
Definition: ParameterSet.h:588
iterator end()
Definition: ParameterSet.h:367
friend std::ostream & operator<<(std::ostream &os, const ParameterSet &thePS)
Allow printing the whole parameter collection.
ParameterSetImpl::iterator iterator
Definition: ParameterSet.h:33
void adoptBuffer(const std::string &theBuffer, const std::string &thePrefix="")
Definition: ParameterSet.h:394
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:599
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
std::ostream & operator<<(std::ostream &os, const KVpair &kv)
blob::BlobIStream & operator>>(blob::BlobIStream &, ParameterSet &)
This file has generic helper routines for testing steps.
Definition: AntennaConfig.h:53