The Gaudi Framework  master (37c0b60a)
GaudiConfig2.semantics.PropertySemantics Class Reference
Inheritance diagram for GaudiConfig2.semantics.PropertySemantics:
Collaboration diagram for GaudiConfig2.semantics.PropertySemantics:

Public Member Functions

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

Public Attributes

 cpp_type
 

Private Attributes

 _name
 
 _cpp_type
 

Static Private Attributes

 __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 21 of file semantics.py.

Constructor & Destructor Documentation

◆ __init__()

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

Reimplemented in GaudiConfig2.semantics.MappingSemantics, GaudiConfig2.semantics.OrderedSetSemantics, and GaudiConfig2.semantics.ComponentSemantics.

Definition at line 30 of file semantics.py.

30  def __init__(self, cpp_type):
31  self._name = None
32  self.cpp_type = cpp_type
33 

Member Function Documentation

◆ cpp_type() [1/2]

def GaudiConfig2.semantics.PropertySemantics.cpp_type (   self)

Definition at line 43 of file semantics.py.

43  def cpp_type(self):
44  return self._cpp_type
45 

◆ cpp_type() [2/2]

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

Definition at line 47 of file semantics.py.

47  def cpp_type(self, value):
48  if not any(
49  h.match(value) if hasattr(h, "match") else h == value
50  for h in self.__handled_types__
51  ):
52  raise TypeError("C++ type {!r} not supported".format(value))
53  self._cpp_type = value
54 

◆ is_set()

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

Reimplemented in GaudiConfig2.semantics.DefaultSemantics.

Definition at line 67 of file semantics.py.

67  def is_set(self, value):
68  """
69  Allow overriding the definition of "is set" if we need helper types.
70  """
71  return True
72 

◆ load()

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

Definition at line 55 of file semantics.py.

55  def load(self, value):
56  """
57  Transformation for data when reading the property.
58  """
59  return value
60 

◆ merge()

def 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.OrderedSetSemantics, and GaudiConfig2.semantics.SetSemantics.

Definition at line 81 of file semantics.py.

81  def merge(self, a, b):
82  """
83  "Merge" two values.
84 
85  Used when merging two Configurable instances, by default just ensure
86  the two values do not conflict, but it can be overridden in
87  derived semantics to, for example, append to the two lists.
88  """
89  if self.store(a) != self.store(b):
90  raise ValueError("cannot merge values %r and %r" % (a, b))
91  return a
92 
93 

◆ name() [1/2]

def GaudiConfig2.semantics.PropertySemantics.name (   self)

Reimplemented in GaudiConfig2.semantics.MappingSemantics, GaudiConfig2.semantics.SetSemantics, and GaudiConfig2.semantics.SequenceSemantics.

Definition at line 35 of file semantics.py.

35  def name(self):
36  return self._name
37 

◆ name() [2/2]

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

Reimplemented in GaudiConfig2.semantics.MappingSemantics, GaudiConfig2.semantics.SetSemantics, and GaudiConfig2.semantics.SequenceSemantics.

Definition at line 39 of file semantics.py.

39  def name(self, value):
40  self._name = value
41 

◆ opt_value()

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

Reimplemented in GaudiConfig2.semantics.MappingSemantics, GaudiConfig2.semantics.SetSemantics, and GaudiConfig2.semantics.SequenceSemantics.

Definition at line 73 of file semantics.py.

73  def opt_value(self, value):
74  """
75  Option string version of value.
76  """
77  if hasattr(value, "__opt_value__"):
78  return value.__opt_value__()
79  return value
80 

◆ store()

def GaudiConfig2.semantics.PropertySemantics.store (   self,
  value 
)
Validation/transformation of the data to be stored.

Reimplemented in GaudiConfig2.semantics.MappingSemantics, GaudiConfig2.semantics.SetSemantics, GaudiConfig2.semantics.SequenceSemantics, GaudiConfig2.semantics.ComponentSemantics, GaudiConfig2.semantics.IntSemantics, GaudiConfig2.semantics.FloatSemantics, GaudiConfig2.semantics.BoolSemantics, GaudiConfig2.semantics.StringSemantics, and GaudiConfig2.semantics.DefaultSemantics.

Definition at line 61 of file semantics.py.

61  def store(self, value):
62  """
63  Validation/transformation of the data to be stored.
64  """
65  return value
66 

Member Data Documentation

◆ __handled_types__

GaudiConfig2.semantics.PropertySemantics.__handled_types__
staticprivate

Definition at line 28 of file semantics.py.

◆ _cpp_type

GaudiConfig2.semantics.PropertySemantics._cpp_type
private

Definition at line 53 of file semantics.py.

◆ _name

GaudiConfig2.semantics.PropertySemantics._name
private

Definition at line 31 of file semantics.py.

◆ cpp_type

GaudiConfig2.semantics.PropertySemantics.cpp_type

Definition at line 32 of file semantics.py.


The documentation for this class was generated from the following file:
format
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:119
merge
int merge(const char *target, const char *source, bool fixup=false, bool dbg=true)
Definition: merge.C:430
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77