ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
DataModelAthenaPool::PackedContainerConverter< T, U, ALLOC > Class Template Reference

Converter from std::vector<T,ALLOC> to SG::PackedContainer<U,ALLOC>. More...

Inheritance diagram for DataModelAthenaPool::PackedContainerConverter< T, U, ALLOC >:
Collaboration diagram for DataModelAthenaPool::PackedContainerConverter< T, U, ALLOC >:

Public Member Functions

 PackedContainerConverter (const char *tname, const char *allocName=nullptr)
 Constructor. More...
 
virtual void operator() (TBuffer &b, void *pmember, Int_t size=0)
 Run the streamer. More...
 

Private Attributes

TClass * m_cl
 Hold the source class. More...
 

Detailed Description

template<class T, class U = T, class ALLOC = std::allocator<T>>
class DataModelAthenaPool::PackedContainerConverter< T, U, ALLOC >

Converter from std::vector<T,ALLOC> to SG::PackedContainer<U,ALLOC>.

Definition at line 50 of file PackedContainerConverter.cxx.

Constructor & Destructor Documentation

◆ PackedContainerConverter()

template<class T , class U , class ALLOC >
DataModelAthenaPool::PackedContainerConverter< T, U, ALLOC >::PackedContainerConverter ( const char *  tname,
const char *  allocName = nullptr 
)

Constructor.

Parameters
tnameThe name of the vector element type T.
allocNameThe name of the allocator class, or null to assume std::allocator.

Definition at line 86 of file PackedContainerConverter.cxx.

88 {
89  std::string vname = "vector<";
90  vname += tname;
91  if (allocName != nullptr) {
92  vname += ",";
93  vname += allocName;
94  }
95  if (vname[vname.size()-1] == '>')
96  vname += ' ';
97  vname += '>';
98  m_cl = gROOT->GetClass (vname.c_str());
99 }

Member Function Documentation

◆ operator()()

template<class T , class U , class ALLOC >
void DataModelAthenaPool::PackedContainerConverter< T, U, ALLOC >::operator() ( TBuffer &  b,
void *  pmember,
Int_t  size = 0 
)
virtual

Run the streamer.

Parameters
bBuffer from which to read.
pmemberPointer to the object into which to read.
sizeNumber of instances to read.

Definition at line 109 of file PackedContainerConverter.cxx.

112 {
113  // This only works for reading!
114  assert (b.IsReading());
115 
116  // The transient object.
118  reinterpret_cast<SG::PackedContainer<U, ALLOC>*> (pmember);
119 
120  // We'll read into this object.
121  std::vector<T, ALLOC> tmp;
122 
123  while (size-- > 0) {
124  // Read into tmp and move data to *obj.
125  tmp.clear();
126  m_cl->Streamer (&tmp, b);
127  vectorMove (tmp, *obj);
128  ++obj;
129  }
130 }

Member Data Documentation

◆ m_cl

template<class T , class U = T, class ALLOC = std::allocator<T>>
TClass* DataModelAthenaPool::PackedContainerConverter< T, U, ALLOC >::m_cl
private

Hold the source class.

Definition at line 75 of file PackedContainerConverter.cxx.


The documentation for this class was generated from the following file:
DataModelAthenaPool::PackedContainerConverter::m_cl
TClass * m_cl
Hold the source class.
Definition: PackedContainerConverter.cxx:75
DataModelAthenaPool::vectorMove
void vectorMove(std::vector< T, ALLOC > &src, std::vector< T, ALLOC > &dst)
Move from one vector to another.
Definition: PackedContainerConverter.cxx:35
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
SG::PackedContainer
Container to hold aux data to be stored in a packed form.
Definition: PackedContainer.h:50
python.PyAthena.obj
obj
Definition: PyAthena.py:132