22#include "GaudiKernel/MsgStream.h"
35template<
class TRANS >
56 template <
class CNV >
60 cnv =
dynamic_cast< CNV*
>( c );
72 template <
class CNV >
76 cnv =
dynamic_cast<CNV*
>(c);
95 template <
class CNV >
97 baseToPersistent( CNV **cnv,
const typename CNV::Trans_t* transObj, MsgStream& log)
const {
98 if( !*cnv || (*cnv)->wasUsedForReading() ) {
102 (*cnv)->clearReadingFlag();
105 return (**cnv).virt_toPersistent(transObj, log);
118 template <
class CNV >
122 if( !cnv ) cnv = &temp_cnv_p;
123 if( !*cnv || (*cnv)->wasUsedForReading() ) {
127 (*cnv)->clearReadingFlag();
129 return (**cnv).virt_toPersistent(transObj, log);
144 template <
class CNV,
class TRANS_T >
146 if(
ref.isNull() )
return;
148 if( !cnv ) cnv = &temp_cnv_p;
150 if( !*cnv || (*cnv)->typeID().value() !=
ref.typeID() ) {
154 (*cnv)->setReadingFlag();
156 (**cnv).pstoreToTrans(
ref.index(), trans, log );
170 template <
class CNV >
171 typename CNV::Trans_t*
173 if(
ref.isNull() )
return 0;
175 if( !cnv ) cnv = &temp_cnv_p;
177 if( !*cnv || (*cnv)->typeID().value() !=
ref.typeID() ) {
180 if( !*cnv )
return 0;
181 (*cnv)->setReadingFlag();
183 return (**cnv).virt_createTransFromPStore(
ref.index(), log );
260 const std::string& key,
279 const std::string& key,
280 MsgStream &log ) = 0;
329template<
class TRANS_BASE,
class TRANS,
class PERS >
405 reinterpret_cast<TRANS*
> (trans),
414 transToPers (
reinterpret_cast<const TRANS*
> (trans),
415 reinterpret_cast<PERS*
> (pers),
422 const std::string& key,
426 reinterpret_cast<TRANS*
> (trans),
434 const std::string& key,
438 reinterpret_cast<PERS*
> (pers),
462 const std::string& key,
474 const std::string& key,
495 assert (index < m_pStorage->size());
496 TRANS* trans_der =
dynamic_cast<TRANS*
>(trans);
497 if (!trans_der) std::abort();
506 const TRANS* trans_der =
dynamic_cast<const TRANS*
>(trans);
507 if (!trans_der) std::abort();
516 const std::string& key,
519 const TRANS* trans_der =
dynamic_cast<const TRANS*
>(trans);
520 if (!trans_der) std::abort();
529 throw std::runtime_error(
530 std::string(
"virt_createTransFromPStore() mothod not supported in TP converter for an abstract class: ")
531 +
typeid(*this).name() );
540 throw std::runtime_error(
541 std::string(
"virt_createTransFromPStore() method not supported in TP converter for an abstract class: ")
542 +
typeid(*this).name() );
597template<
class TRANS_BASE,
class TRANS,
class PERS >
615 MsgStream &log)
const = 0;
627 MsgStream &log)
const = 0;
633 MsgStream &log)
override final
641 MsgStream &log)
override final
671template<
class TRANS_BASE,
class TRANS,
class PERS >
719 const std::string& key,
735template<
class TRANS,
class PERS >
753 const std::string& key,
773template<
class TRANS,
class PERS >
791 MsgStream &log)
const = 0;
803 MsgStream &log)
const = 0;
809 MsgStream &log)
override final
817 MsgStream &log)
override final
832template<
class TRANS,
class PERS >
854 const std::string& key,
855 MsgStream &log)
const = 0;
868 const std::string& key,
869 MsgStream &log)
const = 0;
875 const std::string& key,
876 MsgStream &log)
override final
884 const std::string& key,
885 MsgStream &log)
override final
894 MsgStream& )
const override final
896 throw std::runtime_error (
"persToTrans called where persToTransWithKey required.");
902 MsgStream& )
const override final
904 throw std::runtime_error (
"transToPers called where transToPersWithKey required.");
918template<
class TRANS,
class PERS,
class CONV>
931 transVect->reserve( persVect->size() );
933 for(
typename PERS::const_iterator
934 it = persVect->begin(),
935 iEnd = persVect->end();
950 persVect->reserve( transVect->size() );
952 for(
typename TRANS::const_iterator
953 it = transVect->begin(),
954 iEnd = transVect->end();
978template<
class TRANS,
class PERS,
class CONV>
993 virtual void persToTrans(
const PERS* persVect, TRANS* transVect, MsgStream &log)
const override {
995 transVect->reserve( persVect->size() );
998 for(
typename PERS::const_iterator
999 it = persVect->begin(),
1000 iEnd = persVect->end();
1001 it != iEnd; ++it ) {
1014 virtual void transToPers(
const TRANS* transVect,
PERS* persVect, MsgStream &log)
const override
1017 persVect->reserve( transVect->size() );
1019 CONV* cnv =
nullptr;
1020 for(
typename TRANS::const_iterator
1021 it = transVect->begin(),
1022 iEnd = transVect->end();
1023 it != iEnd; ++it ) {
1024 persVect->push_back( this->
toPersistent( &cnv, *it, log ) );
1041template<
class TRANS,
class PERS,
class CONV>
1059 const std::string& ,
1060 MsgStream &log)
const override
1063 transVect->reserve( persVect->size() );
1065 CONV* cnv =
nullptr;
1066 for(
typename PERS::const_iterator
1067 it = persVect->begin(),
1068 iEnd = persVect->end();
1069 it != iEnd; ++it ) {
1085 const std::string& key,
1086 MsgStream &log)
const override
1090 persVect->reserve( transVect->size() );
1092 CONV* cnv =
nullptr;
1094 for(
typename TRANS::const_iterator
1095 it = transVect->begin(),
1096 iEnd = transVect->end();
1097 it != iEnd; ++it, ++ipos )
1099 if (!dec || !dec->
thinned (ipos)) {
1100 persVect->push_back( this->
toPersistent( &cnv, *it, log ) );
1117template<
class TRANS,
class PERS,
class CONV>
1124 persVect->reserve( transVect->size() );
1126 for(
typename TRANS::const_iterator
1127 it = transVect->begin(),
1128 iEnd = transVect->end();
1129 it != iEnd; ++it ) {
1130 persVect->push_back( this->
toPersistent( (CONV**)0, *it, log ) );
1145template<
class TRANS,
class PERS,
class CONV>
1156 persVect->reserve( transVect->size() );
1158 for(
typename TRANS::const_iterator
1159 it = transVect->begin(),
1160 iEnd = transVect->end();
1161 it != iEnd; ++it ) {
1162 persVect->push_back( this->
toPersistent( (CONV**)0, *it, log ) );
1173template<
class TRANS,
class PERS,
class CONV>
1181 transVect->reserve( persVect->size() );
1183 typename TRANS::iterator ti = transVect->begin();
1184 typename PERS::const_iterator
pi = persVect->begin(), iEnd = persVect->end();
1185 for( ;
pi != iEnd; ++
pi, ++ti ) {
1193 persVect->reserve( transVect->size() );
1195 for(
typename TRANS::const_iterator
1196 it = transVect->begin(), iEnd = transVect->end();
1197 it != iEnd; ++it ) {
1215template<
class TRANS,
class PERS,
class CONV>
1233template<
class TRANS,
class PERS,
class CONV>
1255template<
class TRANS,
class PERS,
class CONV>
1270template<
class TRANS,
class PERS,
class CONV>
1279 virtual void persToTrans(
const PERS* persVect, TRANS* transVect, MsgStream &log)
const override;
1281 virtual void transToPers(
const TRANS* transVect,
PERS* persVect, MsgStream &log)
const override;
1290template<
class TRANS,
class PERS,
class CONV>
1306template<
class TRANS,
class PERS,
class CONV>
1317 MsgStream &log)
const override;
1322 MsgStream &log)
const override;
1334template<
class TRANS,
class PERS,
class CONV>
1359template<
class TRANS,
class PERS,
class CONV>
const boost::regex ref(r_ef)
RpcSectorLogicContainer_p1 PERS
Hold thinning decisions for one container.
Defines the base class for top-level TP converters.
virtual void initPrivateConverters(TopLevelTPCnvBase *)
virtual void setRuntimeTopConverter(TopLevelTPCnvBase *topConverter)
Set runtime top-level converter - usually it is the owning TL converter, but in case of extended obje...
CNV * converterForRef(CNV *cnv, const TPObjRef &ref, MsgStream &log) const
Find converter for a TP type ID (passed in a TP Ref), that is or ihnerits from CNV type.
TopLevelTPCnvBase * m_topConverterRuntime
virtual ~ITPConverterFor()=default
TPObjRef baseToPersistent(CNV **cnv, const typename CNV::Trans_t *transObj, MsgStream &log) const
Persistify bass class of a given object and store the persistent represenation in the storage vector ...
unsigned m_pStorageTIDvalue
virtual void setTopConverter(TopLevelTPCnvBase *topConverter, const TPObjRef::typeID_t &TPtypeID)
Set which top-level converter owns this elemental converter, and what TPtypeID was assigned to the pe...
TPObjRef::typeID_t m_pStorageTID
CNV::Trans_t * createTransFromPStore(CNV **cnv, const TPObjRef &ref, MsgStream &log) const
Create transient representation of a persistent object, stored in the the top-level persistent object...
virtual TopLevelTPCnvBase * topConverter()
return the top-level converter for this elemental TP converter
unsigned typeIDvalue() const
inlined non-virtual version to get the typeID value fast
void fillTransFromPStore(CNV **cnv, const TPObjRef &ref, TRANS_T *trans, MsgStream &log) const
Convert persistent object, stored in the the top-level persistent object and referenced by the TP Ref...
virtual TPObjRef virt_toPersistent(const TransBase_t *trans, MsgStream &log)=0
Internal interface method that is used to invoke the real conversion method (toPersistent_impl) in th...
const std::type_info & transBaseTInfo() const
return C++ type id of the common base transient type for all converters for a group of polymorphic ty...
virtual TRANS * virt_createTransFromPStore(unsigned index, MsgStream &log)=0
Internal interface method that is used to invoke the real conversion method (createTransient) in the ...
TPObjRef toPersistent(CNV **cnv, const typename CNV::TransBase_t *transObj, MsgStream &log) const
Persistify an object and store the persistent represenation in the storage vector of the top-level pe...
virtual void pstoreToTrans(unsigned index, TransBase_t *transObj, MsgStream &log)=0
Internal interface method that is used to invoke the real conversion method (persToTrans) in the deri...
virtual const TPObjRef::typeID_t & typeID() const
Return TP typeID for persistent objects produced by this converter.
virtual const TopLevelTPCnvBase * topConverter() const
return the top-level converter for this elemental TP converter
virtual TRANS * virt_createTransFromPStoreWithKey(unsigned index, const std::string &key, MsgStream &log)=0
Internal interface method that is used to invoke the real conversion method (createTransient) in the ...
virtual const std::type_info & transientTInfo() const
return C++ type id of the transient class this converter is for
CNV * converterForType(CNV *cnv, const std::type_info &t_info, MsgStream &log) const
Find converter for a given C++ type ID, that is or ihnerits from CNV type.
virtual TPObjRef virt_toPersistentWithKey(const TransBase_t *trans, const std::string &key, MsgStream &log)=0
Internal interface method that is used to invoke the real conversion method (toPersistent_impl) in th...
ITPConverterFor< TRANS > PolyCnvBase_t
TopLevelTPCnvBase * m_topConverter
virtual void converterNotFound(const std::type_info &converterType, ITPConverter *c, const std::string &typeName, MsgStream &log) const
method called when the right TP converter was not found during writing
Hold thinning decisions for one container.
bool thinned(size_t ndx) const
Return true if element ndx should be thinned.
virtual PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of a transient object.
virtual TRANS * virt_createTransFromPStore(unsigned, MsgStream &)
This method implements a pure virtual base class method, but should never be called,...
void ignoreRecursion(bool flag=false)
Tell the converter to ignore recursion (do not throw errors) even when recurion is detected.
virtual PERS * createPersistentWithKey(const TRANS *transObj, const std::string &key, MsgStream &log)
Create persistent representation of a transient object, with SG key.
virtual void persToTransWithKeyUntyped(const void *pers, void *trans, const std::string &key, MsgStream &log)
Convert persistent object representation to transient.
virtual void transToPersWithKeyUntyped(const void *trans, void *pers, const std::string &key, MsgStream &log)
Convert transient object representation to persistent.
virtual void persToTrans(const PERS *persObj, TRANS *transObj, MsgStream &log)=0
Convert persistent representation to transient one.
bool m_ignoreRecursion
if true, do not throw errors in case of recursion.
virtual void transToPers(const TRANS *transObj, PERS *persObj, MsgStream &log)=0
Convert transient representation to persistent one.
void setPStorage(std::vector< PERS > *storage)
Tell this converter which storage vector it should use to store or retrieve persistent representation...
virtual void transToPersUntyped(const void *trans, void *pers, MsgStream &log)
Convert transient object representation to persistent.
std::vector< PERS > * m_pStorage
the address of the storage vector for persistent representations
virtual const std::type_info & transientTInfo() const
return C++ type id of the transient class this converter is for
bool m_recursive
if true, work in recursion-safe way (slower)
virtual const std::type_info & persistentTInfo() const
return C++ type id of the persistent class this converter is for
virtual TRANS * virt_createTransFromPStoreWithKey(unsigned, const std::string &, MsgStream &)
This method implements a pure virtual base class method, but should never be called,...
virtual void transToPersWithKey(const TRANS *transObj, PERS *persObj, const std::string &, MsgStream &log)
Convert transient representation to persistent one.
int m_curRecLevel
count recursive invocations, to detect recursion
virtual void persToTransUntyped(const void *pers, void *trans, MsgStream &log)
Convert persistent object representation to transient.
void setRecursive(bool flag=true)
Tell the converter if it should work in recursive mode slower but it can safely handle recursion.
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...
virtual void reservePStorage(size_t size)
Reserve 'size' elements for persistent storage.
virtual TPObjRef virt_toPersistentWithKey(const TRANS_BASE *trans, const std::string &key, MsgStream &log)
Internal interface method that is used to invoke the real conversion method (toPersistent_impl) in th...
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 void persToTransWithKey(const PERS *persObj, TRANS *transObj, const std::string &, MsgStream &log)
Convert persistent representation to transient one.
TPObjRef toPersistentWithKey_impl(const TRANS *trans, const std::string &key, MsgStream &log)
Convert transient object to persistent representation.
virtual ~TPAbstractPolyCnvBase()=default
In contrast to TPAbstractPolyCnvBase, this calls const methods to do the conversion.
virtual void transToPers(const TRANS *transObj, PERS *persObj, MsgStream &log) override final
Convert transient representation to persistent one.
virtual void persToTrans(const PERS *persObj, TRANS *transObj, MsgStream &log) override final
Convert persistent representation to transient one.
virtual void persToTrans(const PERS *persObj, TRANS *transObj, MsgStream &log) const =0
Convert persistent representation to transient one.
TPAbstractPolyCnvConstBase base_class
virtual void transToPers(const TRANS *transObj, PERS *persObj, MsgStream &log) const =0
Convert transient representation to persistent one.
TRANS::IDENTIFIABLE COLLECTION_t
CONV m_elementCnv
the TP converter used for vector elements
TPCnvIDContFromIdentifier()
virtual void persToTrans(const PERS *persVect, TRANS *transVect, MsgStream &log)
Converts vector of PERS::value_type objects to vector of TRANS::value_type objects,...
virtual void transToPers(const TRANS *transVect, PERS *persVect, MsgStream &log)
Converts vector of TRANS::value_type objects to vector of PERS::value_type objects,...
virtual void transToPers(const TRANS *transVect, PERS *persVect, MsgStream &log)
Converts vector of TRANS::value_type objects to vector of PERS::value_type objects,...
TgcL1RdoCnv_p1 m_elementCnv
virtual void persToTrans(const PERS *persVect, TRANS *transVect, MsgStream &log)
Converts vector of PERS::value_type objects to vector of TRANS::value_type objects,...
TRANS::IDENTIFIABLE COLLECTION_t
Const version of TPCnvStdVector.
virtual void persToTrans(const PERS *persVect, TRANS *transVect, MsgStream &log) const override
Converts vector of PERS::value_type objects to vector of TRANS::value_type objects,...
virtual void transToPers(const TRANS *transVect, PERS *persVect, MsgStream &log) const override
Converts vector of TRANS::value_type objects to vector of PERS::value_type objects,...
virtual void transToPers(const TRANS *transVect, PERS *persVect, MsgStream &log)
Converts vector of TRANS::value_type objects to vector of PERS::value_type objects,...
virtual void persToTrans(const PERS *persVect, TRANS *transVect, MsgStream &log)
Converts vector of PERS::value_type objects to vector of TRANS::value_type objects,...
virtual void transToPers(const TRANS *transVect, PERS *persVect, MsgStream &log) const override
Converts vector of TRANS::value_type objects to vector of PERS::value_type objects,...
virtual void persToTrans(const PERS *persVect, TRANS *transVect, MsgStream &log) const override
Converts vector of PERS::value_type objects to vector of TRANS::value_type objects,...
virtual void persToTrans(const PERS *persVect, TRANS *transVect, MsgStream &log)
Converts vector of PERS::value_type objects to vector of TRANS::value_type objects,...
ExampleHitCnv_p1 m_elementCnv
virtual void transToPers(const TRANS *transVect, PERS *persVect, MsgStream &log)
Converts vector of TRANS::value_type objects to vector of PERS::value_type objects,...
virtual void pstoreToTrans(unsigned index, TRANS *trans, MsgStream &log)
Convert persistent representation stored in the storage vector of the top-level object to transient.
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 TPObjRef virt_toPersistentWithKey(const TRANS *trans, const std::string &key, MsgStream &log)
Internal interface method that is used to invoke the real conversion method (toPersistent_impl) in th...
virtual ~TPConverterBase()=default
TP Converter template for a "regular" type.
virtual void persToTrans(const PERS *persObj, TRANS *transObj, MsgStream &log) override final
Convert persistent representation to transient one.
virtual PERS * createPersistentConst(const TRANS *transObj, MsgStream &log) const
TPConverterConstBase base_class
virtual void transToPers(const TRANS *transObj, PERS *persObj, MsgStream &log) const =0
Convert transient representation to persistent one.
virtual void transToPers(const TRANS *transObj, PERS *persObj, MsgStream &log) override final
Convert transient representation to persistent one.
virtual TRANS * createTransientConst(const PERS *persObj, MsgStream &log) const
virtual void persToTrans(const PERS *persObj, TRANS *transObj, MsgStream &log) const =0
Convert persistent representation to transient one.
TP Converter template for a "regular" type.
virtual void persToTrans(const PERS *, TRANS *, MsgStream &) const override final
Convert persistent representation to transient one.
virtual void transToPersWithKey(const TRANS *transObj, PERS *persObj, const std::string &key, MsgStream &log) const =0
Convert transient representation to persistent one.
virtual void transToPers(const TRANS *, PERS *, MsgStream &) const override final
Convert transient representation to persistent one.
virtual void persToTransWithKey(const PERS *persObj, TRANS *transObj, const std::string &key, MsgStream &log) override final
Convert persistent representation to transient one.
virtual void persToTransWithKey(const PERS *persObj, TRANS *transObj, const std::string &key, MsgStream &log) const =0
Convert persistent representation to transient one.
TPConverterWithKeyBase base_class
virtual void transToPersWithKey(const TRANS *transObj, PERS *persObj, const std::string &key, MsgStream &log) override final
Convert transient representation to persistent one.
This class is an object reference used in Athena persistent data model.
unsigned typeID() const
returns the type ID (as integer) of the referenced object
virtual TRANS * virt_createTransFromPStoreWithKey(unsigned index, const std::string &key, MsgStream &log)
Internal interface method that is used to invoke the real conversion method (createTransient)
virtual TRANS * createTransientWithKey(const PERS *persObj, const std::string &key, MsgStream &log)
Create transient representation of a persistent object, with SG key.
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.
virtual ~TPPolyCnvBase()=default
Converter between: transient vector of T* (like DataVector<T>) and persistent vector<T> Uses converte...
virtual void transToPers(const TRANS *transVect, PERS *persVect, MsgStream &log) const
Converts vector of TRANS::value_type objects to vector of PERS::value_type objects,...
Converter between: transient vector of T* (like DataVector<T>) and persistent vector<T> Uses converte...
virtual void transToPers(const TRANS *transVect, PERS *persVect, MsgStream &log)
Converts vector of TRANS::value_type objects to vector of PERS::value_type objects,...
virtual void transToPers(const TRANS *transVect, PERS *persVect, MsgStream &log) const override
Converts vector of TRANS::value_type objects to vector of PERS::value_type objects,...
virtual void persToTrans(const PERS *persVect, TRANS *transVect, MsgStream &log) const override
Converts vector of PERS::value_type objects to vector of TRANS::value_type objects,...
TrackStateOnSurfaceCnv_p1 * m_elementCnv
virtual void transToPers(const TRANS *transVect, PERS *persVect, MsgStream &log)
Converts vector of TRANS::value_type objects to vector of PERS::value_type objects,...
virtual void persToTrans(const PERS *persVect, TRANS *transVect, MsgStream &log)
Converts vector of PERS::value_type objects to vector of TRANS::value_type objects,...
virtual void transToPersWithKey(const TRANS *transVect, PERS *persVect, const std::string &key, MsgStream &log) const override
Converts vector of TRANS::value_type objects to vector of PERS::value_type objects,...
virtual void persToTransWithKey(const PERS *persVect, TRANS *transVect, const std::string &, MsgStream &log) const override
Converts vector of PERS::value_type objects to vector of TRANS::value_type objects,...
virtual void transToPers(const TRANS *transVect, PERS *persVect, MsgStream &log)
Converts vector of TRANS::value_type objects to vector of PERS::value_type objects,...
virtual void persToTrans(const PERS *persVect, TRANS *transVect, MsgStream &log)
Converts vector of PERS::value_type objects to vector of TRANS::value_type objects,...
CONV * m_elementCnv
pointer to the TP converter used for vector elements
virtual void transToPers(const TRANS *transCont, PERS *persCont, MsgStream &log)
transToPers
virtual void persToTrans(const PERS *persCont, TRANS *transCont, MsgStream &log)
persToTrans
virtual void persToTrans(const PERS *persCont, TRANS *transCont, MsgStream &log)
persToTrans
virtual void transToPers(const TRANS *transCont, PERS *persCont, MsgStream &log)
transToPers
Base class for top-level TP converters.
Helpers to retrieve the current thinning cache from the event context.
const SG::ThinningDecisionBase * getThinningDecision(const EventContext &ctx, const std::string &key)
Retrieve the current thinning decision for key.
This structure holds an ID of a persistent type.
unsigned value() const
Returns the type ID as an integer.