GAMSlinks  0.4
GamsOptions.hpp
Go to the documentation of this file.
1 // Copyright (C) GAMS Development 2008
2 // All Rights Reserved.
3 // This code is published under the Common Public License.
4 //
5 // $Id: GamsOptions.hpp 510 2008-08-16 19:31:27Z stefan $
6 //
7 // Author: Stefan Vigerske
8 
9 #ifndef GAMSOPTIONS_HPP_
10 #define GAMSOPTIONS_HPP_
11 
12 #include "GAMSlinksConfig.h"
13 // from CoinUtils
14 #include "CoinPragma.hpp"
15 
16 #include "GamsHandler.hpp"
17 
18 extern "C" struct optRec;
19 
22 class GamsOptions {
23 private:
25 
26  struct optRec* optionshandle; // handle for options
27 
28 public:
35  GamsOptions(GamsHandler& gams_, const char* solvername);
36 
39  ~GamsOptions();
40 
44  bool readOptionsFile(const char* optfilename);
45 
49  bool isKnown(const char* optname);
54  bool isDefined(const char *optname);
55 // bool optDefinedRecent(const char *optname);
56 
60  inline bool getBool(const char* optname) { return getInteger(optname); }
64  int getInteger(const char *optname);
68  double getDouble(const char *optname);
73  char* getString(const char *optname, char *buffer);
74 
79  inline void setBool(const char *optname, bool bval) { setInteger(optname, bval ? 1 : 0); }
84  void setInteger(const char *optname, int ival);
89  void setDouble(const char *optname, double dval);
94  void setString(const char *optname, const char *sval);
95 };
96 
97 #endif /*GAMSOPTIONS_HPP_*/
void setInteger(const char *optname, int ival)
Sets the value of an integer option.
bool isKnown(const char *optname)
Checks whether an option exists.
void setBool(const char *optname, bool bval)
Sets the value of a boolean option.
Definition: GamsOptions.hpp:79
~GamsOptions()
Destructor.
void setDouble(const char *optname, double dval)
Sets the value of a double option.
bool isDefined(const char *optname)
Checks whether the user specified some option.
char * getString(const char *optname, char *buffer)
Gets the value of a string option.
GamsOptions(GamsHandler &gams_, const char *solvername)
Constructor for GamsOptions class.
double getDouble(const char *optname)
Gets the value of a real (double) option.
Forwards requests for output, point transformations, dictionary files, and other things to a GAMS I/O...
Definition: GamsHandler.hpp:18
int getInteger(const char *optname)
Gets the value of an integer option.
bool readOptionsFile(const char *optfilename)
Reads an options file.
bool getBool(const char *optname)
Gets the value of a boolean option.
Definition: GamsOptions.hpp:60
Class to handle the access to a GAMS options file.
Definition: GamsOptions.hpp:22
struct optRec * optionshandle
Definition: GamsOptions.hpp:26
GamsHandler & gams
Definition: GamsOptions.hpp:24
void setString(const char *optname, const char *sval)
Sets the value of a string option.