The Gaudi Framework  master (905e8f18)
Loading...
Searching...
No Matches
GaudiConfig2._configurables.Property Class Reference
Inheritance diagram for GaudiConfig2._configurables.Property:
Collaboration diagram for GaudiConfig2._configurables.Property:

Public Member Functions

 __init__ (self, cpp_type, default, doc="undocumented", semantics=None)
 
 cpp_type (self)
 
 name (self)
 
 __get__ (self, instance, owner)
 
 __set__ (self, instance, value)
 
 __delete__ (self, instance)
 
 __set_name__ (self, owner, name)
 
 __is_set__ (self, instance, owner)
 
 __opt_value__ (self, instance, owner)
 
 __merge__ (self, instance, owner, value)
 

Public Attributes

 semantics = getSemanticsFor(cpp_type)
 
 default = default
 
 name
 

Private Attributes

 __doc__ = doc
 

Detailed Description

Descriptor class to implement validation of Configurable properties.

Definition at line 31 of file _configurables.py.

Constructor & Destructor Documentation

◆ __init__()

GaudiConfig2._configurables.Property.__init__ ( self,
cpp_type,
default,
doc = "undocumented",
semantics = None )

Definition at line 36 of file _configurables.py.

36 def __init__(self, cpp_type, default, doc="undocumented", semantics=None):
37 from .semantics import getSemanticsFor
38
39 if semantics is None:
40 self.semantics = getSemanticsFor(cpp_type)
41 else:
42 self.semantics = getSemanticsFor(semantics, strict=True)
43
44 self.default = default
45 self.__doc__ = doc
46

Member Function Documentation

◆ __delete__()

GaudiConfig2._configurables.Property.__delete__ ( self,
instance )

Definition at line 64 of file _configurables.py.

64 def __delete__(self, instance):
65 del instance._properties[self.name]
66

◆ __get__()

GaudiConfig2._configurables.Property.__get__ ( self,
instance,
owner )

Definition at line 55 of file _configurables.py.

55 def __get__(self, instance, owner):
56 name = self.name # cache lookup
57 if name not in instance._properties and hasattr(self.semantics, "default"):
58 instance._properties[name] = self.semantics.default(self.default)
59 return self.semantics.load(instance._properties.get(name, self.default))
60

◆ __is_set__()

GaudiConfig2._configurables.Property.__is_set__ ( self,
instance,
owner )

Definition at line 70 of file _configurables.py.

70 def __is_set__(self, instance, owner):
71 try:
72 value = instance._properties[self.name]
73 return self.semantics.is_set(value)
74 except KeyError:
75 return False
76

◆ __merge__()

GaudiConfig2._configurables.Property.__merge__ ( self,
instance,
owner,
value )
Return "merge" (according to the semantic) of the value
in this property and the incoming value.

Definition at line 82 of file _configurables.py.

82 def __merge__(self, instance, owner, value):
83 """
84 Return "merge" (according to the semantic) of the value
85 in this property and the incoming value.
86 """
87 if not self.__is_set__(instance, owner):
88 return value
89 return self.semantics.merge(self.__get__(instance, owner), value)
90
91
int merge(const char *target, const char *source, bool fixup=false, bool dbg=true)
Definition merge.C:417

◆ __opt_value__()

GaudiConfig2._configurables.Property.__opt_value__ ( self,
instance,
owner )

Definition at line 77 of file _configurables.py.

77 def __opt_value__(self, instance, owner):
78 return self.semantics.opt_value(
79 instance._properties.get(self.name, self.default)
80 )
81

◆ __set__()

GaudiConfig2._configurables.Property.__set__ ( self,
instance,
value )

Definition at line 61 of file _configurables.py.

61 def __set__(self, instance, value):
62 instance._properties[self.name] = self.semantics.store(value)
63

◆ __set_name__()

GaudiConfig2._configurables.Property.__set_name__ ( self,
owner,
name )

Definition at line 67 of file _configurables.py.

67 def __set_name__(self, owner, name):
68 self.semantics.name = name
69

◆ cpp_type()

GaudiConfig2._configurables.Property.cpp_type ( self)

Definition at line 48 of file _configurables.py.

48 def cpp_type(self):
49 return self.semantics.cpp_type
50

◆ name()

GaudiConfig2._configurables.Property.name ( self)

Definition at line 52 of file _configurables.py.

52 def name(self):
53 return self.semantics.name
54

Member Data Documentation

◆ __doc__

GaudiConfig2._configurables.Property.__doc__ = doc
private

Definition at line 45 of file _configurables.py.

◆ default

GaudiConfig2._configurables.Property.default = default

Definition at line 44 of file _configurables.py.

◆ name

GaudiConfig2._configurables.Property.name

Definition at line 79 of file _configurables.py.

◆ semantics

GaudiConfig2._configurables.Property.semantics = getSemanticsFor(cpp_type)

Definition at line 40 of file _configurables.py.


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