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
19/*
20 * POOL namespace declaration
21 */
22namespace pool {
23
36 class DbOption {
37 public:
46 union Value {
47 long long int val_long;
49 double val_double;
50 void* val_pvoid;
51 char* val_pchar;
52 };
53
58 std::string m_name;
60 std::string m_opt;
61
63 DbStatus i_setValue(const std::type_info& typ, const void* value);
65 DbStatus i_getValue(const std::type_info& typ, void* value) const;
66
67 public:
69 template <class T> DbOption(const std::string& nam,
70 const std::string& opt,
71 T value)
72 : m_type(DbColumn::UNKNOWN), m_name(nam), m_opt(opt)
73 { i_setValue(typeid(T), &value); }
74
75 DbOption(const std::string& nam, const std::string& opt="");
78 virtual ~DbOption() { }
80 const std::string& option() const { return m_opt; }
82 const std::string& name() const { return m_name; }
84 DbColumn::Type type() const { return m_type; }
86 template<class T> DbStatus _setValue(T value)
87 { return i_setValue(typeid(T), &value); }
88
89 template<class T> DbStatus _getValue(T& value) const
90 { return i_getValue(typeid(T), &value); }
91
92 std::string typeName() const;
94 DbStatus setValue(DbColumn::Type typ, const void* value);
96 DbStatus getValue(DbColumn::Type typ, void* value) const;
97 };
98} // End namespace pool
99#endif // POOL_DbOption_H
Description: Definition of the generic column in a (relational) Database.
Definition DbColumn.h:35
std::string m_name
Option name identifier.
Definition DbOption.h:58
Value m_value
Buffer holding option value.
Definition DbOption.h:54
DbStatus _setValue(T value)
Set the option value.
Definition DbOption.h:86
const std::string & name() const
Access to column name.
Definition DbOption.h:82
DbColumn::Type m_type
Option data type.
Definition DbOption.h:56
DbStatus _getValue(T &value) const
Set the option value.
Definition DbOption.h:89
DbStatus i_setValue(const std::type_info &typ, const void *value)
Set the option value.
std::string typeName() const
Access to OS independent type name.
DbStatus setValue(DbColumn::Type typ, const void *value)
Set the option value.
const std::string & option() const
Access to column name.
Definition DbOption.h:80
std::string m_opt
Optional identifier.
Definition DbOption.h:60
DbStatus getValue(DbColumn::Type typ, void *value) const
Set the option value.
DbColumn::Type type() const
Integer type identifier.
Definition DbOption.h:84
DbOption(const std::string &nam, const std::string &opt="")
Initializing constructor with type definition.
virtual ~DbOption()
Default copy constructor Standard destructor.
Definition DbOption.h:78
DbStatus i_getValue(const std::type_info &typ, void *value) const
Set the option value.
DbOption(const std::string &nam, const std::string &opt, T value)
Initializing constructor.
Definition DbOption.h:69
This class is highly inspired by the error code distribution system as it is used in DEC/VMS or MS/WN...
Definition DbStatus.h:64
pool namespace
Definition libname.h:15
Description: Definition an option value.
Definition DbOption.h:46
long long int val_long
Definition DbOption.h:47