| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Private Attributes | List of all members
Gaudi::Parsers::PropertyValue Class Referencefinal

`#include <src/JobOptionsSvc/PropertyValue.h>`

Collaboration diagram for Gaudi::Parsers::PropertyValue:
[legend]

## Public Types
typedef boost::variant< std::string, std::vector< std::string >, std::map< std::string, std::string > > | Value
typedef std::vector< std::string > | VectorOfStrings
typedef std::map< std::string, std::string > | MapOfStrings

## Public Member Functions
| PropertyValue (Value value, bool is_reference=false)
| PropertyValue (Value value, const Position &position, bool is_reference=false)
const Position & | position () const
std::string & | String ()
const std::string & | String () const
VectorOfStrings & | Vector ()
const VectorOfStrings & | Vector () const
MapOfStrings & | Map ()
const MapOfStrings & | Map () const
std::string | ToString () const
bool | HasPosition () const
bool | IsSimple () const
bool | IsVector () const
bool | IsMap () const
bool | IsReference () const
PropertyValue & | operator+= (const PropertyValue &right)
const PropertyValue | operator+ (const PropertyValue &right)
PropertyValue & | operator-= (const PropertyValue &right)
const PropertyValue | operator- (const PropertyValue &right)

## Private Attributes
Value | value_
Position | position_
bool | is_reference_

## Detailed Description

Definition at line 19 of file PropertyValue.h.

## Member Typedef Documentation

typedef std::map<std::string, std::string> Gaudi::Parsers::PropertyValue::MapOfStrings

Definition at line 25 of file PropertyValue.h.

typedef boost::variant<std::string, std::vector<std::string>, std::map<std::string, std::string> > Gaudi::Parsers::PropertyValue::Value

Definition at line 23 of file PropertyValue.h.

typedef std::vector<std::string> Gaudi::Parsers::PropertyValue::VectorOfStrings

Definition at line 24 of file PropertyValue.h.

## Constructor & Destructor Documentation

Gaudi::Parsers::PropertyValue::PropertyValue | ( | Value | value,
|  | bool | is_reference = `false`
| ) |  |
| inline explicit

Definition at line 28 of file PropertyValue.h.

29 : value_(std::move(value)), is_reference_(is_reference) {}
std::move
T move(T...args)
Gaudi::Parsers::PropertyValue::is_reference_
bool is_reference_
Definition: PropertyValue.h:64
Gaudi::Parsers::PropertyValue::value_
Value value_
Definition: PropertyValue.h:62

Gaudi::Parsers::PropertyValue::PropertyValue | ( | Value | value,
|  | const Position & | position,
|  | bool | is_reference = `false`
| ) |  |
| inline

Definition at line 30 of file PropertyValue.h.

31 : value_(std::move(value)), position_(position),
32 is_reference_(is_reference) {}
Gaudi::Parsers::PropertyValue::position_
Position position_
Definition: PropertyValue.h:63
Gaudi::Parsers::PropertyValue::position
const Position & position() const
Definition: PropertyValue.h:34
std::move
T move(T...args)
Gaudi::Parsers::PropertyValue::is_reference_
bool is_reference_
Definition: PropertyValue.h:64
Gaudi::Parsers::PropertyValue::value_
Value value_
Definition: PropertyValue.h:62

## Member Function Documentation

bool Gaudi::Parsers::PropertyValue::HasPosition | ( |  | ) | const
| inline

Definition at line 47 of file PropertyValue.h.

47 {return position_.Exists();}
Gaudi::Parsers::PropertyValue::position_
Position position_
Definition: PropertyValue.h:63
Gaudi::Parsers::Position::Exists
bool Exists() const
Definition: Position.h:22

bool Gaudi::Parsers::PropertyValue::IsMap | ( |  | ) | const

Definition at line 23 of file PropertyValue.cpp.

23 {
24 return boost::get<std::map<std::string, std::string> >(&value_) != NULL;
25 }
Gaudi::Parsers::PropertyValue::value_
Value value_
Definition: PropertyValue.h:62

