2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
7 * @file D3PDMakerInterfaces/IObjGetterTool.icc
8 * @author scott snyder <snyder@bnl.gov>
10 * @brief Template implementations for IObjGetterTool.
18 * @brief Type-safe wrapper for @c get.
19 * @param allowMissing If true, then we should not generate errors
20 * if the requested object is missing.
22 * Return the object as a pointer to @c T.
23 * Return 0 if the get fails or if the pointer can't be converted.
25 * This is implemented in terms of @c getTypeinfo().
28 const T* IObjGetterTool::get (bool allowMissing /*= false*/)
30 return reinterpret_cast<const T*> (this->getTypeinfo (typeid(T),
36 * @brief Test type compatibility.
38 * Test to see if the object being returned by the tool can be converted
39 * to a pointer to @c T. This can be used to perform type checks during job
42 * This is implemented in terms of @c configureTypeinfo.
45 StatusCode IObjGetterTool::configureD3PD()
47 return this->configureTypeinfo (typeid(T));
52 * @brief Release an object retrieved from the getter.
53 * @param p The object to release.
55 * Call this when you are done with the object returned by
56 * @c getUntyped(). The default implementation is a no-op,
57 * but if the getter dynamically allocated the object which
58 * it returned, this gives it a chance to free it.
61 void IObjGetterTool::releaseObjectUntyped (const void* /*p*/)
67 * @brief Release an object retrieved from the getter.
68 * @param p The object to release.
69 * @param ti The type of p.
71 * Call this when you are done with the object returned by
72 * @c getUntyped(). The default implementation is a no-op,
73 * but if the getter dynamically allocated the object which
74 * it returned, this gives it a chance to free it.
77 void IObjGetterTool::releaseObjectTypeinfo (const void* /*p*/,
78 const std::type_info& /*ti*/)
84 * @brief Type-safe wrapper for @c releaseObjectUntyped.
85 * @param p The object to release.
87 * Call this when you are done with the object returned by
88 * @c get(). The default implementation is a no-op,
89 * but if the getter dynamically allocated the object which
90 * it returned, this gives it a chance to free it.
92 * This is implemented in terms of @c releaseObjectTypeinfo().
95 void IObjGetterTool::releaseObject (const T* p)
97 this->releaseObjectTypeinfo (p, typeid(T));