| The Gaudi Framework v32r1 (f65d50dc)

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 std::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

## ◆ MapOfStrings

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

Definition at line 24 of file PropertyValue.h.

## ◆ Value

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

Definition at line 22 of file PropertyValue.h.

## ◆ VectorOfStrings

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

Definition at line 23 of file PropertyValue.h.

## Constructor & Destructor Documentation

## ◆ PropertyValue() [1/2]

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

Definition at line 27 of file PropertyValue.h.

28 : 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:61
Gaudi::Parsers::PropertyValue::value_
Value value_
Definition: PropertyValue.h:59

## ◆ PropertyValue() [2/2]

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

Definition at line 29 of file PropertyValue.h.

30 : value_( std::move( value ) ), position_( position ), is_reference_( is_reference ) {}
Gaudi::Parsers::PropertyValue::position_
Position position_
Definition: PropertyValue.h:60
std::move
T move(T... args)
Gaudi::Parsers::PropertyValue::is_reference_
bool is_reference_
Definition: PropertyValue.h:61
Gaudi::Parsers::PropertyValue::value_
Value value_
Definition: PropertyValue.h:59
Gaudi::Parsers::PropertyValue::position
const Position & position() const
Definition: PropertyValue.h:32

## Member Function Documentation

## ◆ HasPosition()

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

Definition at line 44 of file PropertyValue.h.

44 { return position_.Exists(); }
Gaudi::Parsers::PropertyValue::position_
Position position_
Definition: PropertyValue.h:60
Gaudi::Parsers::Position::Exists
bool Exists() const
Definition: Position.h:23

## ◆ IsMap()

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

Definition at line 21 of file PropertyValue.cpp.

21 { return std::holds_alternative<std::map<std::string, std::string>>( value_ ); }
Gaudi::Parsers::PropertyValue::value_
Value value_
Definition: PropertyValue.h:59

## ◆ IsReference()

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

Definition at line 48 of file PropertyValue.h.

48 { return is_reference_; };
Gaudi::Parsers::PropertyValue::is_reference_
bool is_reference_
Definition: PropertyValue.h:61

## ◆ IsSimple()

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

Definition at line 17 of file PropertyValue.cpp.

17 { return std::holds_alternative<std::string>( value_ ); }
Gaudi::Parsers::PropertyValue::value_
Value value_
Definition: PropertyValue.h:59

## ◆ IsVector()

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

Definition at line 19 of file PropertyValue.cpp.

19 { return std::holds_alternative<std::vector<std::string>>( value_ ); }
Gaudi::Parsers::PropertyValue::value_
Value value_
Definition: PropertyValue.h:59

## ◆ Map() [1/2]

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

Definition at line 40 of file PropertyValue.h.

40 { return std::get<MapOfStrings>( value_ ); }
Gaudi::Parsers::PropertyValue::value_
Value value_
Definition: PropertyValue.h:59

## ◆ Map() [2/2]

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

Definition at line 41 of file PropertyValue.h.

41 { return std::get<MapOfStrings>( value_ ); }
Gaudi::Parsers::PropertyValue::value_
Value value_
Definition: PropertyValue.h:59

## ◆ operator+()

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

Definition at line 40 of file PropertyValue.cpp.

40 {
41 return PropertyValue{*this} += right;
42 }
Gaudi::Parsers::PropertyValue::PropertyValue
PropertyValue(Value value, bool is_reference=false)
Definition: PropertyValue.h:27
std::right
T right(T... args)

## ◆ operator+=()

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

Definition at line 23 of file PropertyValue.cpp.

23 {
24
25 if ( IsReference() ) { throw PropertyValueException::WrongLValue(); }
26 std::visit(
27 Gaudi::overload( []( std::string&, const auto& ) { throw PropertyValueException::WrongLValue(); },
28 []( std::vector<std::string>& lhs, const std::string& rhs ) { lhs.push_back( rhs ); },
29 []( std::vector<std::string>& lhs, const std::vector<std::string>& rhs ) {
30 lhs.insert( lhs.end(), rhs.begin(), rhs.end() );
31 },
32 []( std::map<std::string, std::string>& lhs, const std::map<std::string, std::string>& rhs ) {
33 lhs.insert( rhs.begin(), rhs.end() );
34 },
35 []( auto&, const auto& ) { throw PropertyValueException::WrongRValue(); } ),
36 value_, right.value_ );
37 return *this;
38 }
std::right
T right(T... args)
std::vector::end
T end(T... args)
std::map< std::string, std::string >
std::string
STL class.
std::vector::push_back
T push_back(T... args)
Gaudi::Parsers::PropertyValue::IsReference
bool IsReference() const
Definition: PropertyValue.h:48
Gaudi::Parsers::PropertyValueException::WrongRValue
static PropertyValueException WrongRValue()
Definition: PropertyValue.h:72
std::vector::insert
T insert(T... args)
std::vector< std::string >
std::string::begin
T begin(T... args)
Gaudi::Parsers::PropertyValue::value_
Value value_
Definition: PropertyValue.h:59
Gaudi::overload
auto overload(lambda_ts &&... lambdas)
Definition: compose.h:28
Gaudi::Parsers::PropertyValueException::WrongLValue
static PropertyValueException WrongLValue()
Definition: PropertyValue.h:68