bool Gaudi::Parsers::PropertyValue::IsReference | ( |  | ) | const
| inline

Definition at line 51 of file PropertyValue.h.

51 { return is_reference_;};
Gaudi::Parsers::PropertyValue::is_reference_
bool is_reference_
Definition: PropertyValue.h:64

bool Gaudi::Parsers::PropertyValue::IsSimple | ( |  | ) | const

Definition at line 15 of file PropertyValue.cpp.

15 {
16 return boost::get<std::string>(&value_) != NULL;
17 }
Gaudi::Parsers::PropertyValue::value_
Value value_
Definition: PropertyValue.h:62

bool Gaudi::Parsers::PropertyValue::IsVector | ( |  | ) | const

Definition at line 19 of file PropertyValue.cpp.

19 {
20 return boost::get<std::vector<std::string> >(&value_) != NULL;
21 }
Gaudi::Parsers::PropertyValue::value_
Value value_
Definition: PropertyValue.h:62

MapOfStrings& Gaudi::Parsers::PropertyValue::Map | ( |  | ) |
| inline

Definition at line 43 of file PropertyValue.h.

43 { return boost::get<MapOfStrings>(value_);}
Gaudi::Parsers::PropertyValue::value_
Value value_
Definition: PropertyValue.h:62

const MapOfStrings& Gaudi::Parsers::PropertyValue::Map | ( |  | ) | const
| inline

Definition at line 44 of file PropertyValue.h.

44 { return boost::get<MapOfStrings>(value_);}
Gaudi::Parsers::PropertyValue::value_
Value value_
Definition: PropertyValue.h:62

const gp::PropertyValue Gaudi::Parsers::PropertyValue::operator+ | ( | const PropertyValue & | right | ) |

Definition at line 65 of file PropertyValue.cpp.

65 {
66 return PropertyValue(*this) += right;
67
68 }
Gaudi::Parsers::PropertyValue::PropertyValue
PropertyValue(Value value, bool is_reference=false)
Definition: PropertyValue.h:28
std::right
T right(T...args)

gp::PropertyValue & Gaudi::Parsers::PropertyValue::operator+= | ( | const PropertyValue & | right | ) |

Definition at line 28 of file PropertyValue.cpp.

28 {
29
30 if (IsSimple() || IsReference()) {
31 throw PropertyValueException::WrongLValue();
32 }
33
34 if (IsVector()) {
35 if (right.IsSimple()) {
36 boost::get<VectorOfStrings>(value_).push_back(
37 boost::get<std::string>(right.value_));
38 return *this;
39 }
40 if (right.IsVector()){
41 VectorOfStrings& vec = boost::get<VectorOfStrings>(value_);
42 for (const auto& item : boost::get<VectorOfStrings>(right.value_)) {
43 vec.push_back(item);
44 }
45 return *this;
46 }
47 throw PropertyValueException::WrongRValue();
48 }
49
50 if (IsMap()) {
51 if (!right.IsMap()) {
52 throw PropertyValueException::WrongRValue();
53 }
54 MapOfStrings& map = boost::get<MapOfStrings>(value_);
55 const MapOfStrings& rmap = boost::get<MapOfStrings>(right.value_);
56 for (const auto& item : rmap) {
57 map.insert(item);
58 }
59 return *this;
60 }
61 return *this;
62 }
Gaudi::Parsers::PropertyValue::VectorOfStrings
std::vector< std::string > VectorOfStrings
Definition: PropertyValue.h:24
Gaudi::Parsers::PropertyValue::MapOfStrings
std::map< std::string, std::string > MapOfStrings
Definition: PropertyValue.h:25
Gaudi::Parsers::PropertyValue::IsReference
bool IsReference() const
Definition: PropertyValue.h:51
std::right
T right(T...args)
Gaudi::Functional::details::details2::push_back
void push_back(Container &c, const Value &v, std::true_type)
Definition: FunctionalDetails.h:154
std::vector::push_back
T push_back(T...args)
Containers::map
struct GAUDI_API map
Parametrisation class for map-like implementation.
Definition: KeyedObjectManager.h:25
Gaudi::Parsers::PropertyValueException::WrongRValue
static PropertyValueException WrongRValue()
Definition: PropertyValue.h:76
Gaudi::Parsers::PropertyValue::IsVector
bool IsVector() const
Definition: PropertyValue.cpp:19
Gaudi::Parsers::PropertyValue::IsSimple
bool IsSimple() const
Definition: PropertyValue.cpp:15
std::map::insert
T insert(T...args)
Gaudi::Parsers::PropertyValue::value_
Value value_
Definition: PropertyValue.h:62
Gaudi::Parsers::PropertyValue::IsMap
bool IsMap() const
Definition: PropertyValue.cpp:23
Gaudi::Parsers::PropertyValueException::WrongLValue
static PropertyValueException WrongLValue()
Definition: PropertyValue.h:72

const gp::PropertyValue Gaudi::Parsers::PropertyValue::operator- | ( | const PropertyValue & | right | ) |

Definition at line 113 of file PropertyValue.cpp.

113 {
114 return PropertyValue(*this) -= right;
115 }
Gaudi::Parsers::PropertyValue::PropertyValue
PropertyValue(Value value, bool is_reference=false)
Definition: PropertyValue.h:28
std::right
T right(T...args)

gp::PropertyValue & Gaudi::Parsers::PropertyValue::operator-= | ( | const PropertyValue & | right | ) |

Definition at line 71 of file PropertyValue.cpp.

71 {
72 if (IsSimple() || IsReference()) {
73 throw PropertyValueException::WrongLValue();
74 }
75
76 if (IsVector()) {
77 VectorOfStrings& vec = Vector();
78 if (right.IsSimple()) {
79 vec.erase(std::find(vec.begin(), vec.end(), right.String()));
80 return *this;
81 }
82
83 if (right.IsVector()) {
84 const VectorOfStrings& rvec = right.Vector();
85 for (const auto& item : rvec) {
86 vec.erase(std::find(vec.begin(), vec.end(), item));
87 }
88 return *this;
89 }
90 throw PropertyValueException::WrongRValue();
91 }
92
93 if (IsMap()) {
94 MapOfStrings& map = Map();
95 if (right.IsSimple()) {
96 map.erase(right.String());
97 return *this;
98 }
99
100 if (right.IsVector()) {
101 const VectorOfStrings& rvec = right.Vector();
102 for (const auto& item : rvec) {
103 map.erase(item);
104 }
105 return *this;
106 }
107 throw PropertyValueException::WrongRValue();
108 }
109 throw PropertyValueException::WrongLValue();
110 }
Gaudi::Parsers::PropertyValue::VectorOfStrings
std::vector< std::string > VectorOfStrings
Definition: PropertyValue.h:24
Gaudi::Parsers::PropertyValue::MapOfStrings
std::map< std::string, std::string > MapOfStrings
Definition: PropertyValue.h:25
Gaudi::Parsers::PropertyValue::IsReference
bool IsReference() const
Definition: PropertyValue.h:51
std::right
T right(T...args)
Containers::map
struct GAUDI_API map
Parametrisation class for map-like implementation.
Definition: KeyedObjectManager.h:25
Gaudi::Parsers::PropertyValueException::WrongRValue
static PropertyValueException WrongRValue()
Definition: PropertyValue.h:76
Gaudi::Parsers::PropertyValue::IsVector
bool IsVector() const
Definition: PropertyValue.cpp:19
Gaudi::Parsers::PropertyValue::Vector
VectorOfStrings & Vector()
Definition: PropertyValue.h:39
Gaudi::Parsers::PropertyValue::IsSimple
bool IsSimple() const
Definition: PropertyValue.cpp:15
std::find
T find(T...args)
Gaudi::Parsers::PropertyValue::IsMap
bool IsMap() const
Definition: PropertyValue.cpp:23
Gaudi::Parsers::PropertyValueException::WrongLValue
static PropertyValueException WrongLValue()
Definition: PropertyValue.h:72
Gaudi::Parsers::PropertyValue::Map
MapOfStrings & Map()
Definition: PropertyValue.h:43

const Position& Gaudi::Parsers::PropertyValue::position | ( |  | ) | const
| inline

Definition at line 34 of file PropertyValue.h.

34 { return position_;}
Gaudi::Parsers::PropertyValue::position_
Position position_
Definition: PropertyValue.h:63

std::string& Gaudi::Parsers::PropertyValue::String | ( |  | ) |
| inline

Definition at line 36 of file PropertyValue.h.

36 { return boost::get<std::string>(value_);}
Gaudi::Parsers::PropertyValue::value_
Value value_
Definition: PropertyValue.h:62

const std::string& Gaudi::Parsers::PropertyValue::String | ( |  | ) | const
| inline

Definition at line 37 of file PropertyValue.h.

37 { return boost::get<std::string>(value_);}
Gaudi::Parsers::PropertyValue::value_
Value value_
Definition: PropertyValue.h:62

std::string Gaudi::Parsers::PropertyValue::ToString | ( |  | ) | const

Definition at line 117 of file PropertyValue.cpp.

117 {
118 if (IsReference()) {
119 const std::vector<std::string>*
120 value = boost::get<std::vector<std::string> >(&value_);
121 assert(value != NULL);
122 if (value->at(0) != "") {
123 return "@"+value->at(0)+"."+value->at(1);
124 } else {
125 return "@"+value->at(0);
126 }
127 }
128 if (const std::string* value = boost::get<std::string>(&value_)) {
129 return *value;
130 } else if (const std::vector<std::string>*
131 value = boost::get<std::vector<std::string> >(&value_)) {
132 std::string result = "[";
133 std::string delim = "";
134 for (const auto& in : *value) {
135 result += delim + in;
136 delim = ", ";
137 }
138 return result+"]";
139 } else if (const std::map<std::string, std::string>*
140 value = boost::get<std::map<std::string, std::string> >(&value_)) {
141 std::string result = "{";
142 std::string delim = "";
143 for (const auto& in : *value) {
144 result += delim + in.first + ":" + in.second;
145 delim = ", ";
146 }
147 return result+"}";
148 }
149 assert(false);
150 // @todo Check the validity of this logic
151 return std::string(); // avoid compilation warning
152 }
Gaudi::Parsers::PropertyValue::IsReference
bool IsReference() const
Definition: PropertyValue.h:51
std::map< std::string, std::string >
std::string
STL class.
std::vector::at
T at(T...args)
std::vector< std::string >
GaudiPython.Persistency.get
def get(type_)
Definition: Persistency.py:23
Gaudi::Parsers::PropertyValue::value_
Value value_
Definition: PropertyValue.h:62

VectorOfStrings& Gaudi::Parsers::PropertyValue::Vector | ( |  | ) |
| inline

Definition at line 39 of file PropertyValue.h.

39 { return boost::get<VectorOfStrings>(value_);}
Gaudi::Parsers::PropertyValue::value_
Value value_
Definition: PropertyValue.h:62

const VectorOfStrings& Gaudi::Parsers::PropertyValue::Vector | ( |  | ) | const
| inline

Definition at line 40 of file PropertyValue.h.

40 {
41 return boost::get<VectorOfStrings>(value_);}
Gaudi::Parsers::PropertyValue::value_
Value value_
Definition: PropertyValue.h:62

## Member Data Documentation

bool Gaudi::Parsers::PropertyValue::is_reference_
| private

Definition at line 64 of file PropertyValue.h.

Position Gaudi::Parsers::PropertyValue::position_
| private

Definition at line 63 of file PropertyValue.h.

Value Gaudi::Parsers::PropertyValue::value_
| private

Definition at line 62 of file PropertyValue.h.

The documentation for this class was generated from the following files:

- GaudiCoreSvc/src/JobOptionsSvc/PropertyValue.h
- GaudiCoreSvc/src/JobOptionsSvc/PropertyValue.cpp