ATLAS Offline Software
DbColumn.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // $Id: DbColumn.h 726071 2016-02-25 09:23:05Z krasznaa $
6 //====================================================================
7 // DbColumn class definitions
8 //--------------------------------------------------------------------
9 //
10 // Package : StorageSvc (The POOL project)
11 // @author M.Frank
12 //====================================================================
13 #ifndef POOL_DBCOLUMN_H
14 #define POOL_DBCOLUMN_H 1
15 
16 // Framework include files
17 #include "StorageSvc/DbStatus.h"
18 // STL include files
19 #include <typeinfo>
20 #include <string>
21 
22 /*
23  * POOL namespace declaration
24  */
25 namespace pool {
26 
35  class DbColumn {
36  public:
37  enum Options {PRIMARY_KEY = 1 << 0,
38  NOT_NULL = 1 << 1,
39  UNIQUE = 1 << 2,
40  CLUSTERED = 1 << 3,
41  NONCLUSTERED= 1 << 4
42  };
43  // Accepted Data type definitions
44  enum Type {
45  UNKNOWN = 0,
52  NATIVE_TYPES = 1000
53  };
54  private:
55  friend class DbTypeInfo;
57  std::string m_typeName;
59  std::string m_colName;
61  int m_offset;
63  int m_nElem;
65  int m_opts;
67  int m_size;
69  int m_type;
73  : m_offset(0),
74  m_nElem(0),
75  m_opts(0),
76  m_size(0),
77  m_type(0)
78  {}
79  public:
81  DbColumn(const DbColumn&) = default;
82  DbColumn& operator=(const DbColumn&) = default;
84  DbColumn( const std::string& column_name,
85  int object_type,
86  int object_offset,
87  int object_size,
88  int number_of_elements=1,
89  int opt=0);
91  DbColumn( const std::string& nam,
92  const std::string& clazz,
93  int object_type,
94  int object_offset);
96  virtual ~DbColumn() { }
98  bool isValid() const { return m_typeName.length()>0;}
100  const std::string& name() const { return m_colName; }
102  const std::string& typeName() const { return m_typeName; }
104  int options() const { return m_opts; }
106  int offset() const { return m_offset; }
108  int size() const { return m_size; }
110  int nElement() const { return m_nElem; }
112  int typeID() const { return m_type; }
114  const std::string toString() const;
116  DbStatus fromString(const std::string& string_rep);
118  static const std::string typeName(int typ);
119  };
120 } // End namespace pool
121 #endif // POOL_DBCOLUMN_H
pool::DbColumn::UCHAR
@ UCHAR
Definition: DbColumn.h:46
pool::DbColumn::offset
int offset() const
Offset of column from this pointer.
Definition: DbColumn.h:106
pool::DbColumn::isValid
bool isValid() const
Is it a valid (known) data type ?
Definition: DbColumn.h:98
pool::DbStatus
Definition: DbStatus.h:67
pool::DbColumn::m_typeName
std::string m_typeName
OS independent type name.
Definition: DbColumn.h:57
make_coralServer_rep.opt
opt
Definition: make_coralServer_rep.py:19
pool::DbColumn::m_type
int m_type
Storage Type identifier.
Definition: DbColumn.h:69
pool::DbColumn::BLOB
@ BLOB
Definition: DbColumn.h:50
pool::DbColumn::fromString
DbStatus fromString(const std::string &string_rep)
Load type information object from string representation.
pool::DbColumn::nElement
int nElement() const
Number of elements.
Definition: DbColumn.h:110
pool
pool namespace
Definition: libname.h:15
pool::DbColumn::~DbColumn
virtual ~DbColumn()
Standard destructor.
Definition: DbColumn.h:96
pool::DbColumn::typeName
static const std::string typeName(int typ)
Access type name by type identifier from RTTI.
pool::DbColumn::SHORT
@ SHORT
Definition: DbColumn.h:47
pool::DbColumn::UINT
@ UINT
Definition: DbColumn.h:46
pool::DbColumn::LONG
@ LONG
Definition: DbColumn.h:47
pool::DbColumn::CONTAINED_REF
@ CONTAINED_REF
Definition: DbColumn.h:50
pool::DbColumn::operator=
DbColumn & operator=(const DbColumn &)=default
pool::DbColumn::UNIQUE
@ UNIQUE
Definition: DbColumn.h:39
pool::DbColumn::ANY
@ ANY
Definition: DbColumn.h:51
pool::DbColumn::LONG_STRING
@ LONG_STRING
Definition: DbColumn.h:49
pool::DbColumn::m_colName
std::string m_colName
Column name.
Definition: DbColumn.h:59
pool::DbColumn::CHAR
@ CHAR
Definition: DbColumn.h:47
pool::DbColumn::DbColumn
DbColumn(const std::string &nam, const std::string &clazz, int object_type, int object_offset)
Initializing constructor for composite columns.
pool::DbColumn::NTCHAR
@ NTCHAR
Definition: DbColumn.h:49
pool::DbColumn::INT
@ INT
Definition: DbColumn.h:47
pool::DbColumn::m_size
int m_size
Object size.
Definition: DbColumn.h:67
pool::DbColumn::USHORT
@ USHORT
Definition: DbColumn.h:46
pool::DbColumn::NATIVE_TYPES
@ NATIVE_TYPES
Definition: DbColumn.h:52
pool::DbColumn::NONCLUSTERED
@ NONCLUSTERED
Definition: DbColumn.h:41
pool::DbColumn::typeName
const std::string & typeName() const
Access to OS independent type name.
Definition: DbColumn.h:102
pool::DbColumn::TOKEN
@ TOKEN
Definition: DbColumn.h:50
xAODType
Definition: ObjectType.h:13
pool::DbColumn::Options
Options
Definition: DbColumn.h:37
pool::DbColumn::m_nElem
int m_nElem
For fixed size arrays: number of object elements.
Definition: DbColumn.h:63
pool::DbColumn::size
int size() const
Size of a single object within the column.
Definition: DbColumn.h:108
pool::DbColumn::name
const std::string & name() const
Access to column name.
Definition: DbColumn.h:100
pool::DbColumn::options
int options() const
Access to options.
Definition: DbColumn.h:104
IsoCloseByCorrectionTest.object_type
object_type
Definition: IsoCloseByCorrectionTest.py:56
pool::DbColumn::PRIMARY_KEY
@ PRIMARY_KEY
Definition: DbColumn.h:37
pool::DbColumn::FLOAT
@ FLOAT
Definition: DbColumn.h:48
pool::DbColumn::LONGLONG
@ LONGLONG
Definition: DbColumn.h:51
pool::DbColumn::LONG_NTCHAR
@ LONG_NTCHAR
Definition: DbColumn.h:49
pool::DbColumn::m_opts
int m_opts
Column options.
Definition: DbColumn.h:65
pool::DbColumn
Definition: DbColumn.h:35
pool::DbColumn::DbColumn
DbColumn(const DbColumn &)=default
Default copy constructor.
pool::DbColumn::ULONG
@ ULONG
Definition: DbColumn.h:46
pool::DbColumn::DOUBLE
@ DOUBLE
Definition: DbColumn.h:48
pool::DbColumn::DbColumn
DbColumn(const std::string &column_name, int object_type, int object_offset, int object_size, int number_of_elements=1, int opt=0)
Initializing constructor for fixed size arrays.
pool::DbColumn::NOT_NULL
@ NOT_NULL
Definition: DbColumn.h:38
pool::DbColumn::POINTER
@ POINTER
Definition: DbColumn.h:51
pool::DbColumn::STRING
@ STRING
Definition: DbColumn.h:49
pool::DbColumn::typeID
int typeID() const
Integer type identifier.
Definition: DbColumn.h:112
pool::DbColumn::ULONGLONG
@ ULONGLONG
Definition: DbColumn.h:51
pool::DbColumn::CLUSTERED
@ CLUSTERED
Definition: DbColumn.h:40
pool::DbColumn::OBJECT_REF
@ OBJECT_REF
Definition: DbColumn.h:50
pool::DbColumn::UNKNOWN
@ UNKNOWN
Definition: DbColumn.h:45
pool::DbColumn::DbColumn
DbColumn()
Cache class information (if available) Do not allow unwanted instantiations by users.
Definition: DbColumn.h:72
pool::DbColumn::BOOL
@ BOOL
Definition: DbColumn.h:48
DbStatus.h
pool::DbColumn::m_offset
int m_offset
Offset from object pointer.
Definition: DbColumn.h:61
pool::DbTypeInfo
Definition: DbTypeInfo.h:47
pool::DbColumn::toString
const std::string toString() const
Create string representation of the type information object.