ATLAS Offline Software
DbArray.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 //====================================================================
6 //
7 // Package : pool/StorageSvc (The POOL project)
8 //
9 // Author : M.Frank
10 //====================================================================
11 #ifndef POOL_ROOTDB_DBARRAY_H
12 #define POOL_ROOTDB_DBARRAY_H
13 
14 /*
15  * pool namespace declaration
16  */
17 namespace pool {
26  template<class T> class DbArray {
27  private:
29  DbArray(const DbArray&): m_size(0), m_buffer(0){ }
30  public:
32  int m_size;
35 
37  DbArray() : m_size(0), m_buffer(0) { }
39  virtual ~DbArray() { }
41  void allocate(int siz, bool do_delete) {
42  if ( do_delete ) delete [] m_buffer;
43  m_buffer = new T[siz];
44  m_size = siz;
45  }
47  void release(bool do_delete) {
48  if ( do_delete ) delete [] m_buffer;
49  m_buffer = 0;
50  m_size = 0;
51  }
52  };
53 }
54 struct CharDbArray : public pool::DbArray<char> { public: CharDbArray() {}; virtual ~CharDbArray() {} };
55 // Avoid name collision with UCharDbArray in RootCnv.
56 struct UCharDbArrayAthena : public pool::DbArray<unsigned char> { public: UCharDbArrayAthena() {}; virtual ~UCharDbArrayAthena() {} };
57 struct ShortDbArray : public pool::DbArray<short> { public: ShortDbArray() {}; virtual ~ShortDbArray() {} };
58 struct UShortDbArray : public pool::DbArray<unsigned short> { public: UShortDbArray() {}; virtual ~UShortDbArray() {} };
59 struct IntDbArray : public pool::DbArray<int> { public: IntDbArray() {}; virtual ~IntDbArray() {} };
60 struct UIntDbArray : public pool::DbArray<unsigned int> { public: UIntDbArray() {}; virtual ~UIntDbArray() {} };
61 struct LongDbArray : public pool::DbArray<long> { public: LongDbArray() {}; virtual ~LongDbArray() {} };
62 struct ULongDbArray : public pool::DbArray<unsigned long> { public: ULongDbArray() {}; virtual ~ULongDbArray() {} };
63 struct FloatDbArray : public pool::DbArray<float> { public: FloatDbArray() {}; virtual ~FloatDbArray() {} };
64 struct DoubleDbArray : public pool::DbArray<double> { public: DoubleDbArray() {}; virtual ~DoubleDbArray() {} };
65 
66 #endif // POOL_ROOTDB_DbArray_H
FloatDbArray::~FloatDbArray
virtual ~FloatDbArray()
Definition: DbArray.h:63
UIntDbArray
Definition: DbArray.h:60
ShortDbArray
Definition: DbArray.h:57
CharDbArray::~CharDbArray
virtual ~CharDbArray()
Definition: DbArray.h:54
IntDbArray::~IntDbArray
virtual ~IntDbArray()
Definition: DbArray.h:59
pool
pool namespace
Definition: libname.h:15
ShortDbArray::ShortDbArray
ShortDbArray()
Definition: DbArray.h:57
DoubleDbArray
Definition: DbArray.h:64
CharDbArray::CharDbArray
CharDbArray()
Definition: DbArray.h:54
UIntDbArray::UIntDbArray
UIntDbArray()
Definition: DbArray.h:60
CharDbArray
Definition: DbArray.h:54
UCharDbArrayAthena::~UCharDbArrayAthena
virtual ~UCharDbArrayAthena()
Definition: DbArray.h:56
UShortDbArray::~UShortDbArray
virtual ~UShortDbArray()
Definition: DbArray.h:58
pool::DbArray::m_size
int m_size
Size of buffer.
Definition: DbArray.h:32
FloatDbArray
Definition: DbArray.h:63
UIntDbArray::~UIntDbArray
virtual ~UIntDbArray()
Definition: DbArray.h:60
ULongDbArray
Definition: DbArray.h:62
pool::DbArray::DbArray
DbArray()
Standard Constructor.
Definition: DbArray.h:37
LongDbArray::LongDbArray
LongDbArray()
Definition: DbArray.h:61
UShortDbArray
Definition: DbArray.h:58
pool::DbArray::allocate
void allocate(int siz, bool do_delete)
Allocate an object buffer.
Definition: DbArray.h:41
FloatDbArray::FloatDbArray
FloatDbArray()
Definition: DbArray.h:63
LongDbArray
Definition: DbArray.h:61
pool::DbArray
Definition: DbArray.h:26
UShortDbArray::UShortDbArray
UShortDbArray()
Definition: DbArray.h:58
pool::DbArray::DbArray
DbArray(const DbArray &)
Objects of this type cannot be copied.
Definition: DbArray.h:29
IntDbArray
Definition: DbArray.h:59
ULongDbArray::ULongDbArray
ULongDbArray()
Definition: DbArray.h:62
pool::DbArray::~DbArray
virtual ~DbArray()
Standard Destructor.
Definition: DbArray.h:39
UCharDbArrayAthena::UCharDbArrayAthena
UCharDbArrayAthena()
Definition: DbArray.h:56
DoubleDbArray::DoubleDbArray
DoubleDbArray()
Definition: DbArray.h:64
IntDbArray::IntDbArray
IntDbArray()
Definition: DbArray.h:59
ShortDbArray::~ShortDbArray
virtual ~ShortDbArray()
Definition: DbArray.h:57
pool::DbArray::m_buffer
T * m_buffer
Buffer with object content.
Definition: DbArray.h:34
ULongDbArray::~ULongDbArray
virtual ~ULongDbArray()
Definition: DbArray.h:62
LongDbArray::~LongDbArray
virtual ~LongDbArray()
Definition: DbArray.h:61
UCharDbArrayAthena
Definition: DbArray.h:56
DoubleDbArray::~DoubleDbArray
virtual ~DoubleDbArray()
Definition: DbArray.h:64
pool::DbArray::release
void release(bool do_delete)
Release data buffer with or without delete.
Definition: DbArray.h:47