11 #include <boost/format.hpp> 15 bool gp::PropertyValue::IsSimple()
const {
return boost::get<std::string>( &value_ ) != NULL; }
17 bool gp::PropertyValue::IsVector()
const {
return boost::get<std::vector<std::string>>( &value_ ) != NULL; }
19 bool gp::PropertyValue::IsMap()
const {
return boost::get<std::map<std::string, std::string>>( &value_ ) != NULL; }
21 gp::PropertyValue& gp::PropertyValue::operator+=(
const PropertyValue& right ) {
23 if ( IsSimple() || IsReference() ) {
throw PropertyValueException::WrongLValue(); }
27 boost::get<VectorOfStrings>( value_ ).
push_back( boost::get<std::string>( right.
value_ ) );
32 for (
const auto& item : boost::get<VectorOfStrings>( right.
value_ ) ) { vec.
push_back( item ); }
35 throw PropertyValueException::WrongRValue();
39 if ( !right.
IsMap() ) {
throw PropertyValueException::WrongRValue(); }
42 for (
const auto& item : rmap ) { map.
insert( item ); }
52 gp::PropertyValue& gp::PropertyValue::operator-=(
const PropertyValue& right ) {
53 if ( IsSimple() || IsReference() ) {
throw PropertyValueException::WrongLValue(); }
67 throw PropertyValueException::WrongRValue();
79 for (
const auto& item : rvec ) { map.
erase( item ); }
82 throw PropertyValueException::WrongRValue();
84 throw PropertyValueException::WrongLValue();
92 if ( IsReference() ) {
94 assert( value != NULL );
95 if ( value->
at( 0 ) !=
"" ) {
96 return "@" + value->
at( 0 ) +
"." + value->
at( 1 );
98 return "@" + value->
at( 0 );
101 if (
const std::string* value = boost::get<std::string>( &value_ ) ) {
106 for (
const auto& in : *value ) {
107 result += delim + in;
115 for (
const auto& in : *value ) {
116 result += delim + in.first +
":" + in.second;
void push_back(Container &c, const Value &v, std::true_type)
struct GAUDI_API map
Parametrisation class for map-like implementation.
KeyedObjectManager< vector > Vector
Forward declaration of specialized std::vector-like object manager.
VectorOfStrings & Vector()
decltype(auto) operator+(const T &v, const Property< TP, V, H > &p)
implemantation of (value + property)
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.