## ◆ operator-()

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

Definition at line 62 of file PropertyValue.cpp.

62 {
63 return PropertyValue{*this} -= right;
64 }
Gaudi::Parsers::PropertyValue::PropertyValue
PropertyValue(Value value, bool is_reference=false)
Definition: PropertyValue.h:27
std::right
T right(T... args)

## ◆ operator-=()

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

Definition at line 44 of file PropertyValue.cpp.

44 {
45 if ( IsReference() ) { throw PropertyValueException::WrongLValue(); }
46 std::visit(
47 Gaudi::overload( []( std::vector<std::string>& lhs,
48 const std::string& rhs ) { lhs.erase( std::find( lhs.begin(), lhs.end(), rhs ) ); },
49 []( std::vector<std::string>& lhs, const std::vector<std::string>& rhs ) {
50 for ( const auto& item : rhs ) lhs.erase( std::find( lhs.begin(), lhs.end(), item ) );
51 },
52 []( std::map<std::string, std::string>& lhs, const std::string& rhs ) { lhs.erase( rhs ); },
53 []( std::map<std::string, std::string>& lhs, const std::vector<std::string>& rhs ) {
54 for ( const auto& item : rhs ) lhs.erase( item );
55 },
56 []( std::string&, const auto& ) { throw PropertyValueException::WrongLValue(); },
57 []( auto&, const auto& ) { throw PropertyValueException::WrongRValue(); } ),
58 value_, right.value_ );
59 return *this;
60 }
std::right
T right(T... args)
std::vector::end
T end(T... args)
std::map< std::string, std::string >
std::string
STL class.
Gaudi::Parsers::PropertyValue::IsReference
bool IsReference() const
Definition: PropertyValue.h:48
Gaudi::Parsers::PropertyValueException::WrongRValue
static PropertyValueException WrongRValue()
Definition: PropertyValue.h:72
std::vector::erase
T erase(T... args)
std::find
T find(T... args)
std::vector< std::string >
std::vector::begin
T begin(T... args)
Gaudi::Parsers::PropertyValue::value_
Value value_
Definition: PropertyValue.h:59
Gaudi::overload
auto overload(lambda_ts &&... lambdas)
Definition: compose.h:28
Gaudi::Parsers::PropertyValueException::WrongLValue
static PropertyValueException WrongLValue()
Definition: PropertyValue.h:68

## ◆ position()

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

Definition at line 32 of file PropertyValue.h.

32 { return position_; }
Gaudi::Parsers::PropertyValue::position_
Position position_
Definition: PropertyValue.h:60

## ◆ String() [1/2]

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

Definition at line 34 of file PropertyValue.h.

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

## ◆ String() [2/2]

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

Definition at line 35 of file PropertyValue.h.

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

## ◆ ToString()

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

Definition at line 66 of file PropertyValue.cpp.

66 {
67 if ( IsReference() ) {
68 const auto& value = std::get<std::vector<std::string>>( value_ );
69 if ( value.at( 0 ) != "" ) {
70 return "@" + value.at( 0 ) + "." + value.at( 1 );
71 } else {
72 return "@" + value.at( 0 );
73 }
74 }
75 return std::visit( Gaudi::overload( []( const std::string& v ) { return v; },
76 []( const std::vector<std::string>& v ) {
77 return '[' + boost::algorithm::join( v, ", " ) + ']';
78 },
79 []( const std::map<std::string, std::string>& v ) {
80 std::string result = "{";
81 std::string delim = "";
82 for ( const auto& in : v ) {
83 result += delim + in.first + ":" + in.second;
84 delim = ", ";
85 }
86 return result + "}";
87 } ),
88 value_ );
89 }
std::map< std::string, std::string >
std::string
STL class.
Gaudi::Parsers::PropertyValue::IsReference
bool IsReference() const
Definition: PropertyValue.h:48
std::vector< std::string >
Gaudi::Parsers::PropertyValue::value_
Value value_
Definition: PropertyValue.h:59
Gaudi::overload
auto overload(lambda_ts &&... lambdas)
Definition: compose.h:28

## ◆ Vector() [1/2]

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

Definition at line 37 of file PropertyValue.h.

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

## ◆ Vector() [2/2]

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

Definition at line 38 of file PropertyValue.h.

38 { return std::get<VectorOfStrings>( value_ ); }
Gaudi::Parsers::PropertyValue::value_
Value value_
Definition: PropertyValue.h:59

## Member Data Documentation

## ◆ is_reference_

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

Definition at line 61 of file PropertyValue.h.

## ◆ position_

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

Definition at line 60 of file PropertyValue.h.

## ◆ value_

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

Definition at line 59 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