Catalog.h
Go to the documentation of this file.
1 #ifndef JOBOPTIONSVC_CATALOG_H_
2 #define JOBOPTIONSVC_CATALOG_H_
3 // ============================================================================
4 // STD & STL:
5 // ============================================================================
6 #include <iostream>
7 #include <string>
8 #include <vector>
9 #include <map>
10 #include <set>
11 // ============================================================================
12 // Boost:
13 // ============================================================================
14 #include <boost/ptr_container/ptr_set.hpp>
15 // ============================================================================
16 // Local:
17 // ============================================================================
18 #include "Property.h"
19 #include "PropertyName.h"
20 #include "PropertyValue.h"
21 // ============================================================================
22 // Namespace aliases:
23 // ============================================================================
24 // ...
25 // ============================================================================
26 namespace Gaudi { namespace Parsers {
27 // ============================================================================
28 class Catalog final {
29  public:
30  typedef boost::ptr_set<Property, Property::LessThen> PropertySet;
31  typedef std::map<std::string, PropertySet> CatalogSet;
32 
33  typedef CatalogSet::value_type value_type;
34  typedef CatalogSet::iterator iterator;
35  typedef CatalogSet::const_iterator const_iterator;
36 
37  iterator begin() { return catalog_.begin();}
38  const_iterator begin() const { return catalog_.begin();}
39  iterator end() { return catalog_.end();}
40  const_iterator end() const{ return catalog_.end();}
41 
42  std::vector<std::string> ClientNames() const;
43  bool Add(Property* property);
44  template<typename Value> bool Add(std::string client,
45  std::string property, const Value& value);
46  Property* Find(const std::string& client, const std::string& name);
47  std::string ToString() const;
49  std::ostream& fillStream ( std::ostream& out ) const ;
50  private:
51  CatalogSet catalog_;
52 };
53 // ============================================================================
55 // ============================================================================
56  inline std::ostream& operator<< (std::ostream& o, const Catalog& c){
57  return c.fillStream(o);
58  }
59 // ============================================================================
60 } /* Gaudi */ } /* Parsers */
61 
62 template<typename Value> inline bool Gaudi::Parsers::Catalog::Add(
63  std::string client, std::string property,
64  const Value& value) {
65  return Add(new Property(PropertyName(std::move(client), std::move(property)), PropertyValue(value)));
66 }
67 
68 // ============================================================================
69 #endif // JOBOPTIONSVC_CATALOG_H_
std::ostream & operator<<(std::ostream &o, const Catalog &c)
printout operator
Definition: Catalog.h:56
tuple c
Definition: gaudirun.py:391
CatalogSet::value_type value_type
Definition: Catalog.h:33
std::ostream & fillStream(std::ostream &out) const
print the content of the catalogue to std::ostream
Definition: Catalog.cpp:66
iterator begin()
Definition: Catalog.h:37
CatalogSet::const_iterator const_iterator
Definition: Catalog.h:35
std::vector< std::string > ClientNames() const
Definition: Catalog.cpp:21
CatalogSet::iterator iterator
Definition: Catalog.h:34
const_iterator end() const
Definition: Catalog.h:40
const_iterator begin() const
Definition: Catalog.h:38
Property * Find(const std::string &client, const std::string &name)
Definition: Catalog.cpp:43
boost::ptr_set< Property, Property::LessThen > PropertySet
Definition: Catalog.h:30
bool Add(Property *property)
Definition: Catalog.cpp:28
std::map< std::string, PropertySet > CatalogSet
Definition: Catalog.h:31
CatalogSet catalog_
Definition: Catalog.h:51
Helper functions to set/get the application return code.
Definition: __init__.py:1
std::string ToString() const
Definition: Catalog.cpp:54