The Gaudi Framework  master (76fc3702)
Loading...
Searching...
No Matches
GaudiConfig2.semantics.PropertySemantics Class Reference
Inheritance diagram for GaudiConfig2.semantics.PropertySemantics:
Collaboration diagram for GaudiConfig2.semantics.PropertySemantics:

Public Member Functions

 __init__ (self, cpp_type)
 name (self)
 name (self, value)
 cpp_type (self)
 cpp_type (self, value)
 load (self, value)
 store (self, value)
 is_set (self, value)
 opt_value (self, value)
 merge (self, a, b)

Public Attributes

 cpp_type = cpp_type

Protected Attributes

 _name = None
 _cpp_type = value

Static Private Attributes

tuple __handled_types__ = ()

Detailed Description

Basic property semantics implementation, with no validation/transformation.

Not to be used directly for any actual property, use only specializations.

Definition at line 28 of file semantics.py.

Constructor & Destructor Documentation

◆ __init__()

GaudiConfig2.semantics.PropertySemantics.__init__ ( self,
cpp_type )

Definition at line 37 of file semantics.py.

37 def __init__(self, cpp_type):
38 self._name = None
39 self.cpp_type = cpp_type
40

Member Function Documentation

◆ cpp_type() [1/2]

GaudiConfig2.semantics.PropertySemantics.cpp_type ( self)

Definition at line 50 of file semantics.py.

50 def cpp_type(self):
51 return self._cpp_type
52

◆ cpp_type() [2/2]

GaudiConfig2.semantics.PropertySemantics.cpp_type ( self,
value )

Definition at line 54 of file semantics.py.

54 def cpp_type(self, value):
55 if not any(
56 h.match(value) if hasattr(h, "match") else h == value
57 for h in self.__handled_types__
58 ):
59 raise TypeError("C++ type {!r} not supported".format(value))
60 self._cpp_type = value
61
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition MsgStream.cpp:93

◆ is_set()

GaudiConfig2.semantics.PropertySemantics.is_set ( self,
value )
Allow overriding the definition of "is set" if we need helper types.

Reimplemented in GaudiConfig2.semantics.DefaultSemantics, and GaudiConfig2.semantics.JSONSemantics.

Definition at line 74 of file semantics.py.

74 def is_set(self, value):
75 """
76 Allow overriding the definition of "is set" if we need helper types.
77 """
78 return True
79

◆ load()

GaudiConfig2.semantics.PropertySemantics.load ( self,
value )
Transformation for data when reading the property.

Reimplemented in GaudiConfig2.semantics.JSONSemantics.

Definition at line 62 of file semantics.py.

62 def load(self, value):
63 """
64 Transformation for data when reading the property.
65 """
66 return value
67

◆ merge()

GaudiConfig2.semantics.PropertySemantics.merge ( self,
a,
b )
"Merge" two values.

Used when merging two Configurable instances, by default just ensure
the two values do not conflict, but it can be overridden in
derived semantics to, for example, append to the two lists.

Reimplemented in GaudiConfig2.semantics.ComponentHandleSemantics, GaudiConfig2.semantics.GaudiHandleArraySemantics, GaudiConfig2.semantics.MappingSemantics, GaudiConfig2.semantics.OrderedSetSemantics, and GaudiConfig2.semantics.SetSemantics.

Definition at line 88 of file semantics.py.

88 def merge(self, a, b):
89 """
90 "Merge" two values.
91
92 Used when merging two Configurable instances, by default just ensure
93 the two values do not conflict, but it can be overridden in
94 derived semantics to, for example, append to the two lists.
95 """
96 if self.store(a) != self.store(b):
97 raise ValueError("cannot merge values %r and %r" % (a, b))
98 return a
99
100
int merge(const char *target, const char *source, bool fixup=false, bool dbg=true)
Definition merge.C:417

◆ name() [1/2]

◆ name() [2/2]

GaudiConfig2.semantics.PropertySemantics.name ( self,
value )

◆ opt_value()

GaudiConfig2.semantics.PropertySemantics.opt_value ( self,
value )
Option string version of value.

Reimplemented in GaudiConfig2.semantics.DataHandleSemantics, GaudiConfig2.semantics.GaudiHandleArraySemantics, GaudiConfig2.semantics.JSONSemantics, GaudiConfig2.semantics.MappingSemantics, GaudiConfig2.semantics.SequenceSemantics, and GaudiConfig2.semantics.SetSemantics.

Definition at line 80 of file semantics.py.

80 def opt_value(self, value):
81 """
82 Option string version of value.
83 """
84 if hasattr(value, "__opt_value__"):
85 return value.__opt_value__()
86 return value
87

◆ store()

Member Data Documentation

◆ __handled_types__

tuple GaudiConfig2.semantics.PropertySemantics.__handled_types__ = ()
staticprivate

Definition at line 35 of file semantics.py.

◆ _cpp_type

GaudiConfig2.semantics.PropertySemantics._cpp_type = value
protected

Definition at line 60 of file semantics.py.

◆ _name

GaudiConfig2.semantics.PropertySemantics._name = None
protected

Definition at line 38 of file semantics.py.

◆ cpp_type

GaudiConfig2.semantics.PropertySemantics.cpp_type = cpp_type

Definition at line 39 of file semantics.py.


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