Catalogue.h
Go to the documentation of this file.00001
00002
00003
00004
00005 #ifndef JOBOPTIONSSVC_CATALOGUE_H
00006 #define JOBOPTIONSSVC_CATALOGUE_H 1
00007
00008
00009
00010
00011
00012 #include <string>
00013 #include <vector>
00014 #include <map>
00015
00016
00017
00018 #include "GaudiKernel/StatusCode.h"
00019
00020
00021
00022 #include "Position.h"
00023
00024 namespace Gaudi
00025 {
00026 namespace Parsers
00027 {
00028 class PropertyEntry;
00029
00033 struct _NoCaseCmp_
00034 : public std::binary_function<std::string,std::string,bool>
00035 {
00036 bool operator() ( const std::string& s1 ,
00037 const std::string& s2 ) const ;
00038 };
00039
00047 class Catalogue
00048 {
00049 public:
00050 typedef std::map<std::string,std::vector<PropertyEntry> > CatalogueT;
00056 StatusCode findProperties(const std::string& objName,
00057 std::vector<PropertyEntry>& list) const;
00058
00065 StatusCode findProperty(const std::string& objName,
00066 const std::string& propName, PropertyEntry& property) const;
00067
00072 void addProperty(const std::string& objName,
00073 const PropertyEntry& property);
00074
00080 StatusCode addProperty(const std::string& objName,
00081 const std::string& propName,const std::string& value);
00082
00086 CatalogueT catalogue() const;
00087
00089 std::ostream& fillStream ( std::ostream& out ) const ;
00090
00091 private:
00092 typedef std::map<std::string,PropertyEntry,_NoCaseCmp_> PropertiesStoreT;
00093 typedef std::map<std::string,PropertiesStoreT> ObjectsStoreT;
00094
00095 ObjectsStoreT m_properties;
00096 };
00097
00098 class PropertyEntry
00099 {
00100 public:
00102 PropertyEntry(){}
00107 PropertyEntry(const std::string& name,
00108 const std::string& value);
00113 PropertyEntry(const std::string& name,
00114 const std::vector<std::string>& value);
00115
00121 PropertyEntry(const std::string& name,
00122 const std::string& value,const Position& pos);
00128 PropertyEntry(const std::string& name,
00129 const std::vector<std::string>& value,const Position& pos);
00130
00134 const std::string& name(void) const {return m_name;};
00135
00137 void setName(const std::string& name){m_name=name;};
00138
00142 std::string value(void) const;
00143
00145 Position position(void) const{return m_position;}
00146
00147
00153 StatusCode addValues(const std::vector<std::string>& values);
00154
00161 StatusCode removeValues(const std::vector<std::string>& values, int& count);
00162
00167 StatusCode clear(void);
00168
00170 StatusCode removeEnv() ;
00171
00172 private:
00173 std::string m_name;
00174 std::vector<std::string> m_value;
00175 Position m_position;
00176 bool m_isVector;
00177 };
00178
00179 }
00180 }
00181
00183
00184 std::ostream& operator<<( std::ostream& o ,
00185 const Gaudi::Parsers::Catalogue& c ) ;
00186
00187
00188
00189
00190
00191 #endif // JOBOPTIONSSVC_CATALOGUE_H
00192