ATLAS Offline Software
DbTypeInfo.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // $Id: DbTypeInfo.h 726071 2016-02-25 09:23:05Z krasznaa $
6 //====================================================================
7 // DbTypeInfo definition
8 //--------------------------------------------------------------------
9 //
10 // Package : StorageSvc (The POOL project)
11 //
12 // Description: Type information for persistent objects
13 //
14 // @author M.Frank
15 //====================================================================
16 #ifndef POOL_DBTYPEINFO_H
17 #define POOL_DBTYPEINFO_H 1
18 
19 // Framework include files
20 #include "DataModelRoot/RootType.h"
21 #include "StorageSvc/pool.h"
22 #include "StorageSvc/Shape.h"
23 #include "CxxUtils/CachedValue.h"
24 
25 // C/C++ include files
26 #include <vector>
27 #include <atomic>
28 
29 /*
30  * POOL namespace declaration
31  */
32 namespace pool {
33 
34  // Forward declaration
35  class DbColumn;
36  class DbTypeInfo;
37 
47  class DbTypeInfo : public Shape {
48 
49  public:
51  typedef RootType TypeH;
53  typedef std::vector<const DbColumn*> Columns;
54 
55  private:
57  mutable std::atomic<int> m_refCount;
61  int m_mult;
64 
65  protected:
68  DbTypeInfo(const Guid& guid);
69 
71  virtual ~DbTypeInfo();
72 
74  DbStatus i_fromString(const std::string& string_rep);
76  static DbTypeInfo* regShape(const Guid& guid, const TypeH& type, Columns& cols);
77 
78  public:
80  void destroy() { delete this; }
82 
83  static DbTypeInfo* create(const std::string& cl_name);
85  static DbTypeInfo* create(const std::string& cl_name, Columns& cols);
87 
88  static DbTypeInfo* create(const Guid& guid);
90 
91  static DbTypeInfo* create(const Guid& guid, Columns& cols);
93 
94  static DbTypeInfo* createEx(const Guid& guid);
96 
97  static DbTypeInfo* createEx(const Guid& guid, Columns& cols);
99  static const DbTypeInfo* fromString(const std::string& string_rep);
101  static const std::string typeName(const std::type_info& typ);
102  // Requests ownership
103  void addRef() const { ++m_refCount; }
105  void deleteRef() const;
107  TypeH clazz( bool noIdScan=false ) const;
109  const Columns& columns() const { return m_columns; }
111  Columns& columns() { return m_columns; }
113  const std::string toString() const;
116  };
117 } // End namespace pool
118 #endif // POOL_DBTYPEINFO_H
Shape.h
pool::DbTypeInfo::create
static DbTypeInfo * create(const Guid &guid)
Create type information using Guid only Class must already be registered.
pool::DbStatus
Definition: DbStatus.h:67
pool::DbTypeInfo::columns
Columns & columns()
Modify content of the object by editing columns.
Definition: DbTypeInfo.h:111
pool::DbTypeInfo::toString
const std::string toString() const
Create string representation of the type information object.
pool::DbTypeInfo::DbTypeInfo
DbTypeInfo(const Guid &guid, TypeH cl, Columns &cols)
Constructor with type id.
pool::DbTypeInfo::createEx
static DbTypeInfo * createEx(const Guid &guid, Columns &cols)
Create type information using Guid only Class must already be registered.
pool
pool namespace
Definition: libname.h:15
pool::DbTypeInfo::clazz
TypeH clazz(bool noIdScan=false) const
Access to reflection class. If not known, by default scan all types for class ID.
pool::DbTypeInfo::i_fromString
DbStatus i_fromString(const std::string &string_rep)
Load type information object from string representation.
pool::Shape
Definition: Shape.h:35
pool::DbTypeInfo::create
static DbTypeInfo * create(const Guid &guid, Columns &cols)
Create type information using Guid only Class must already be registered.
pool::DbTypeInfo::deleteRef
void deleteRef() const
Releases the ownership.
pool::DbTypeInfo::Columns
std::vector< const DbColumn * > Columns
Column Container definition.
Definition: DbTypeInfo.h:53
pool::DbTypeInfo::m_class
CxxUtils::CachedValue< TypeH > m_class
Reflection class.
Definition: DbTypeInfo.h:63
beamspotnt.cols
list cols
Definition: bin/beamspotnt.py:1114
pool::DbTypeInfo::create
static DbTypeInfo * create(const std::string &cl_name)
Create type information using name.
pool::DbTypeInfo::m_refCount
std::atomic< int > m_refCount
Reference counter.
Definition: DbTypeInfo.h:57
CxxUtils::CachedValue
Cached value with atomic update.
Definition: CachedValue.h:55
pool::DbTypeInfo::TypeH
RootType TypeH
Definition of reflection class handle.
Definition: DbTypeInfo.h:51
pool::DbTypeInfo::create
static DbTypeInfo * create(const std::string &cl_name, Columns &cols)
Create type information using name.
pool::DbTypeInfo::destroy
void destroy()
Destroy type information; to be used with extreme care.
Definition: DbTypeInfo.h:80
pool::DbTypeInfo::~DbTypeInfo
virtual ~DbTypeInfo()
Destructor.
pool::DbTypeInfo::createEx
static DbTypeInfo * createEx(const Guid &guid)
Create type information using Guid only Class must already be registered.
pool_uuid.guid
guid
Definition: pool_uuid.py:112
pool.h
pool::DbTypeInfo::declareBase
DbStatus declareBase(const DbTypeInfo *pInfo)
Allow usage of base classes.
CachedValue.h
Cached value with atomic update.
pool::DbTypeInfo::m_mult
int m_mult
Multiplicity.
Definition: DbTypeInfo.h:61
pool::DbTypeInfo::fromString
static const DbTypeInfo * fromString(const std::string &string_rep)
Load type information object from string representation.
pool::DbTypeInfo::m_columns
Columns m_columns
Column definitions.
Definition: DbTypeInfo.h:59
pool::DbTypeInfo::addRef
void addRef() const
Definition: DbTypeInfo.h:103
Guid
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
Definition: Guid.h:20
pool::DbTypeInfo::regShape
static DbTypeInfo * regShape(const Guid &guid, const TypeH &type, Columns &cols)
try to add a new shape
pool::DbTypeInfo::columns
const Columns & columns() const
Prepare for the case of discrete columns: Column information.
Definition: DbTypeInfo.h:109
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
RootType.h
pool::DbTypeInfo::DbTypeInfo
DbTypeInfo(const Guid &guid)
pool::DbTypeInfo::typeName
static const std::string typeName(const std::type_info &typ)
Access type name by type identifier from RTTI.
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:26
pool::DbTypeInfo
Definition: DbTypeInfo.h:47
TScopeAdapter
Definition: RootType.h:119