27 **kw):
28
29 """Helper for setting up an association via an index.
30
31 parent: The parent D3PDobject or block.
32 assoctool: The class for the (single) association tool.
33 target: The label for the getter within which we look up the index,
34 or a list of such labels if multiple targets are desired.
35 prefix: Prefix to add to the contained variables, if any.
36 level: Level of detail for the block.
37 blockname: Name for the block.
38 allowMissing: If true, then it is not considered an error for the
39 target getter to fail to find the input objects.
40 nrowName: Name of the variable for the count of objects.
41 Omitted if empty.
42
43 Extra arguments are passed to the association tool.
44"""
45
46 if blockname is None:
47 blockname = assoctool.__name__
48
49 def maker (name, prefix, object_name, **kw2):
50 this_target = target
51 if 'target' in kw2:
52 this_target = kw2['target']
53 del kw2['target']
54
55 if this_target == '':
56 this_target = []
57 elif not isinstance(this_target, list):
58 this_target = [ this_target ]
59
60 assoc = assoctool (name + 'Assoc', **kw2)
62 (name,
63 Prefix = prefix,
64 Associator = assoc,
65 NrowName = nrowName)
67 (name + 'Index',
68 Targets = this_target,
69 ContainerIndexName = containerIndexName,
70 AllowMissing = allowMissing)
71 filler.BlockFillers += [indexer]
72 return filler
73
74 obj = D3PDObject (maker, prefix)
75 parent.defineBlock (level, blockname, obj, **kw)
76 return obj