ATLAS Offline Software
Loading...
Searching...
No Matches
ObjGetterTool.icc
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5// $Id$
6/**
7 * @file D3PDMakerUtils/ObjGetterTool.icc
8 * @author scott snyder <snyder@bnl.gov>
9 * @date Aug, 2009
10 * @brief Template definitions for ObjGetterTool.
11 */
12
13
14namespace D3PD {
15
16
17/**
18 * @brief Standard Gaudi tool constructor.
19 * @param type The name of the tool type.
20 * @param name The tool name.
21 * @param parent The tool's Gaudi parent.
22 */
23template <class T>
24ObjGetterTool<T>::ObjGetterTool (const std::string& type,
25 const std::string& name,
26 const IInterface* parent)
27 : ObjGetterToolImpl (type, name, parent)
28{
29}
30
31
32/**
33 * @brief Return the target object.
34 * @param allowMissing If true, then we should not generate errors
35 * if the requested object is missing.
36 *
37 * Should be of the type given by @c typeinfo.
38 * Return 0 on failure.
39 */
40template <class T>
41const void* ObjGetterTool<T>::getUntyped (bool allowMissing /*= false*/)
42{
43 return get (allowMissing);
44}
45
46
47/**
48 * @brief Return the type of object retrieved by this tool.
49 */
50template <class T>
51const std::type_info& ObjGetterTool<T>::typeinfo() const
52{
53 return typeid(T);
54}
55
56
57/**
58 * @brief Release an object retrieved from the getter.
59 * @param p The object to release.
60 *
61 * Call this when you are done with the object returned by
62 * @c get(). The default implementation is a no-op,
63 * but if the getter dynamically allocated the object which
64 * it returned, this gives it a chance to free it.
65 */
66template <class T>
67void ObjGetterTool<T>::releaseObject (const T* /*p*/)
68{
69}
70
71
72/**
73 * @brief Release an object retrieved from the getter.
74 * @param p The object to release.
75 *
76 * Call this when you are done with the object returned by
77 * @c getUntyped(). The default implementation is a no-op,
78 * but if the getter dynamically allocated the object which
79 * it returned, this gives it a chance to free it.
80 */
81template <class T>
82void ObjGetterTool<T>::releaseObjectUntyped (const void* p)
83{
84 releaseObject (reinterpret_cast<const T*> (p));
85}
86
87
88} // namespace D3PD