2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 // $Id: TVirtualConverter.icc,v 1.2 2006-12-19 04:11:20 ssnyder Exp $
7 * @file TVirtualConverter.icc
8 * @author scott snyder <snyder@bnl.gov>
10 * @brief Base class for Root converters --- template implementations.
15 * @brief Constructor, with class pointers.
16 * @param trans_cls The transient class to which we will be converting.
17 * @param pers_cls The persistent class to which we will be converting.
19 * The checksum will be calculated automatically from the provided classes.
21 * If either of the class pointers is defaulted to 0, the class pointer
22 * will be computed from the appropriate template parameter.
24 template <class TTrans, class TPers>
25 TVirtualConverter_T<TTrans, TPers>::TVirtualConverter_T
26 (TClass* trans_class /*= 0*/,
27 TClass* pers_class /*= 0*/)
28 : TVirtualConverter (trans_class ?
30 TVirtualConverter::ToClass (typeid (TTrans)),
33 TVirtualConverter::ToClass (typeid (TPers)))
38 * @brief Constructor, with checksum and class pointers.
39 * @param checksum The Root checksum of the persistent class we'll convert.
40 * @param trans_cls The transient class to which we will be converting.
41 * @param pers_cls The persistent class to which we will be converting.
43 * If either of the class pointers is defaulted to 0, the class pointer
44 * will be computed from the appropriate template parameter.
46 template <class TTrans, class TPers>
47 TVirtualConverter_T<TTrans, TPers>::TVirtualConverter_T
49 TClass* trans_class /*= 0*/,
50 TClass* pers_class /*= 0*/)
51 : TVirtualConverter (checksum,
54 TVirtualConverter::ToClass (typeid (TTrans)),
57 TVirtualConverter::ToClass (typeid (TPers)))
62 * @brief Do the conversion.
63 * @param transobj Pointer to an instance of the transient class.
64 * @param persobj Pointer to an instance of the persistent class.
66 * This implementation simply calls the @c Convert below
67 * with the appropriate casting.
69 template <class TTrans, class TPers>
70 void TVirtualConverter_T<TTrans, TPers>::ConvertVoid (void* transobj,
73 this->Convert (reinterpret_cast<TTrans*> (transobj),
74 reinterpret_cast<const TPers*> (persobj));