ATLAS Offline Software
Loading...
Searching...
No Matches
BlockFillerTool.icc
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4/**
5 * @file D3PDMakerUtils/BlockFillerTool.h
6 * @author scott snyder <snyder@bnl.gov>
7 * @date Aug, 2009
8 * @brief Template definitions for BlockFillerTool.
9 */
10
11
12namespace D3PD {
13
14
15/**
16 * @brief Configure during initialization: type-check.
17 * @param tree Our parent for tuple making.
18 * @param ti Gives the type of the object being passed to @c fillUntyped.
19 *
20 * @c configureD3PD should check that the type of the object coming as input
21 * is compatible with what it expects, and raise an error otherwise.
22 */
23template <class T>
24StatusCode
25BlockFillerTool<T>::configureD3PD (IAddVariable* tree,
26 const std::type_info& ti)
27{
28 return configureImpl (tree, ti, typeid(T));
29}
30
31
32/**
33 * @brief Fill one block.
34 * @param p The input object.
35 * @param again Set if this is a subsequent call requested by an AGAIN return
36 *
37 * This is called once per object. The type of the object at which @c p
38 * points is given by the @c ti argument to @c configureD3PD. The caller
39 * is responsible for arranging that all the pointers for booked variables
40 * are set appropriately upon entry.
41 *
42 * If the return status is the special code @c AGAIN (defined above),
43 * then this filler tool wants to make multiple entries.
44 * The parent should set up to capture a new `row' and run
45 * through the list of block filler
46 * tools again, but for this tool call @c fillAgainUntyped
47 * instead of @c fillUntyped. This should be repeated as long
48 * as @c fillAgainUntyped returns @c AGAIN.
49 *
50 * Once @c fillUntyped returns @c AGAIN, the parent should
51 * call @c fillUntyped with the same @a p argument and @c again
52 * set to @c true. This continues until @c fillUntyped returns something
53 * other than @c AGAIN.
54 *
55 * Not all parents may support this. In that case, returning
56 * @c AGAIN will be treated as an error.
57 */
58template <class T>
59StatusCode
60BlockFillerTool<T>::fillUntyped (const void* p,
61 bool again /*= false*/)
62{
63 if (!p) return StatusCode::SUCCESS;
64 StatusCode stat = convert (p);
65 if (stat.isFailure())
66 return stat;
67 if (again)
68 return fillAgain (*reinterpret_cast<const T*> (p));
69 return fill (*reinterpret_cast<const T*> (p));
70}
71
72
73
74/**
75 * @brief Fill one block, after @c AGAIN has been returned (type-safe).
76 * @param p The input object.
77 *
78 * Once @c fill returns @c AGAIN, the parent should
79 * call @c fillAgain with the same arguments.
80 * This continues until @c fillAgain returns something
81 * other than @c AGAIN.
82 *
83 * By default, this just calls @c fill().
84 */
85template <class T>
86StatusCode BlockFillerTool<T>::fillAgain (const T& p)
87{
88 return this->fill (p);
89}
90
91
92} // namespace D3PD