TBTK
Need a break? Support the development by playing Polarity Puzzles
ParameterSet.h
Go to the documentation of this file.
1 /* Copyright 2016 Kristofer Björnson and Andreas Theiler
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
24 #ifndef COM_DAFER45_TBTK_PARAMETER_SET
25 #define COM_DAFER45_TBTK_PARAMETER_SET
26 
27 #include <vector>
28 #include <tuple>
29 #include <string>
30 #include <complex>
31 
32 namespace TBTK{
33 
35 public:
37  ParameterSet();
38 
40  ~ParameterSet();
41 
43  void addInt(std::string name, int value);
44 
46  void addDouble(std::string name, double value);
47 
49  void addComplex(std::string name, std::complex<double> value);
50 
52  void addString(std::string name, std::string value);
53 
55  void addBool(std::string name, bool value);
56 
58  void setInt(std::string name, int value);
59 
61  void setDouble(std::string name, double value);
62 
64  void setComplex(std::string name, std::complex<double> value);
65 
67  void setString(std::string name, std::string value);
68 
70  void setBool(std::string name, bool value);
71 
73  int getInt(std::string name) const;
74 
76  double getDouble(std::string name) const;
77 
79  std::complex<double> getComplex(std::string name) const;
80 
82  std::string getString(std::string name) const;
83 
85  bool getBool(std::string name) const;
86 
88  int getNumInt() const;
89 
91  int getNumDouble() const;
92 
94  int getNumComplex() const;
95 
97  int getNumString() const;
98 
100  int getNumBool() const;
101 
103  std::string getIntName(int n) const;
104 
106  std::string getDoubleName(int n) const;
107 
109  std::string getComplexName(int n) const;
110 
112  std::string getStringName(int n) const;
113 
115  std::string getBoolName(int n) const;
116 
118  int getIntValue(int n) const;
119 
121  double getDoubleValue(int n) const;
122 
124  std::complex<double> getComplexValue(int n) const;
125 
127  std::string getStringValue(int n) const;
128 
130  bool getBoolValue(int n) const;
131 
133  bool intExists(std::string name) const;
134 
136  bool doubleExists(std::string name) const;
137 
139  bool complexExists(std::string name) const;
140 
142  bool stringExists(std::string name) const;
143 
145  bool boolExists(std::string name) const;
146 private:
148  std::vector<std::tuple<std::string, int>> intParams;
149 
151  std::vector<std::tuple<std::string, double>> doubleParams;
152 
154  std::vector<std::tuple<std::string, std::complex<double>>> complexParams;
155 
157  std::vector<std::tuple<std::string, std::string>> stringParams;
158 
160  std::vector<std::tuple<std::string, bool>> boolParams;
161 };
162 
163 }; //End of namespace TBTK
164 
165 #endif
TBTK::ParameterSet::intExists
bool intExists(std::string name) const
TBTK::ParameterSet::addBool
void addBool(std::string name, bool value)
TBTK::ParameterSet::getBoolValue
bool getBoolValue(int n) const
TBTK::ParameterSet::setInt
void setInt(std::string name, int value)
TBTK::ParameterSet
Definition: ParameterSet.h:34
TBTK::ParameterSet::ParameterSet
ParameterSet()
TBTK::ParameterSet::getString
std::string getString(std::string name) const
TBTK::ParameterSet::getNumComplex
int getNumComplex() const
TBTK::ParameterSet::getStringName
std::string getStringName(int n) const
TBTK::ParameterSet::~ParameterSet
~ParameterSet()
TBTK::ParameterSet::getComplexValue
std::complex< double > getComplexValue(int n) const
TBTK::ParameterSet::getNumString
int getNumString() const
TBTK::ParameterSet::addString
void addString(std::string name, std::string value)
TBTK::ParameterSet::doubleExists
bool doubleExists(std::string name) const
TBTK::ParameterSet::addInt
void addInt(std::string name, int value)
TBTK::ParameterSet::addComplex
void addComplex(std::string name, std::complex< double > value)
TBTK::ParameterSet::getBool
bool getBool(std::string name) const
TBTK::ParameterSet::getComplex
std::complex< double > getComplex(std::string name) const
TBTK::ParameterSet::setString
void setString(std::string name, std::string value)
TBTK::ParameterSet::getStringValue
std::string getStringValue(int n) const
TBTK::ParameterSet::getBoolName
std::string getBoolName(int n) const
TBTK::ParameterSet::boolExists
bool boolExists(std::string name) const
TBTK::ParameterSet::addDouble
void addDouble(std::string name, double value)
TBTK::ParameterSet::setBool
void setBool(std::string name, bool value)
TBTK::ParameterSet::getIntName
std::string getIntName(int n) const
TBTK::ParameterSet::getNumBool
int getNumBool() const
TBTK::ParameterSet::getDoubleName
std::string getDoubleName(int n) const
TBTK::ParameterSet::getNumDouble
int getNumDouble() const
TBTK::ParameterSet::getDoubleValue
double getDoubleValue(int n) const
TBTK::ParameterSet::setComplex
void setComplex(std::string name, std::complex< double > value)
TBTK::ParameterSet::getInt
int getInt(std::string name) const
TBTK::ParameterSet::stringExists
bool stringExists(std::string name) const
TBTK::ParameterSet::getIntValue
int getIntValue(int n) const
TBTK::ParameterSet::getDouble
double getDouble(std::string name) const
TBTK::ParameterSet::setDouble
void setDouble(std::string name, double value)
TBTK::ParameterSet::complexExists
bool complexExists(std::string name) const
TBTK::ParameterSet::getComplexName
std::string getComplexName(int n) const
TBTK::ParameterSet::getNumInt
int getNumInt() const