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

Public Member Functions

 default (self, value)
 
 store (self, value)
 
 is_set (self, value)
 
- Public Member Functions inherited from GaudiConfig2.semantics.PropertySemantics
 __init__ (self, cpp_type)
 
 name (self)
 
 name (self, value)
 
 cpp_type (self)
 
 cpp_type (self, value)
 
 load (self, value)
 
 opt_value (self, value)
 
 merge (self, a, b)
 

Protected Attributes

 _default = value
 
bool _is_set = False
 
- Protected Attributes inherited from GaudiConfig2.semantics.PropertySemantics
 _name = None
 
 _cpp_type = value
 

Static Private Attributes

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

Additional Inherited Members

- Public Attributes inherited from GaudiConfig2.semantics.PropertySemantics
 cpp_type = cpp_type
 

Detailed Description

Special semantics that makes a deep copy of the default value on first access
and considers a property set if its value is different from the default.

This semantics is meant to be used whenever there is no specific semantic
(with proper change detection) implemented for a type.

Definition at line 100 of file semantics.py.

Member Function Documentation

◆ default()

GaudiConfig2.semantics.DefaultSemantics.default ( self,
value )

Definition at line 111 of file semantics.py.

111 def default(self, value):
112 # remember the default value we got and return a copy
113 self._default = value
114 self._is_set = False
115 return copy.deepcopy(value)
116

◆ is_set()

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

Reimplemented from GaudiConfig2.semantics.PropertySemantics.

Definition at line 122 of file semantics.py.

122 def is_set(self, value):
123 try:
124 # we assume the property was set if it was changed
125 return self._is_set or self._default != value
126 except AttributeError:
127 # either self._is_set or self._default is not defined,
128 # so the value was not explicitly set nor modified
129 # from the default
130 return False
131
132

◆ store()

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

Reimplemented from GaudiConfig2.semantics.PropertySemantics.

Reimplemented in GaudiConfig2.semantics.GaudiHandleArraySemantics.

Definition at line 117 of file semantics.py.

117 def store(self, value):
118 # flag that the value was explicitly set
119 self._is_set = True
120 return super(DefaultSemantics, self).store(value)
121

Member Data Documentation

◆ __handled_types__

tuple GaudiConfig2.semantics.DefaultSemantics.__handled_types__ = (re.compile(r".*"),)
staticprivate

Definition at line 109 of file semantics.py.

◆ _default

GaudiConfig2.semantics.DefaultSemantics._default = value
protected

Definition at line 113 of file semantics.py.

◆ _is_set

bool GaudiConfig2.semantics.DefaultSemantics._is_set = False
protected

Definition at line 114 of file semantics.py.


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