12 #include <boost/format.hpp>
13 #include <boost/foreach.hpp>
15 namespace gp = Gaudi::Parsers;
17 bool gp::PropertyValue::IsSimple()
const {
18 return boost::get<std::string>(&value_) != NULL;
21 bool gp::PropertyValue::IsVector()
const {
22 return boost::get<std::vector<std::string> >(&value_) != NULL;
25 bool gp::PropertyValue::IsMap()
const {
26 return boost::get<std::map<std::string, std::string> >(&value_) != NULL;
32 if (IsSimple() || IsReference()) {
33 throw PropertyValueException::WrongLValue();
38 boost::get<VectorOfStrings>(value_).push_back(
39 boost::get<std::string>(right.
value_));
44 BOOST_FOREACH(
const std::string&
item,
45 boost::get<VectorOfStrings>(right.
value_)) {
50 throw PropertyValueException::WrongRValue();
55 throw PropertyValueException::WrongRValue();
59 BOOST_FOREACH(
const MapOfStrings::value_type&
item, rmap) {
67 const gp::PropertyValue
75 if (IsSimple() || IsReference()) {
76 throw PropertyValueException::WrongLValue();
82 vec.erase(std::find(vec.begin(), vec.end(), right.
String()));
88 BOOST_FOREACH(
const std::string&
item, rvec) {
89 vec.erase(std::find(vec.begin(), vec.end(),
item));
93 throw PropertyValueException::WrongRValue();
105 BOOST_FOREACH(
const std::string&
item, rvec) {
110 throw PropertyValueException::WrongRValue();
112 throw PropertyValueException::WrongLValue();
115 const gp::PropertyValue
120 std::string gp::PropertyValue::ToString()
const {
122 const std::vector<std::string>*
123 value = boost::get<std::vector<std::string> >(&value_);
124 assert(value != NULL);
125 if (value->at(0) !=
"") {
126 return "@"+value->at(0)+
"."+value->at(1);
128 return "@"+value->at(0);
131 if (
const std::string*
value = boost::get<std::string>(&value_)) {
133 }
else if (
const std::vector<std::string>*
135 std::string result =
"[";
136 std::string delim =
"";
137 BOOST_FOREACH(
const std::string& in, *
value) {
138 result += delim + in;
142 }
else if (
const std::map<std::string, std::string>*
144 std::string result =
"{";
145 std::string delim =
"";
146 typedef std::pair<std::string, std::string> pair_t;
147 BOOST_FOREACH(
const pair_t& in, *
value) {
148 result += delim + in.first +
":" + in.second;
155 return std::string();
std::vector< std::string > VectorOfStrings
std::map< std::string, std::string > MapOfStrings
KeyedObjectManager< vector > Vector
Forward declaration of specialized std::vector-like object manager.
struct GAUDI_API map
Parametrisation class for map-like implementation.
VectorOfStrings & Vector()
GAUDI_API Stat operator+(const Stat &stat, const double value)
external operator for addition of Stat and a number
GAUDI_API Stat operator-(const Stat &stat, const double value)
external operator for subtraction of Stat and a number
KeyedObjectManager< map > Map
Forward declaration of specialized std::map-like object manager.