23 #ifndef AlpsParameters_h
24 #define AlpsParameters_h
39 #include "CoinError.hpp"
41 #if defined(__GNUC__) && (__GNUC__ >= 3)
44 # define ALPS_STRINGSTREAM std::istringstream
48 # define ALPS_STRINGSTREAM std::istrstream
96 type_(t), index_(i) {}
107 int index()
const {
return index_; }
140 std::vector< std::pair<std::string, AlpsParameter> >
keys_;
183 throw CoinError(
"can't call pack()",
"pack",
" AlpsParameterSet");
188 throw CoinError(
"can't call unpack()",
"unpack",
" AlpsParameterSet");
247 dpar_(new double[d]),
248 spar_(new
std::string[s]),
249 sapar_(new
std::vector<
std::string>[sa])
255 obsoleteKeys_.clear();
256 delete[]
bpar_; bpar_ = 0;
257 delete[]
ipar_; ipar_ = 0;
258 delete[]
dpar_; dpar_ = 0;
259 delete[]
spar_; spar_ = 0;
260 delete[]
sapar_; sapar_ = 0;
The parameter is an array of strings.
double * dpar_
The double parameters.
void writeToStream(std::ostream &outstream) const
Write keyword-value pairs to the stream specified in the argument.
std::string * spar_
The string (actually, std::string) parameters.
This data structure is to contain the packed form of an encodable knowledge.
virtual void pack(AlpsEncoded &buf)
Pack the parameter set into the buffer.
std::vector< std::string > obsoleteKeys_
list of obsolete keywords.
void readFromArglist(const int argnum, const char *const *arglist)
Read parameters from the command line.
int * ipar_
The integer parameters.
virtual void createKeywordList()=0
Method for creating the list of keyword looked for in the parameter file.
virtual ~AlpsParameterSet()
The destructor deletes all data members.
void readFromStream(std::istream &parstream)
Read the parameters from the stream specified in the argument.
AlpsParameterT type() const
Return the type of the parameter.
bool * bpar_
The bool parameters.
void setEntry(const AlpsParameter key, const char *val)
First, there is the assignment operator that sets the whole parameter set at once.
AlpsParameter(const AlpsParameterT t, const int i)
Constructor where members are specified.
std::vector< std::string > * sapar_
int index() const
Return the index of the parameter within all parameters of the same type.
AlpsParameterT
This enumerative constant describes the possible parameter types.
int numSa_
The "vector of string" parameters.
AlpsParameter()
The default constructor creates a phony parameter.
AlpsParameterSet(int c, int i, int d, int s, int sa)
The constructor allocate memory for parameters.
std::vector< std::pair< std::string, AlpsParameter > > keys_
The keyword, parameter pairs.
String parameter (E.g., data file name.).
void readFromFile(const char *paramfile)
Read parameters from a file.
virtual void setDefaultEntries()=0
Method for setting the default values for the parameters.
virtual void unpack(AlpsEncoded &buf)
Unpack the parameter set from the buffer.
This is the class serves as a holder for a set of parameters.
~AlpsParameter()
The destructor.
This parameter indeintifies a single parameter entry.
The type is not yet specified.