GAMSlinks  0.4
Public Member Functions | Private Attributes | List of all members
GamsOptions Class Reference

Class to handle the access to a GAMS options file. More...

#include <GamsOptions.hpp>

Collaboration diagram for GamsOptions:
Collaboration graph
[legend]

Public Member Functions

 GamsOptions (GamsHandler &gams_, const char *solvername)
 Constructor for GamsOptions class. More...
 
 ~GamsOptions ()
 Destructor. More...
 
bool readOptionsFile (const char *optfilename)
 Reads an options file. More...
 
bool isKnown (const char *optname)
 Checks whether an option exists. More...
 
bool isDefined (const char *optname)
 Checks whether the user specified some option. More...
 
bool getBool (const char *optname)
 Gets the value of a boolean option. More...
 
int getInteger (const char *optname)
 Gets the value of an integer option. More...
 
double getDouble (const char *optname)
 Gets the value of a real (double) option. More...
 
char * getString (const char *optname, char *buffer)
 Gets the value of a string option. More...
 
void setBool (const char *optname, bool bval)
 Sets the value of a boolean option. More...
 
void setInteger (const char *optname, int ival)
 Sets the value of an integer option. More...
 
void setDouble (const char *optname, double dval)
 Sets the value of a double option. More...
 
void setString (const char *optname, const char *sval)
 Sets the value of a string option. More...
 

Private Attributes

GamsHandlergams
 
struct optRec * optionshandle
 

Detailed Description

Class to handle the access to a GAMS options file.

Definition at line 22 of file GamsOptions.hpp.

Constructor & Destructor Documentation

GamsOptions::GamsOptions ( GamsHandler gams_,
const char *  solvername 
)

Constructor for GamsOptions class.

Initialization of options handle. Reading of the file "<systemdir>/opt<solvername>.def" to learn which options are supported.

Parameters
gams_A GAMS handler to get access to the system directory name and other stuff.
solvernameThe name of your solver.
GamsOptions::~GamsOptions ( )

Destructor.

Member Function Documentation

bool GamsOptions::readOptionsFile ( const char *  optfilename)

Reads an options file.

Parameters
optfilenameGiving NULL for optfilename will read nothing and returns true.
bool GamsOptions::isKnown ( const char *  optname)

Checks whether an option exists.

Returns
True, if the option exists, i.e., defined in the options definition file. False otherwise.
bool GamsOptions::isDefined ( const char *  optname)

Checks whether the user specified some option.

Parameters
optnameThe name of the option.
Returns
True, if the option had been specified in the option file.
bool GamsOptions::getBool ( const char *  optname)
inline

Gets the value of a boolean option.

Parameters
optnameThe name of the option.

Definition at line 60 of file GamsOptions.hpp.

References getInteger().

int GamsOptions::getInteger ( const char *  optname)

Gets the value of an integer option.

Parameters
optnameThe name of the option.

Referenced by getBool().

double GamsOptions::getDouble ( const char *  optname)

Gets the value of a real (double) option.

Parameters
optnameThe name of the option.
char* GamsOptions::getString ( const char *  optname,
char *  buffer 
)

Gets the value of a string option.

Parameters
optnameThe name of the option.
bufferA buffer where the value can be stored (it should be large enough).
void GamsOptions::setBool ( const char *  optname,
bool  bval 
)
inline

Sets the value of a boolean option.

Parameters
optnameThe name of the option.
bvalThe value to set.

Definition at line 79 of file GamsOptions.hpp.

References setInteger().

void GamsOptions::setInteger ( const char *  optname,
int  ival 
)

Sets the value of an integer option.

Parameters
optnameThe name of the option.
ivalThe value to set.

Referenced by setBool().

void GamsOptions::setDouble ( const char *  optname,
double  dval 
)

Sets the value of a double option.

Parameters
optnameThe name of the option.
dvalThe value to set.
void GamsOptions::setString ( const char *  optname,
const char *  sval 
)

Sets the value of a string option.

Parameters
optnameThe name of the option.
svalThe value to set.

Member Data Documentation

GamsHandler& GamsOptions::gams
private

Definition at line 24 of file GamsOptions.hpp.

struct optRec* GamsOptions::optionshandle
private

Definition at line 26 of file GamsOptions.hpp.


The documentation for this class was generated from the following file: