| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

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

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Member Functions | Private Attributes | List of all members
Gaudi::Parsers::PropertyValue Class Reference

`#include <PropertyValue.h>`

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

## Public Types
typedef boost::scoped_ptr < PropertyValue > | ScopedPtr
typedef boost::scoped_ptr < const PropertyValue > | ConstScopedPtr
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 (const Value &value, bool is_reference=false)
| PropertyValue (const 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 21 of file PropertyValue.h.

## Member Typedef Documentation

typedef boost::scoped_ptr<const PropertyValue> Gaudi::Parsers::PropertyValue::ConstScopedPtr

Definition at line 25 of file PropertyValue.h.

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

Definition at line 30 of file PropertyValue.h.

typedef boost::scoped_ptr<PropertyValue> Gaudi::Parsers::PropertyValue::ScopedPtr

Definition at line 24 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 28 of file PropertyValue.h.

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

Definition at line 29 of file PropertyValue.h.

## Constructor & Destructor Documentation

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

Definition at line 33 of file PropertyValue.h.

: value_(value), is_reference_(is_reference) {}

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

Definition at line 35 of file PropertyValue.h.

: value_(value), position_(position),
is_reference_(is_reference) {}

## Member Function Documentation

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

Definition at line 52 of file PropertyValue.h.

{return position_.Exists();}

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

Definition at line 25 of file PropertyValue.cpp.

{
return boost::get<std::map<std::string, std::string> >(&value_) != NULL;
}

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

Definition at line 56 of file PropertyValue.h.

{ return is_reference_;};

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

Definition at line 17 of file PropertyValue.cpp.

{
return boost::get<std::string>(&value_) != NULL;
}

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

Definition at line 21 of file PropertyValue.cpp.

{
return boost::get<std::vector<std::string> >(&value_) != NULL;
}

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

Definition at line 48 of file PropertyValue.h.

{ return boost::get<MapOfStrings>(value_);}

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

Definition at line 49 of file PropertyValue.h.

{ return boost::get<MapOfStrings>(value_);}

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

Definition at line 68 of file PropertyValue.cpp.

{
return PropertyValue(*this) += right;
}

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

Definition at line 30 of file PropertyValue.cpp.

{
if (IsSimple() || IsReference()) {
throw PropertyValueException::WrongLValue();
}
if (IsVector()) {
if (right.IsSimple()) {
boost::get<VectorOfStrings>(value_).push_back(
boost::get<std::string>(right.value_));
return *this;
}
if (right.IsVector()){
VectorOfStrings& vec = boost::get<VectorOfStrings>(value_);
BOOST_FOREACH(const std::string& item,
boost::get<VectorOfStrings>(right.value_)) {
vec.push_back(item);
}
return *this;
}
throw PropertyValueException::WrongRValue();
}
if (IsMap()) {
if (!right.IsMap()) {
throw PropertyValueException::WrongRValue();
}
MapOfStrings& map = boost::get<MapOfStrings>(value_);
const MapOfStrings& rmap = boost::get<MapOfStrings>(right.value_);
BOOST_FOREACH(const MapOfStrings::value_type& item, rmap) {
map.insert(item);
}
return *this;
}
return *this;
}

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

Definition at line 116 of file PropertyValue.cpp.

{
return PropertyValue(*this) -= right;
}

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

Definition at line 74 of file PropertyValue.cpp.

{
if (IsSimple() || IsReference()) {
throw PropertyValueException::WrongLValue();
}
if (IsVector()) {
VectorOfStrings& vec = Vector();
if (right.IsSimple()) {
vec.erase(std::find(vec.begin(), vec.end(), right.String()));
return *this;
}
if (right.IsVector()) {
const VectorOfStrings& rvec = right.Vector();
BOOST_FOREACH(const std::string& item, rvec) {
vec.erase(std::find(vec.begin(), vec.end(), item));
}
return *this;
}
throw PropertyValueException::WrongRValue();
}
if (IsMap()) {
MapOfStrings& map = Map();
if (right.IsSimple()) {
map.erase(right.String());
return *this;
}
if (right.IsVector()) {
const VectorOfStrings& rvec = right.Vector();
BOOST_FOREACH(const std::string& item, rvec) {
map.erase(item);
}
return *this;
}
throw PropertyValueException::WrongRValue();
}
throw PropertyValueException::WrongLValue();
}

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

Definition at line 39 of file PropertyValue.h.

{ return position_;}

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

Definition at line 41 of file PropertyValue.h.

{ return boost::get<std::string>(value_);}

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

Definition at line 42 of file PropertyValue.h.

{ return boost::get<std::string>(value_);}

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

Definition at line 120 of file PropertyValue.cpp.

{
if (IsReference()) {
const std::vector<std::string>*
value = boost::get<std::vector<std::string> >(&value_);
assert(value != NULL);
if (value->at(0) != "") {
return "@"+value->at(0)+"."+value->at(1);
} else {
return "@"+value->at(0);
}
}
if (const std::string* value = boost::get<std::string>(&value_)) {
return *value;
} else if (const std::vector<std::string>*
value = boost::get<std::vector<std::string> >(&value_)) {
std::string result = "[";
std::string delim = "";
BOOST_FOREACH(const std::string& in, *value) {
result += delim + in;
delim = ", ";
}
return result+"]";
} else if (const std::map<std::string, std::string>*
value = boost::get<std::map<std::string, std::string> >(&value_)) {
std::string result = "{";
std::string delim = "";
typedef std::pair<std::string, std::string> pair_t;
BOOST_FOREACH(const pair_t& in, *value) {
result += delim + in.first + ":" + in.second;
delim = ", ";
}
return result+"}";
}
assert(false);
// @todo Check the validity of this logic
return std::string(); // avoid compilation warning
}

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

Definition at line 44 of file PropertyValue.h.

{ return boost::get<VectorOfStrings>(value_);}

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

Definition at line 45 of file PropertyValue.h.

{
return boost::get<VectorOfStrings>(value_);}

## Member Data Documentation

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

Definition at line 69 of file PropertyValue.h.

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

Definition at line 68 of file PropertyValue.h.

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

Definition at line 67 of file PropertyValue.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiCoreSvc/src/JobOptionsSvc/PropertyValue.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiCoreSvc/src/JobOptionsSvc/PropertyValue.cpp