ATLAS Offline Software
Loading...
Searching...
No Matches
python.D3PDObject.DeferArg Class Reference
Inheritance diagram for python.D3PDObject.DeferArg:
Collaboration diagram for python.D3PDObject.DeferArg:

Public Types

typedef HLT::TypeInformation::for_each_type_c< typenameEDMLIST::map, my_functor, my_result<>, my_arg< HLT::TypeInformation::get_cont, CONTAINER > >::type result

Public Member Functions

 __init__ (self, str, gdict=globals(), **kw)
 __call__ (self, hookargs={}, **kw)

Public Attributes

 str = str
 gdict = gdict
 kw = kw

Detailed Description

Defer evaluating a block argument until the D3PDObject is instantiated.

Sometimes you want to pass an argument to a block function that isn't
known at the time the D3PDObject is defined, for example the
StoreGate key to use.  You could do this with a hook function
or a LOD function, but that's a bit cumbersome.  Instead, you can
use DeferArg.  DeferArg stores a string.  If a block argument
has a value that's an instance of DeferArg, then this string
is evaluated at the time the D3PDObject is instantiated.
The arguments passed to the D3PDObject will be available
in the context in which the string is evaluated.
A global dictionary may be provided as an optional argument;
any additional keyword arguments will be merged into this
dictionary.

Example:

  FooD3PDObject.defineBlock (1, 'SomeBlock', SomeTool,
                             Name = DeferArg ('"name_" + sgkey'))

If FooD3PDObject is then instantiated with a StoreGate key of `Bar',
then the Name argument of this block will be set to `name_Bar'.

Definition at line 59 of file D3PDObject.py.

Member Typedef Documentation

◆ result

Definition at line 90 of file EDM_MasterSearch.h.

Constructor & Destructor Documentation

◆ __init__()

python.D3PDObject.DeferArg.__init__ ( self,
str,
gdict = globals(),
** kw )

Definition at line 83 of file D3PDObject.py.

83 def __init__ (self, str, gdict = globals(), **kw): # noqa: B008 (globals is already a global ref.)
84 self.str = str
85 self.gdict = gdict
86 self.kw = kw
87 return
88
89

Member Function Documentation

◆ __call__()

python.D3PDObject.DeferArg.__call__ ( self,
hookargs = {},
** kw )

Definition at line 90 of file D3PDObject.py.

90 def __call__ (self, hookargs = {}, **kw):
91 gdict = self.gdict.copy()
92 gdict.update (self.kw)
93 hookargs = hookargs.copy()
94 hookargs.update (kw)
95 return eval (self.str, gdict, hookargs)
96
97
98

Member Data Documentation

◆ gdict

python.D3PDObject.DeferArg.gdict = gdict

Definition at line 85 of file D3PDObject.py.

◆ kw

python.D3PDObject.DeferArg.kw = kw

Definition at line 86 of file D3PDObject.py.

◆ str

python.D3PDObject.DeferArg.str = str

Definition at line 84 of file D3PDObject.py.


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