23 #ifndef AlpsParameters_h
24 #define AlpsParameters_h
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])
AlpsParameterT
This enumerative constant describes the possible parameter types.
@ AlpsStringArrayPar
The parameter is an array of strings.
@ AlpsDoublePar
Double parameter.
@ AlpsNoPar
The type is not yet specified.
@ AlpsStringPar
String parameter (E.g., data file name.).
@ AlpsBoolPar
Bool parameter.
@ AlpsIntPar
Integer parameter.
This data structure is to contain the packed form of an encodable knowledge.
This is the class serves as a holder for a set of parameters.
std::vector< std::pair< std::string, AlpsParameter > > keys_
The keyword, parameter pairs.
virtual void pack(AlpsEncoded &buf)
Pack the parameter set into the buffer.
std::vector< std::string > * sapar_
void readFromStream(std::istream &parstream)
Read the parameters from the stream specified in the argument.
virtual void createKeywordList()=0
Method for creating the list of keyword looked for in the parameter file.
void setEntry(const AlpsParameter key, const char *val)
First, there is the assignment operator that sets the whole parameter set at once.
int * ipar_
The integer parameters.
std::vector< std::string > obsoleteKeys_
list of obsolete keywords.
virtual ~AlpsParameterSet()
The destructor deletes all data members.
int numSa_
The "vector of string" parameters.
void writeToStream(std::ostream &outstream) const
Write keyword-value pairs to the stream specified in the argument.
AlpsParameterSet(int c, int i, int d, int s, int sa)
The constructor allocate memory for parameters.
virtual void setDefaultEntries()=0
Method for setting the default values for the parameters.
bool * bpar_
The bool parameters.
virtual void unpack(AlpsEncoded &buf)
Unpack the parameter set from the buffer.
double * dpar_
The double parameters.
void readFromFile(const char *paramfile)
Read parameters from a file.
void readFromArglist(const int argnum, const char *const *arglist)
Read parameters from the command line.
std::string * spar_
The string (actually, std::string) parameters.
This parameter indeintifies a single parameter entry.
int index() const
Return the index of the parameter within all parameters of the same type.
AlpsParameterT type() const
Return the type of the parameter.
AlpsParameter()
The default constructor creates a phony parameter.
~AlpsParameter()
The destructor.
AlpsParameter(const AlpsParameterT t, const int i)
Constructor where members are specified.