The Gaudi Framework  v36r1 (3e2fb5a8)
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, name=None)
 
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

 name
 
 cpp_type
 

Private Attributes

 _cpp_type
 

Static Private Attributes

tuple __handled_types__ = (re.compile(r'.*'), )
 

Detailed Description

Basic property semantics implementation, with no validation/transformation.

Definition at line 28 of file semantics.py.

Constructor & Destructor Documentation

◆ __init__()

def GaudiConfig2.semantics.PropertySemantics.__init__ (   self,
  cpp_type,
  name = None 
)

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

Definition at line 34 of file semantics.py.

34  def __init__(self, cpp_type, name=None):
35  self.name = None
36  self.cpp_type = cpp_type
37 

Member Function Documentation

◆ cpp_type() [1/2]

def GaudiConfig2.semantics.PropertySemantics.cpp_type (   self)

Definition at line 39 of file semantics.py.

39  def cpp_type(self):
40  return self._cpp_type
41 

◆ cpp_type() [2/2]

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

Definition at line 43 of file semantics.py.

43  def cpp_type(self, value):
44  if not any(
45  h.match(value) if hasattr(h, 'match') else h == value
46  for h in self.__handled_types__):
47  raise TypeError('C++ type {!r} not supported'.format(value))
48  self._cpp_type = value
49 

◆ is_set()

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

Definition at line 62 of file semantics.py.

62  def is_set(self, value):
63  '''
64  Allow overriding the definition of "is set" if we need helper types.
65  '''
66  return True
67 

◆ load()

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

Definition at line 50 of file semantics.py.

50  def load(self, value):
51  '''
52  Transformation for data when reading the property.
53  '''
54  return value
55 

◆ 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.

Definition at line 76 of file semantics.py.

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

◆ opt_value()

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

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

Definition at line 68 of file semantics.py.

68  def opt_value(self, value):
69  '''
70  Option string version of value.
71  '''
72  if hasattr(value, '__opt_value__'):
73  return value.__opt_value__()
74  return value
75 

◆ store()

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

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

Definition at line 56 of file semantics.py.

56  def store(self, value):
57  '''
58  Validation/transformation of the data to be stored.
59  '''
60  return value
61 

Member Data Documentation

◆ __handled_types__

tuple GaudiConfig2.semantics.PropertySemantics.__handled_types__ = (re.compile(r'.*'), )
staticprivate

Definition at line 32 of file semantics.py.

◆ _cpp_type

GaudiConfig2.semantics.PropertySemantics._cpp_type
private

Definition at line 48 of file semantics.py.

◆ cpp_type

GaudiConfig2.semantics.PropertySemantics.cpp_type

Definition at line 36 of file semantics.py.

◆ name

GaudiConfig2.semantics.PropertySemantics.name

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