Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 <map>
8 #include <set>
9 #include <string>
10 #include <vector>
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 {
27  namespace Parsers {
28  // ============================================================================
29  class Catalog final {
30  public:
31  typedef boost::ptr_set<Property, Property::LessThen> PropertySet;
33 
34  typedef CatalogSet::value_type value_type;
35  typedef CatalogSet::iterator iterator;
36  typedef CatalogSet::const_iterator const_iterator;
37 
38  iterator begin() { return catalog_.begin(); }
39  const_iterator begin() const { return catalog_.begin(); }
40  iterator end() { return catalog_.end(); }
41  const_iterator end() const { return catalog_.end(); }
42 
44  bool Add( Property* property );
45  template <typename Value>
46  bool Add( std::string client, std::string property, const Value& value );
47  Property* Find( const std::string& client, const std::string& name );
48  std::string ToString() const;
50  std::ostream& fillStream( std::ostream& out ) const;
51 
52  private:
53  CatalogSet catalog_;
54  };
55  // ============================================================================
57  // ============================================================================
58  inline std::ostream& operator<<( std::ostream& o, const Catalog& c ) { return c.fillStream( o ); }
59  // ============================================================================
60  } // namespace Parsers
61 } // namespace Gaudi
62 
63 template <typename Value>
64 inline bool Gaudi::Parsers::Catalog::Add( std::string client, std::string property, 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:58
CatalogSet::value_type value_type
Definition: Catalog.h:34
std::ostream & fillStream(std::ostream &out) const
print the content of the catalogue to std::ostream
Definition: Catalog.cpp:64
Gaudi::Details::PropertyBase * property(const std::string &name) const
iterator begin()
Definition: Catalog.h:38
T end(T...args)
Gaudi::Details::PropertyBase Property
backward compatibility hack for old Property base class
Definition: PropertyFwd.h:25
STL class.
CatalogSet::const_iterator const_iterator
Definition: Catalog.h:36
std::vector< std::string > ClientNames() const
Definition: Catalog.cpp:25
CatalogSet::iterator iterator
Definition: Catalog.h:35
const_iterator end() const
Definition: Catalog.h:41
const_iterator begin() const
Definition: Catalog.h:39
Property * Find(const std::string &client, const std::string &name)
Definition: Catalog.cpp:46
T move(T...args)
boost::ptr_set< Property, Property::LessThen > PropertySet
Definition: Catalog.h:31
bool Add(Property *property)
Definition: Catalog.cpp:31
T begin(T...args)
std::map< std::string, PropertySet > CatalogSet
Definition: Catalog.h:32
CatalogSet catalog_
Definition: Catalog.h:53
STL class.
Helper functions to set/get the application return code.
Definition: __init__.py:1
std::string ToString() const
Definition: Catalog.cpp:54