ATLAS Offline Software
Loading...
Searching...
No Matches
SegmentCollectionCnv_p1.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef SEGMENT_COLLECTION_CNV_P1_H
6#define SEGMENT_COLLECTION_CNV_P1_H
7
8//-----------------------------------------------------------------------------
9//
10// file: SegmentCollectionCnv_p1.h
11//
12//-----------------------------------------------------------------------------
13
15
19#include "TrkSegment/Segment.h"
20
21class MsgStream;
22
24 : public T_AthenaPoolTPCnvBase< Trk::SegmentCollection, Trk::SegmentCollection_p1 >
25{
26public:
28
29// remark: the usual templated needed to be overwritten in this case because
30// 1) SegmentCollection is DV< Segments >
31// 2) but Segment and TrkSegment have their T/P entry point at MeasurementBase which
32// is their highers abstract base class
33 virtual void transToPers(const Trk::SegmentCollection* transVect, Trk::SegmentCollection_p1* persVect, MsgStream &log) {
34 persVect->clear();
35 persVect->reserve( transVect->size() );
36 // convert vector entries one by one
37 for( Trk::SegmentCollection::const_iterator it = transVect->begin();
38 it != transVect->end(); ++it ) {
39 persVect->push_back( toPersistent( (ITPConverterFor<Trk::MeasurementBase>**)0, *it, log ) );
40 }
41 }
42
43
44 virtual void persToTrans(const Trk::SegmentCollection_p1* persVect, Trk::SegmentCollection* transVect, MsgStream &log)
45 {
46 transVect->clear();
47 transVect->reserve( persVect->size() );
48 // convert vector entries one by one
49 for( Trk::SegmentCollection_p1::const_iterator it = persVect->begin();
50 it != persVect->end(); ++it )
51 {
52 transVect->push_back( dynamic_cast<Trk::Segment*>( createTransFromPStore( (ITPConverterFor<Trk::MeasurementBase>**)0, *it, log ) ) );
53 }
54 }
55
56};
57
58
59#endif
TPConverterBase< TRANS, PERS > T_AthenaPoolTPCnvBase
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
void clear()
Erase all the elements in the collection.
Common base class for all TP converters, specialized for a given transient type.
Definition TPConverter.h:37
CNV::Trans_t * createTransFromPStore(CNV **cnv, const TPObjRef &ref, MsgStream &log) const
TPObjRef toPersistent(CNV **cnv, const typename CNV::TransBase_t *transObj, MsgStream &log) const
virtual void persToTrans(const Trk::SegmentCollection_p1 *persVect, Trk::SegmentCollection *transVect, MsgStream &log)
virtual void transToPers(const Trk::SegmentCollection *transVect, Trk::SegmentCollection_p1 *persVect, MsgStream &log)
Base class for all TrackSegment implementations, extends the common MeasurementBase.
DataVector< Trk::Segment > SegmentCollection