The Gaudi Framework  v33r1 (b1225454)
Catalog.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef JOBOPTIONSVC_CATALOG_H_
12 #define JOBOPTIONSVC_CATALOG_H_
13 // ============================================================================
14 // STD & STL:
15 // ============================================================================
16 #include <iostream>
17 #include <map>
18 #include <set>
19 #include <string>
20 #include <vector>
21 // ============================================================================
22 // Boost:
23 // ============================================================================
24 #include <boost/ptr_container/ptr_set.hpp>
25 // ============================================================================
26 // Local:
27 // ============================================================================
28 #include "Property.h"
29 #include "PropertyName.h"
30 #include "PropertyValue.h"
31 // ============================================================================
32 // Namespace aliases:
33 // ============================================================================
34 // ...
35 // ============================================================================
36 namespace Gaudi {
37  namespace Parsers {
38  // ============================================================================
39  class Catalog final {
40  public:
41  typedef boost::ptr_set<Property, Property::LessThen> PropertySet;
43 
44  typedef CatalogSet::value_type value_type;
45  typedef CatalogSet::iterator iterator;
46  typedef CatalogSet::const_iterator const_iterator;
47 
48  iterator begin() { return catalog_.begin(); }
49  const_iterator begin() const { return catalog_.begin(); }
50  iterator end() { return catalog_.end(); }
51  const_iterator end() const { return catalog_.end(); }
52 
54  bool Add( Property* property );
55  template <typename Value>
56  bool Add( std::string client, std::string property, const Value& value );
57  Property* Find( const std::string& client, const std::string& name );
58  std::string ToString() const;
60  std::ostream& fillStream( std::ostream& out ) const;
61 
62  private:
64  };
65  // ============================================================================
67  // ============================================================================
68  inline std::ostream& operator<<( std::ostream& o, const Catalog& c ) { return c.fillStream( o ); }
69  // ============================================================================
70  } // namespace Parsers
71 } // namespace Gaudi
72 
73 template <typename Value>
74 inline bool Gaudi::Parsers::Catalog::Add( std::string client, std::string property, const Value& value ) {
75  return Add( new Property( PropertyName( std::move( client ), std::move( property ) ), PropertyValue( value ) ) );
76 }
77 
78 // ============================================================================
79 #endif // JOBOPTIONSVC_CATALOG_H_
std::ostream & operator<<(std::ostream &o, const Catalog &c)
printout operator
Definition: Catalog.h:68
CatalogSet::value_type value_type
Definition: Catalog.h:44
iterator begin()
Definition: Catalog.h:48
const_iterator begin() const
Definition: Catalog.h:49
T end(T... args)
Gaudi::Details::PropertyBase Property
\fixme backward compatibility hack for old Property base class
Definition: PropertyFwd.h:35
std::string ToString() const
Definition: Catalog.cpp:64
STL class.
CatalogSet::const_iterator const_iterator
Definition: Catalog.h:46
std::vector< std::string > ClientNames() const
Definition: Catalog.cpp:35
CatalogSet::iterator iterator
Definition: Catalog.h:45
Property * Find(const std::string &client, const std::string &name)
Definition: Catalog.cpp:56
T move(T... args)
const_iterator end() const
Definition: Catalog.h:51
boost::ptr_set< Property, Property::LessThen > PropertySet
Definition: Catalog.h:41
std::ostream & fillStream(std::ostream &out) const
print the content of the catalogue to std::ostream
Definition: Catalog.cpp:74
bool Add(Property *property)
Definition: Catalog.cpp:41
T begin(T... args)
std::map< std::string, PropertySet > CatalogSet
Definition: Catalog.h:42
CatalogSet catalog_
Definition: Catalog.h:63
STL class.
Header file for std:chrono::duration-based Counters.
Definition: __init__.py:1