ATLAS Offline Software
Loading...
Searching...
No Matches
DbOption.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: DbOption.h 726071 2016-02-25 09:23:05Z krasznaa $
6//====================================================================
7// DbOption class definitions
8//--------------------------------------------------------------------
9//
10// Package : StorageSvc (The POOL project)
11// @author M.Frank
12//====================================================================
13#ifndef POOL_DBOPTION_H
14#define POOL_DBOPTION_H 1
15
16// Framework include files
17#include "StorageSvc/DbColumn.h"
18#include "GaudiKernel/StatusCode.h"
19
20/*
21 * POOL namespace declaration
22 */
23namespace pool {
24
37 class DbOption {
38 public:
47 union Value {
48 long long int val_long;
50 double val_double;
51 void* val_pvoid;
52 char* val_pchar;
53 };
54
59 std::string m_name;
61 std::string m_opt;
62
64 StatusCode i_setValue(const std::type_info& typ, const void* value);
66 StatusCode i_getValue(const std::type_info& typ, void* value) const;
67
68 public:
70 template <class T> DbOption(const std::string& nam,
71 const std::string& opt,
72 T value)
73 : m_type(DbColumn::UNKNOWN), m_name(nam), m_opt(opt)
74 { i_setValue(typeid(T), &value).ignore(); }
75
76 DbOption(const std::string& nam, const std::string& opt="");
79 virtual ~DbOption() { }
81 const std::string& option() const { return m_opt; }
83 const std::string& name() const { return m_name; }
85 DbColumn::Type type() const { return m_type; }
87 template<class T> StatusCode _setValue(T value)
88 { return i_setValue(typeid(T), &value); }
89
90 template<class T> StatusCode _getValue(T& value) const
91 { return i_getValue(typeid(T), &value); }
92
93 std::string typeName() const;
95 StatusCode setValue(DbColumn::Type typ, const void* value);
97 StatusCode getValue(DbColumn::Type typ, void* value) const;
98 };
99} // End namespace pool
100#endif // POOL_DbOption_H
Description: Definition of the generic column in a (relational) Database.
Definition DbColumn.h:34
std::string m_name
Option name identifier.
Definition DbOption.h:59
Value m_value
Buffer holding option value.
Definition DbOption.h:55
const std::string & name() const
Access to column name.
Definition DbOption.h:83
StatusCode i_setValue(const std::type_info &typ, const void *value)
Set the option value.
StatusCode i_getValue(const std::type_info &typ, void *value) const
Set the option value.
StatusCode _getValue(T &value) const
Set the option value.
Definition DbOption.h:90
StatusCode _setValue(T value)
Set the option value.
Definition DbOption.h:87
DbColumn::Type m_type
Option data type.
Definition DbOption.h:57
StatusCode setValue(DbColumn::Type typ, const void *value)
Set the option value.
std::string typeName() const
Access to OS independent type name.
StatusCode getValue(DbColumn::Type typ, void *value) const
Set the option value.
const std::string & option() const
Access to column name.
Definition DbOption.h:81
std::string m_opt
Optional identifier.
Definition DbOption.h:61
DbColumn::Type type() const
Integer type identifier.
Definition DbOption.h:85
DbOption(const std::string &nam, const std::string &opt="")
Initializing constructor with type definition.
virtual ~DbOption()
Default copy constructor Standard destructor.
Definition DbOption.h:79
DbOption(const std::string &nam, const std::string &opt, T value)
Initializing constructor.
Definition DbOption.h:70
pool namespace
Definition libname.h:15
Description: Definition an option value.
Definition DbOption.h:47
long long int val_long
Definition DbOption.h:48