ATLAS Offline Software
Loading...
Searching...
No Matches
AuxDataOption.icc
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5/**
6 * @file AthContainersInterfaces/AuxDataOption.icc
7 * @author scott snyder <snyder@bnl.gov>
8 * @date Oct, 2014
9 * @brief Hold information about an option setting request.
10 */
11
12
13namespace SG {
14
15
16/**
17 * @brief Constructor, with an integer value.
18 * @param name The option name.
19 * @param val The option value.
20 */
21inline
22AuxDataOption::AuxDataOption (const std::string& name, int val)
23 : m_name (name),
24 m_isInt(true)
25{
26 m_val.i = val;
27}
28
29
30/**
31 * @brief Constructor, with a float value.
32 * @param name The option name.
33 * @param val The option value.
34 */
35inline
36AuxDataOption::AuxDataOption (const std::string& name, float val)
37 : m_name (name),
38 m_isInt(false)
39{
40 m_val.f = val;
41}
42
43/**
44 * @brief Constructor, with a double value.
45 * @param name The option name.
46 * @param val The option value.
47 */
48inline
49AuxDataOption::AuxDataOption (const std::string& name, double val)
50 : m_name (name),
51 m_isInt(false)
52{
53 m_val.f = static_cast<float>(val);
54}
55
56
57/**
58 * @brief The name of the option.
59 */
60inline
61const std::string& AuxDataOption::name() const
62{
63 return m_name;
64}
65
66
67/**
68 * @brief Return the option value as an integer.
69 */
70inline
71int AuxDataOption::intVal() const
72{
73 return m_isInt ? m_val.i : static_cast<int>(m_val.f);
74}
75
76
77/**
78 * @brief Return the option value as a float.
79 */
80inline
81float AuxDataOption::floatVal() const
82{
83 return m_isInt ? static_cast<float>(m_val.i) : m_val.f;
84}
85
86
87} // namespace SG