TBTK
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 namespace Util{
34 
36 public:
38  ParameterSet();
39 
41  ~ParameterSet();
42 
44  void addInt(std::string name, int value);
45 
47  void addDouble(std::string name, double value);
48 
50  void addComplex(std::string name, std::complex<double> value);
51 
53  void addString(std::string name, std::string value);
54 
56  void addBool(std::string name, bool value);
57 
59  void setInt(std::string name, int value);
60 
62  void setDouble(std::string name, double value);
63 
65  void setComplex(std::string name, std::complex<double> value);
66 
68  void setString(std::string name, std::string value);
69 
71  void setBool(std::string name, bool value);
72 
74  int getInt(std::string name) const;
75 
77  double getDouble(std::string name) const;
78 
80  std::complex<double> getComplex(std::string name) const;
81 
83  std::string getString(std::string name) const;
84 
86  bool getBool(std::string name) const;
87 
89  int getNumInt() const;
90 
92  int getNumDouble() const;
93 
95  int getNumComplex() const;
96 
98  int getNumString() const;
99 
101  int getNumBool() const;
102 
104  std::string getIntName(int n) const;
105 
107  std::string getDoubleName(int n) const;
108 
110  std::string getComplexName(int n) const;
111 
113  std::string getStringName(int n) const;
114 
116  std::string getBoolName(int n) const;
117 
119  int getIntValue(int n) const;
120 
122  double getDoubleValue(int n) const;
123 
125  std::complex<double> getComplexValue(int n) const;
126 
128  std::string getStringValue(int n) const;
129 
131  bool getBoolValue(int n) const;
132 
134  bool intExists(std::string name) const;
135 
137  bool doubleExists(std::string name) const;
138 
140  bool complexExists(std::string name) const;
141 
143  bool stringExists(std::string name) const;
144 
146  bool boolExists(std::string name) const;
147 private:
149  std::vector<std::tuple<std::string, int>> intParams;
150 
152  std::vector<std::tuple<std::string, double>> doubleParams;
153 
155  std::vector<std::tuple<std::string, std::complex<double>>> complexParams;
156 
158  std::vector<std::tuple<std::string, std::string>> stringParams;
159 
161  std::vector<std::tuple<std::string, bool>> boolParams;
162 };
163 
164 }; //End of namespace Util
165 }; //End of namespace TBTK
166 
167 #endif
void addString(std::string name, std::string value)
Definition: ParameterSet.cpp:76
std::complex< double > getComplex(std::string name) const
Definition: ParameterSet.cpp:202
void setComplex(std::string name, std::complex< double > value)
Definition: ParameterSet.cpp:132
std::string getDoubleName(int n) const
Definition: ParameterSet.cpp:268
std::string getIntName(int n) const
Definition: ParameterSet.cpp:264
int getNumDouble() const
Definition: ParameterSet.cpp:248
void addComplex(std::string name, std::complex< double > value)
Definition: ParameterSet.cpp:63
~ParameterSet()
Definition: ParameterSet.cpp:34
void addInt(std::string name, int value)
Definition: ParameterSet.cpp:37
std::string getComplexName(int n) const
Definition: ParameterSet.cpp:272
std::string getStringValue(int n) const
Definition: ParameterSet.cpp:296
int getIntValue(int n) const
Definition: ParameterSet.cpp:284
bool getBoolValue(int n) const
Definition: ParameterSet.cpp:300
void addDouble(std::string name, double value)
Definition: ParameterSet.cpp:50
bool stringExists(std::string name) const
Definition: ParameterSet.cpp:334
int getNumString() const
Definition: ParameterSet.cpp:256
double getDouble(std::string name) const
Definition: ParameterSet.cpp:188
std::string getStringName(int n) const
Definition: ParameterSet.cpp:276
int getNumComplex() const
Definition: ParameterSet.cpp:252
double getDoubleValue(int n) const
Definition: ParameterSet.cpp:288
bool doubleExists(std::string name) const
Definition: ParameterSet.cpp:314
ParameterSet()
Definition: ParameterSet.cpp:31
int getInt(std::string name) const
Definition: ParameterSet.cpp:174
void setDouble(std::string name, double value)
Definition: ParameterSet.cpp:117
std::string getString(std::string name) const
Definition: ParameterSet.cpp:216
bool intExists(std::string name) const
Definition: ParameterSet.cpp:304
int getNumInt() const
Definition: ParameterSet.cpp:244
std::complex< double > getComplexValue(int n) const
Definition: ParameterSet.cpp:292
Definition: AbstractOperator.h:26
void addBool(std::string name, bool value)
Definition: ParameterSet.cpp:89
Definition: ParameterSet.h:35
void setBool(std::string name, bool value)
Definition: ParameterSet.cpp:160
bool getBool(std::string name) const
Definition: ParameterSet.cpp:230
bool complexExists(std::string name) const
Definition: ParameterSet.cpp:324
void setInt(std::string name, int value)
Definition: ParameterSet.cpp:103
std::string getBoolName(int n) const
Definition: ParameterSet.cpp:280
void setString(std::string name, std::string value)
Definition: ParameterSet.cpp:146
bool boolExists(std::string name) const
Definition: ParameterSet.cpp:344
int getNumBool() const
Definition: ParameterSet.cpp:260