|
ATLAS Offline Software
|
Go to the documentation of this file.
6 #include <TMethodCall.h>
8 #include <TVirtualCollectionProxy.h>
9 #include <TInterpreter.h>
23 : m_class(
cl ), m_proxy(
cl->GetCollectionProxy() ),
28 ::Fatal(
"xAOD::TAuxVectorFactory::TAuxVectorFactory",
34 ::TClass* eltClass =
m_proxy->GetValueClass();
37 std::string proto =
"const ";
38 proto += eltClass->GetName();
40 m_assign.setProto( eltClass,
"operator=", proto );
41 if( m_assign.call() ==
nullptr ) {
42 ::Warning(
"xAOD::TAuxVectorFactory::TAuxVectorFactory",
45 eltClass->GetName() );
60 std::unique_ptr< SG::IAuxTypeVector >
62 bool isLinked )
const {
64 return std::make_unique< TAuxVector >(
this, auxid,
70 std::unique_ptr< SG::IAuxTypeVector >
89 const size_t eltsz =
m_proxy->GetIncrement();
92 char* dstptr =
reinterpret_cast<char*
> (dst.
getDataArray (auxid));
93 const char* srcptr = &dst == &
src ? dstptr :
reinterpret_cast<const char*
>(
src.getDataArray (auxid));
94 dstptr += eltsz * dst_index;
95 srcptr += eltsz * src_index;
99 TMethodCall*
mc = m_assign.call();
101 auto copyone = [
mc] (
void* dst,
const void*
src)
104 mc->SetParam( ( Long_t )
src );
109 if( dstptr > srcptr && ( srcptr +
n * eltsz ) > dstptr ) {
110 for(
size_t i =
n - 1;
i <
n; --
i ) {
111 copyone( dstptr +
i*eltsz, srcptr +
i*eltsz );
116 for(
size_t i = 0;
i <
n; ++
i ) {
117 copyone( dstptr +
i*eltsz, srcptr +
i*eltsz );
122 memmove( dstptr, srcptr,
n * eltsz );
135 copy( auxid, dst, dst_index,
src, src_index,
n );
137 ::Warning(
"xAOD::TAuxVectorFactory::TAuxVectorFactory",
138 XAOD_MESSAGE(
"copyForOutput called; should only be used "
139 "with pool converters." ) );
150 const size_t eltsz =
m_proxy->GetIncrement();
153 char* aptr =
reinterpret_cast<char*
>(
a.getDataArray (auxid) );
154 char* bptr = &
a == &
b ? aptr :
reinterpret_cast<char*
>(
b.getDataArray (auxid) );
155 aptr += eltsz * aindex;
156 bptr += eltsz * bindex;
158 TMethodCall*
mc = m_assign.call();
162 TClass* eltClass =
m_proxy->GetValueClass();
163 void*
tmp = eltClass->New();
165 for (
size_t i = 0;
i <
n; ++
i) {
168 mc->SetParam( ( Long_t ) aptr );
169 mc->Execute(
static_cast<void*
>(
tmp ) );
172 mc->SetParam( ( Long_t ) bptr );
173 mc->Execute(
static_cast<void*
>( aptr ) );
176 mc->SetParam( ( Long_t )
tmp );
177 mc->Execute(
static_cast<void*
>( bptr ) );
183 eltClass->Destructor(
tmp );
188 std::vector< char >
tmp( eltsz*
n );
190 memcpy(
tmp.data(), aptr, eltsz*
n );
192 memcpy( aptr, bptr, eltsz*
n );
194 memcpy( bptr,
tmp.data(), eltsz*
n );
207 const size_t eltsz =
m_proxy->GetIncrement();
210 char* dptr =
reinterpret_cast< char*
>( dst ) + eltsz * dst_index;
212 TMethodCall*
mc = m_assign.call();
215 for (
size_t i = 0;
i <
n; ++
i) {
218 mc->Execute(
static_cast<void*
>( dptr ) );
223 memset( dst, 0, eltsz*
n );
241 return m_proxy->GetIncrement();
258 std::string alloc_name;
262 else if (cn.
ntargs() == 1) {
264 if (alloc_name[alloc_name.size()-1] ==
'>') alloc_name +=
" ";
virtual void copy(SG::auxid_t auxid, SG::AuxVectorData &dst, size_t dst_index, const SG::AuxVectorData &src, size_t src_index, size_t n) const override
Copy elements from one location to another.
Recursively separate out template arguments in a C++ class name.
const void * getDataArray(SG::auxid_t auxid) const
Return a const pointer to the start of an aux data vector.
virtual const std::type_info * tiVec() const override
Type info of the vector type handled by the factory object.
std::string normalizedTypeinfoName(const std::type_info &info)
Convert a type_info to a normalized string representation (matching the names used in the root dictio...
Helper for getting a const version of a pointer.
virtual void swap(SG::auxid_t auxid, SG::AuxVectorData &a, size_t aindex, SG::AuxVectorData &b, size_t bindex, size_t n) const override
Swap the payload of two ranges of elements in memory.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
void clear(void *dst, size_t dst_index, size_t n) const
Clear the payload of a given range inside a vector.
virtual ~TAuxVectorFactory()
Destructor.
virtual const std::type_info * tiAlloc() const override
Return the type_info of the vector allocator.
void * m_defElt
Pointer to a default element object in memory.
virtual std::unique_ptr< SG::IAuxTypeVector > create(SG::auxid_t auxid, size_t size, size_t capacity, bool isLinked) const override
Create a new vector in memory with the requested size and capacity.
size_t auxid_t
Identifier for a particular aux data item.
size_t ntargs() const
Return number of template arguments.
Recursively separate out template arguments in a C++ class name.
std::string fullName() const
Return the full name of the expression.
virtual std::string tiAllocName() const override
Return the (demangled) name of the vector allocator.
Manage lookup of vectors of auxiliary data.
virtual void copyForOutput(SG::auxid_t auxid, SG::AuxVectorData &dst, size_t dst_index, const SG::AuxVectorData &src, size_t src_index, size_t n) const override
Copy one element from one location to another.
Convert a type_info to a normalized string representation (matching the names used in the root dictio...
const ClassName & targ(size_t i) const
Return one template argument.
::TVirtualCollectionProxy * m_proxy
ROOT's description of the vector type.
const T * as_const_ptr(const T *p)
Helper for getting a const version of a pointer.
virtual size_t getEltSize() const override
Size of the elements inside the vector type.
Abstract interface for manipulating vectors of arbitrary types.
::TClass * m_class
The type that this factory operates on.
virtual std::unique_ptr< SG::IAuxTypeVector > createFromData(SG::auxid_t auxid, void *data, SG::IAuxTypeVector *linkedVector, bool isPacked, bool ownFlag, bool isLinked) const override
Create a vector object of this type from a data blob.
Manage lookup of vectors of auxiliary data.
TAuxVectorFactory(::TClass *cl)
Constructor, setting up the object based on a dictionary.
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]