![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
99 : m_cls (
other.m_cls),
102 m_size (
other.m_size),
103 m_assign (
other.m_assign),
117 if (
this != &
other) {
122 m_assign =
other.m_assign;
158 gROOT->GetListOfTypes();
162 TClass*
cls = TClass::GetClass (type_name.c_str());
168 for (
int i = 0;
i < kNumDataTypes; ++
i) {
169 EDataType
type =
static_cast<EDataType
>(
i);
170 TDataType*
dt = TDataType::GetDataType(
type);
171 if (
dt && type_name ==
dt->GetTypeName()) {
177 EDataType
type = kNoType_t;
181 if( type_name.rfind(
"std::", 0) == 0 ) {
183 tname = type_name.substr(5);
187 if (tname ==
"uint32_t") {
188 if (
sizeof (
unsigned int) == 4)
191 else if (tname ==
"int32_t") {
192 if (
sizeof (
unsigned int) == 4)
195 else if (tname ==
"uint16_t") {
196 if (
sizeof (
unsigned short) == 2)
199 else if (tname ==
"int16_t") {
200 if (
sizeof (
short) == 2)
203 else if (tname ==
"uint8_t") {
206 else if (tname ==
"int8_t") {
209 else if (tname ==
"uint64_t") {
210 if (
sizeof(
unsigned long) == 8)
212 else if (
sizeof(
unsigned long long) == 8)
216 else if (tname ==
"int64_t") {
217 if (
sizeof(
long) == 8)
219 else if (
sizeof(
long long) == 8)
223 if (
type != kNoType_t) {
228 throw std::runtime_error (std::string (
"RootUtils::Type: Can't find type `") +
248 std::string
fname =
"operator=";
250 std::string assignProto =
"const ";
251 assignProto +=
m_cls->GetName();
254 m_assign.setProto (
m_cls,
fname, assignProto);
268 gROOT->GetListOfTypes();
271 TDataType*
dt = TDataType::GetDataType (
type);
273 throw std::runtime_error (
"Unknown data type");
282 #define TYPE(CODE, TYP, IOTYP) case CODE: m_ti = &typeid(TYP); break
321 delete [] (
reinterpret_cast<char*
> (
p));
332 return TDataType::GetTypeName (
m_type);
335 return m_cls->GetName();
392 if (dst >
src &&
reinterpret_cast<unsigned long>(
src) +
n*
m_size >
reinterpret_cast<unsigned long>(dst))
394 for (
size_t i =
n-1;
i <
n; --
i) {
400 for (
size_t i = 0;
i <
n; ++
i) {
423 for (
size_t i = 0;
i <
n; ++
i) {
456 dst =
reinterpret_cast<void*
>(
reinterpret_cast<unsigned long>(dst) +
m_size*
index);
481 const void*
src,
size_t src_index)
const
483 dst =
reinterpret_cast<void*
>(
reinterpret_cast<unsigned long>(dst) +
m_size* dst_index);
484 src =
reinterpret_cast<const void*
>(
reinterpret_cast<unsigned long>(
src) +
m_size * src_index);
501 if (TMethodCall* meth = m_assign.call()) {
503 meth->SetParam (
reinterpret_cast<Long_t
>(
src));
525 void*
b,
size_t b_index)
const
527 a =
reinterpret_cast<void*
>(
reinterpret_cast<unsigned long>(
a) +
m_size*a_index);
528 b =
reinterpret_cast<void*
>(
reinterpret_cast<unsigned long>(
b) +
m_size*b_index);
540 if (m_assign.call() !=
nullptr) {
568 void*
b,
size_t b_index,
571 char* aptr =
reinterpret_cast<char*
>(
a) +
m_size * a_index;
572 char* bptr =
reinterpret_cast<char*
>(
b) +
m_size * b_index;
574 if (m_assign.call() !=
nullptr) {
576 for (
size_t i = 0;
i <
n;
i++) {
588 memcpy (aptr, bptr,
m_size *
n);
603 std::istringstream is (
s);
605 #define TYPE(CODE, TYP, IOTYP) case CODE: { IOTYP tmp=0; is >> tmp; *reinterpret_cast<TYP*>(p) = tmp; } return
611 if (
m_cls == TClass::GetClass (
"string")) {
612 *
reinterpret_cast<std::string*
>(
p) =
s;
616 throw std::runtime_error
617 (std::string (
"RootUtils::Type::fromString: Can't convert objects of type `" +
void swapRange(void *a, size_t a_index, void *b, size_t b_index, size_t n) const
Swap a range of objects between vectors.
void init(const std::string &typname)
Initialize from a type name.
TClass * m_cls
The class of the derived type, or 0 if it's not a class type.
const TClass * getClass() const
Return the ROOT class for the described type.
void swap(void *a, size_t a_index, void *b, size_t b_index) const
Swap an object between vectors.
const std::type_info * getTypeInfo() const
Return the type_info for the described type.
void * m_defElt
Pointer to a default-constructed instance of the payload object.
void assign(void *dst, size_t dst_index, const void *src, size_t src_index) const
Copy an object within vectors.
EDataType m_type
The ROOT type code of the derived type, or kNoType_t for a class type.
size_t getSize() const
Return the size in bytes of an instance of the described type.
void clear(void *dst, size_t index) const
Clear an object in a vector.
void destroy(void *p) const
Destroy an instance of the object (and free memory).
void clearRange(void *dst, size_t n) const
Clear a range of objects.
void fromString(void *p, const std::string &s) const
Initialize an object from a string.
size_t m_size
The size in bytes of an instance of the described type.
EDataType getDataType() const
Return the ROOT data type code for the described type.
const std::type_info * m_ti
The type_info for the described type.
TSMethodCall m_assign ATLAS_THREAD_SAFE
Type()
Default constructor.
void copyRange(void *dst, const void *src, size_t n) const
Copy a range of objects.
void * create() const
Create an instance of the object.
std::string getTypeName() const
Return the name of this type.
Type & operator=(const RootUtils::Type &other)
Assignment.
Define macros for attributes used to control the static checker.