COPASI API  4.40.278
CReadConfig Class Reference

#include <CReadConfig.h>

Public Types

enum  Mode { NEXT = 0 , SEARCH , LOOP , ALL }
 

Public Member Functions

 CReadConfig (const std::string &name)
 
 CReadConfig (std::istream &in)
 
C_INT32 fail ()
 
void getDefaults ()
 
C_INT32 getVariable (const std::string &name, const std::string &type, void *pout, CReadConfig::Mode mode=CReadConfig::NEXT)
 
C_INT32 getVariable (const std::string &name, const std::string &type, void *pout1, void *pout2, CReadConfig::Mode mode=CReadConfig::NEXT)
 
std::string getVersion ()
 
void rewind ()
 
 ~CReadConfig ()
 

Private Member Functions

 CReadConfig ()
 
C_INT32 initFileBuffer ()
 
std::string lookAhead ()
 

Private Attributes

C_INT32 mFail
 
std::stringstream mFileBuffer
 
std::string mFilename
 
C_INT32 mLineNumber
 
CReadConfig::Mode mMode
 
std::istream * mpBuffer
 
std::string mVersion
 

Detailed Description

CReadConfig class. A more elaborate class description. New Class based on pmutils read functionality

(C) Stefan Hoops 2001

Member Enumeration Documentation

◆ Mode

Enumerator
NEXT 
SEARCH 
LOOP 
ALL 

Constructor & Destructor Documentation

◆ CReadConfig() [1/3]

CReadConfig::CReadConfig ( void  )
private

Default constructor. This creates a configuration buffer for input assigning a filename. It is currently useless.

◆ CReadConfig() [2/3]

CReadConfig::CReadConfig ( const std::string &  name)

Specified constructor. This opens the configuration file using the filename specified as the argument.

Parameters
namename of the configuration file.

References getVariable(), initFileBuffer(), and mVersion.

◆ CReadConfig() [3/3]

CReadConfig::CReadConfig ( std::istream &  in)

Specified constructor. This opens the configuration file using the filename specified as the argument.

Parameters
std::istream& in

◆ ~CReadConfig()

CReadConfig::~CReadConfig ( void  )

Destructor. The destructor calls the method free().

Member Function Documentation

◆ fail()

C_INT32 CReadConfig::fail ( )

Returns the failure status.

Returns
mFail
See also
mFail

References mFail.

◆ getDefaults()

void CReadConfig::getDefaults ( )

Load various system wide default values

◆ getVariable() [1/2]

◆ getVariable() [2/2]

C_INT32 CReadConfig::getVariable ( const std::string &  name,
const std::string &  type,
void *  pout1,
void *  pout2,
CReadConfig::Mode  mode = CReadConfig::NEXT 
)

Retrieves a variable from the input file.

Parameters
namename of the variable to be retrieved.
typetype of the variable to be retrieved.
*pout1pointer to the location where the first part of the retrieved variable is stored.
*pout2pointer to the location where the second part of the retrieved variable is stored.
Returns
mFail
See also
mFail

References CCopasiMessage::ERROR, getVariable(), MCReadConfig, and mFail.

◆ getVersion()

std::string CReadConfig::getVersion ( )

◆ initFileBuffer()

C_INT32 CReadConfig::initFileBuffer ( )
private

Initializes the input buffer for reading.

Returns
mFail
See also
mFail

References CCopasiMessage::ERROR, CLocaleString::fromUtf8(), MCReadConfig, mFail, mFileBuffer, mFilename, and mpBuffer.

Referenced by CReadConfig().

◆ lookAhead()

std::string CReadConfig::lookAhead ( )
private

Look ahead to find the next variable name

References mpBuffer.

Referenced by getVariable().

◆ rewind()

void CReadConfig::rewind ( )

Rewind the buffer

References mLineNumber, and mpBuffer.

Referenced by getVariable().

Member Data Documentation

◆ mFail

C_INT32 CReadConfig::mFail
private

Failure status: 0 = no error !0 = error

Referenced by fail(), getVariable(), and initFileBuffer().

◆ mFileBuffer

std::stringstream CReadConfig::mFileBuffer
private

A buffer for reading the file.

Referenced by initFileBuffer().

◆ mFilename

std::string CReadConfig::mFilename
private

Name of the configuration file.

Referenced by getVariable(), and initFileBuffer().

◆ mLineNumber

C_INT32 CReadConfig::mLineNumber
private

Current line number in the configuration file

Referenced by getVariable(), and rewind().

◆ mMode

CReadConfig::Mode CReadConfig::mMode
private

◆ mpBuffer

std::istream* CReadConfig::mpBuffer
private

A pointer to the input buffer

Referenced by getVariable(), initFileBuffer(), lookAhead(), and rewind().

◆ mVersion

std::string CReadConfig::mVersion
private

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