|
Gaudi Framework, version v22r4 |
| Home | Generated: Fri Sep 2 2011 |
00001 // $Id:$ 00002 #ifndef JOBOPTIONSVC_PROPERTY_H_ 00003 #define JOBOPTIONSVC_PROPERTY_H_ 00004 // ============================================================================ 00005 // Includes: 00006 // ============================================================================ 00007 // STD & STL: 00008 // ============================================================================ 00009 #include <string> 00010 // ============================================================================ 00011 // Boost: 00012 // ============================================================================ 00013 #include <boost/shared_ptr.hpp> 00014 // ============================================================================ 00015 #include "Position.h" 00016 #include "PropertyName.h" 00017 #include "PropertyValue.h" 00018 // ============================================================================ 00019 namespace Gaudi { namespace Parsers { 00020 // ============================================================================ 00021 class Property { 00022 // ---------------------------------------------------------------------------- 00023 public: 00024 // ---------------------------------------------------------------------------- 00025 struct LessThen : std::binary_function<Property, Property, bool> { 00026 bool operator()(const Property& first, const Property& second) const { 00027 return first.FullName() < second.FullName(); 00028 } 00029 }; 00030 00031 class Equal : std::unary_function<Property, bool> { 00032 public: 00033 Equal(const std::string& short_name): short_name_(short_name){} 00034 bool operator()(const Property& property) const { 00035 return short_name_ == property.NameInClient(); 00036 } 00037 private: 00038 std::string short_name_; 00039 }; 00040 // ---------------------------------------------------------------------------- 00041 Property(const PropertyName& property_name, 00042 const PropertyValue& property_value): 00043 property_name_(property_name), property_value_(property_value) {} 00044 // ---------------------------------------------------------------------------- 00045 const PropertyName& property_name() const { 00046 return property_name_; 00047 } 00048 PropertyValue& property_value() { 00049 return property_value_; 00050 } 00051 // ---------------------------------------------------------------------------- 00052 Property& operator += (const PropertyValue& value){ 00053 property_value_ += value; 00054 return *this; 00055 } 00056 Property& operator -= (const PropertyValue& value) { 00057 property_value_ -= value; 00058 return *this; 00059 } 00060 // ---------------------------------------------------------------------------- 00061 const Position& DefinedPosition() const; 00062 bool HasDefinedPosition() const { return DefinedPosition().Exists();} 00063 // ---------------------------------------------------------------------------- 00064 const Position& ValuePosition() const; 00065 bool HasValuePosition() const { return ValuePosition().Exists();} 00066 // ---------------------------------------------------------------------------- 00067 std::string ClientName() const; 00068 std::string NameInClient() const; 00069 std::string FullName() const; 00070 std::string ValueAsString() const; 00071 std::string ToString() const; 00072 bool IsSimple() const; 00073 bool IsVector() const; 00074 bool IsMap() const; 00075 bool IsReference() const { return property_value_.IsReference();} 00076 // ---------------------------------------------------------------------------- 00077 private: 00078 // ---------------------------------------------------------------------------- 00079 PropertyName property_name_; 00080 PropertyValue property_value_; 00081 }; 00082 // ============================================================================ 00083 } /* Gaudi */ } /* Parsers */ 00084 // ============================================================================ 00085 #endif // JOBOPTIONSVC_PROPERTY_H_