ATLAS Offline Software
RingerRingsContainerCnv_p1.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /**********************************************************************************
6  * @Project: Trigger
7  * @Package: TrigCaloEventTPCnv
8  * @class : RingerRingsContainerCnv_p1
9  *
10  * @brief transient persistent converter for RingerRingsContainer
11  *
12  * @author Danilo Enoque Ferreira de Lima <dferreir@mail.cern.ch> - UFRJ
13  *
14  * $Id: RingerRingsContainerCnv_p1.h,v 1.2 2009-04-01 22:01:37 salvator Exp $
15  **********************************************************************************/
16 #ifndef TRIGCALOEVENTTPCNV_RINGERRINGSCONTAINER_CNV_P1_H
17 #define TRIGCALOEVENTTPCNV_RINGERRINGSCONTAINER_CNV_P1_H
18 
20 
24 
25 class RingerRingsContainerCnv_p1 : public T_AthenaPoolTPPtrVectorCnv<RingerRingsContainer, RingerRingsContainer_p1, RingerRingsCnv_p1> {
26 
27  public:
29 
30  // This part is implemented in T_AthenaPoolTPConverter.h.
31  // It is here temporarily to override and allow some extra debugging
32  virtual void persToTrans(const RingerRingsContainer_p1 *persVect,
33  RingerRingsContainer *transVect,
34  MsgStream &log) override {
35  log << MSG::DEBUG << "RingerRingsContainerCnv::persToTrans" << endmsg;
36  if (!persVect) {
37  log << MSG::WARNING << "RingerRingsContainerCnv::persToTrans cannot convert NULL persVect" << endmsg;
38  return;
39  }
40  if (!transVect) {
41  log << MSG::WARNING << "RingerRingsContainerCnv::persToTrans cannot convert to NULL transVect" << endmsg;
42  return;
43  }
44 
45  transVect->clear();
46  transVect->reserve(persVect->size());
47 
48  // convert vector entries one by one
49  for (RingerRingsContainer_p1::const_iterator it = persVect->begin();
50  it != persVect->end(); ++it) {
52  transVect->push_back(p);
53  if (!p)
54  log << MSG::WARNING << "RingerRingsContainerCnv::persToTrans failed for an element " << endmsg;
55  }
56  }
57 
58 
59  virtual void transToPers(const RingerRingsContainer *transVect,
60  RingerRingsContainer_p1 *persVect,
61  MsgStream &log) override {
62  if (!persVect) {
63  log << MSG::WARNING << "RingerRingsContainerCnv::transToPers cannot convert NULL persVect" << endmsg;
64  return;
65  }
66  if (!transVect) {
67  log << MSG::WARNING << "RingerRingsContainerCnv::transToPers cannot convert to NULL transVect" << endmsg;
68  return;
69  }
70 
71  persVect->clear();
72  persVect->reserve(transVect->size());
73  // convert vector entries one by one
74  for (RingerRingsContainer::const_iterator it = transVect->begin();
75  it != transVect->end(); ++it ) {
77  persVect->push_back(a);
78  if (a.isNull()) {
79  log << MSG::WARNING << "RingerRingsContainerCnv::transToPers failed for an element " << *it << " "
80  << m_elementCnv << endmsg;
81  }
82  }
83  }
84 };
85 
86 #endif
87 
DataVector::reserve
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
RingerRingsContainerCnv_p1::persToTrans
virtual void persToTrans(const RingerRingsContainer_p1 *persVect, RingerRingsContainer *transVect, MsgStream &log) override
Definition: RingerRingsContainerCnv_p1.h:42
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
skel.it
it
Definition: skel.GENtoEVGEN.py:423
TPObjRef
Definition: TPObjRef.h:20
RingerRingsContainerCnv_p1
Definition: RingerRingsContainerCnv_p1.h:25
RingerRingsContainer.h
RingerRingsContainerCnv_p1::RingerRingsContainerCnv_p1
RingerRingsContainerCnv_p1()
Definition: RingerRingsContainerCnv_p1.h:38
RingerRingsCnv_p1.h
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
T_AthenaPoolTPConverter.h
DataVector::clear
void clear()
Erase all the elements in the collection.
ITPConverterFor::toPersistent
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...
Definition: TPConverter.h:119
RingerRingsContainer_p1.h
RingerRings
This class carries the generated Rings.
Definition: RingerRings.h:18
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
a
TList * a
Definition: liststreamerinfos.cxx:10
RingerRingsContainerCnv_p1::transToPers
virtual void transToPers(const RingerRingsContainer *transVect, RingerRingsContainer_p1 *persVect, MsgStream &log) override
Definition: RingerRingsContainerCnv_p1.h:69
RingerRingsContainer
Definition: RingerRingsContainer.h:13
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
TPPtrVectorCnv::m_elementCnv
CONV * m_elementCnv
pointer to the TP converter used for vector elements
Definition: TPConverter.h:963
RingerRingsContainer_p1
Definition: RingerRingsContainer_p1.h:23
TPPtrVectorCnv
Definition: TPConverter.h:919
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
ITPConverterFor::createTransFromPStore
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...
Definition: TPConverter.h:172