5#ifndef ATHENAPOOLCNVSVC_T_ATHENAPOOLTPVECTORCNV_H
6#define ATHENAPOOLCNVSVC_T_ATHENAPOOLTPVECTORCNV_H
8#include "AthenaPoolUtilities/TPIntegerVector.h"
12template<
class TRANS_BASE,
class TRANS >
34 virtual void persToTrans(
const PERS* persObj, TRANS* transObj, MsgStream &log) = 0;
43 virtual void transToPers(
const TRANS* transObj,
PERS* persObj, MsgStream &log) = 0;
48 reinterpret_cast<TRANS*
> (trans),
54 transToPers (
reinterpret_cast<const TRANS*
> (trans),
55 reinterpret_cast<PERS*
> (pers),
77 TPObjRef toPersistent_impl(
const TRANS *trans, MsgStream &log );
81 virtual const std::type_info&
transientTInfo()
const {
return typeid(TRANS); }
94 assert (index < m_pStorage->size());
96 persToTrans( &pers,
dynamic_cast<TRANS*
>(trans), log );
112 throw std::runtime_error(
113 std::string(
"virt_createTransFromPStore() mothod not supported in TP converter for an abstract class: ")
114 +
typeid(*this).name() );
167template<
class TRANS_BASE,
class TRANS >
186 std::unique_ptr<TRANS> trans(
new TRANS());
188 return(trans.release());
211template<
class TRANS >
225 return toPersistent_impl( trans, log );
240template<
class TRANS_BASE,
class TRANS >
252 throw std::runtime_error(
253 std::string(
"T/P converter: ") +
typeid(*this).name()
254 +
" recursive usage not supported! " );
This file contains template definitions for Transient/Persistent converters.
TPObjRef::typeID_t m_pStorageTID
virtual void transToPersUntyped(const void *trans, void *pers, MsgStream &log)
Convert transient object representation to persistent.
void setPStorage(TPIntegerVectorStorage_p1 *storage)
Tell this converter which storage vector it should use to store or retrieve persistent representation...
virtual void pstoreToTrans(unsigned index, TRANS_BASE *trans, MsgStream &log)
Convert persistent representation stored in the storage vector of the top-level object to transient.
virtual const std::type_info & transientTInfo() const
return C++ type id of the transient class this converter is for
virtual TRANS * virt_createTransFromPStore(unsigned, MsgStream &)
This method implements a pure virtual base class method, but should never be called,...
virtual void persToTrans(const PERS *persObj, TRANS *transObj, MsgStream &log)=0
Convert persistent representation to transient one.
bool m_recursive
if true, work in recursion-safe way (slower)
int m_curRecLevel
count recursive invocations, to detect recursion
TPIntegerVectorStorage_p1 * m_pStorage
the address of the storage vector for persistent representations
virtual void reservePStorage(size_t size)
Reserve 'size' elements for persistent storage - not much sense in this clas.
virtual TPObjRef virt_toPersistent(const TRANS_BASE *trans, MsgStream &log)
Internal interface method that is used to invoke the real conversion method (toPersistent_impl) in th...
TPObjRef toPersistent_impl(const TRANS *trans, MsgStream &log)
Create persistent representation of a transient object.
virtual void persToTransUntyped(const void *pers, void *trans, MsgStream &log)
Convert persistent object representation to transient.
virtual ~TPAbstractPolyCnvBase()
virtual void transToPers(const TRANS *transObj, PERS *persObj, MsgStream &log)=0
Convert transient representation to persistent one.
virtual void persToTrans(const PERS *persObj, TRANS *transObj, MsgStream &log)=0
Convert persistent representation to transient one.
virtual void transToPers(const TRANS *transObj, PERS *persObj, MsgStream &log)=0
Convert transient representation to persistent one.
std::vector< TPIntegerVector_p1 > * m_pStorage
virtual TPObjRef virt_toPersistent(const TRANS *trans, MsgStream &log)
Internal interface method that is used to invoke the real conversion method (toPersistent_impl) in th...
virtual void pstoreToTrans(unsigned index, TRANS *trans, MsgStream &log)
Convert persistent representation stored in the storage vector of the top-level object to transient.
This class is an object reference used in Athena persistent data model.
virtual TRANS * createTransient(const PERS *persObj, MsgStream &log)
Create transient representation of a persistent object.
virtual TRANS * virt_createTransFromPStore(unsigned index, MsgStream &log)
Internal interface method that is used to invoke the real conversion method (createTransient)
virtual TRANS * createTransient(const PERS *persObj, MsgStream &log)
Create transient representation of a persistent object.