2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5 * @file D3PDMakerUtils/MultiAssociationTool.icc
6 * @author scott snyder <snyder@bnl.gov>
8 * @brief Type-safe wrapper for multiple-target associator tools.
16 * @brief Return the element type for the target of the association.
18 * I.e., @c nextUntyped returns a pointer to this type.
20 template <typename TO_T>
22 MultiAssociationToolTo<TO_T>::elementTypeinfo () const
29 * @brief Return a pointer to the next element in the association.
31 * Return 0 when the association has been exhausted.
33 template <typename TO_T>
35 MultiAssociationToolTo<TO_T>::nextUntyped ()
42 * @brief Release an object retrieved from the association.
43 * @param p The object to release.
45 * Call this when you are done with the object returned by
46 * @c next(). The default implementation is a no-op,
47 * but if the association dynamically allocated the object which
48 * it returned, this gives it a chance to free it.
50 template <typename TO_T>
51 void MultiAssociationToolTo<TO_T>::releaseElement (const TO_T* /*p*/)
57 * @brief Release an object retrieved from the association.
58 * @param p The object to release.
60 * Call this when you are done with the object returned by
61 * @c nextUntyped(). The default implementation is a no-op,
62 * but if the association dynamically allocated the object which
63 * it returned, this gives it a chance to free it.
65 template <typename TO_T>
67 MultiAssociationToolTo<TO_T>::releaseElementUntyped (const void* p)
69 return releaseElement (reinterpret_cast<const TO_T*> (p));
73 //=========================================================================
77 * @brief Return the @c std::type_info for the source of the association.
79 template <typename FROM_T, typename TO_T>
81 MultiAssociationTool<FROM_T, TO_T>::fromTypeinfo () const
83 return typeid (FROM_T);
88 * @brief Start the iteration for a new association.
89 * @param p The object from which to associate.
91 template <typename FROM_T, typename TO_T>
93 MultiAssociationTool<FROM_T, TO_T>::resetUntyped (const void* p)
95 const FROM_T* pp = reinterpret_cast<const FROM_T*> (this->doConversion (p));
96 if (!pp) return StatusCode::FAILURE;