COPASI API
4.16.103
Main Page
Namespaces
Classes
Files
File List
File Members
copasi
utilities
CReadConfig.h
Go to the documentation of this file.
1
// Copyright (C) 2010 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2
// Properties, Inc., University of Heidelberg, and The University
3
// of Manchester.
4
// All rights reserved.
5
6
// Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
7
// Properties, Inc., EML Research, gGmbH, University of Heidelberg,
8
// and The University of Manchester.
9
// All rights reserved.
10
11
// Copyright (C) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual
12
// Properties, Inc. and EML Research, gGmbH.
13
// All rights reserved.
14
15
/**
16
* CReadConfig class. A more elaborate class description.
17
* New Class based on pmutils read functionality
18
*
19
* (C) Stefan Hoops 2001
20
*/
21
22
#ifndef COPASI_CReadConfig
23
#define COPASI_CReadConfig
24
25
#include <iostream>
26
#include <sstream>
27
28
#include <string>
29
30
// available operations mode for the configurations buffer
31
// #define CReadConfig_SEARCH 0x01
32
// #define CReadConfig_LOOP 0x02
33
34
class
CReadConfig
35
{
36
// data
37
38
public
:
39
enum
Mode
40
{
41
NEXT
= 0,
42
SEARCH
,
43
LOOP
,
44
ALL
45
};
46
47
private
:
48
/**
49
* Default constructor.
50
* This creates a configuration buffer for input assigning a filename.
51
* It is currently useless.
52
*/
53
CReadConfig
();
54
55
/**
56
* Initializes the input buffer for reading.
57
* @return mFail
58
* @see mFail
59
*/
60
C_INT32
initFileBuffer
();
61
62
/**
63
* Look ahead to find the next variable name
64
*/
65
std::string
lookAhead
();
66
67
/**
68
* A pointer to the input buffer
69
*/
70
std::istream *
mpBuffer
;
71
72
/**
73
* Current line number in the configuration file
74
*/
75
C_INT32
mLineNumber
;
76
77
/**
78
* Mode = CReadConfig::SEARCH
79
*/
80
CReadConfig::Mode
mMode
;
81
82
/**
83
* Failure status:
84
* 0 = no error
85
* !0 = error
86
*/
87
C_INT32
mFail
;
88
89
/*
90
* The Version of the configuration file.
91
*/
92
std::string
mVersion
;
93
94
/**
95
* Name of the configuration file.
96
*/
97
std::string
mFilename
;
98
99
/**
100
* A buffer for reading the file.
101
*/
102
std::stringstream
mFileBuffer
;
103
104
public
:
105
/**
106
* Specified constructor.
107
* This opens the configuration file using the filename specified
108
* as the argument.
109
* @param name name of the configuration file.
110
*/
111
CReadConfig
(
const
std::string& name);
112
113
/**
114
* Specified constructor.
115
* This opens the configuration file using the filename specified
116
* as the argument.
117
* @param std::istream & in
118
*/
119
CReadConfig
(std::istream & in);
120
121
/**
122
* Destructor.
123
* The destructor calls the method free().
124
*/
125
~CReadConfig
();
126
127
/**
128
* Retrieves the version string of the configbuffer
129
*/
130
std::string
getVersion
();
131
132
/**
133
* Load various system wide default values
134
*/
135
void
getDefaults
();
136
137
/**
138
* Returns the failure status.
139
* @return mFail
140
* @see mFail
141
*/
142
C_INT32
fail
();
143
144
/**
145
* Retrieves a variable from the input file.
146
* @param name name of the variable to be retrieved.
147
* @param type type of the variable to be retrieved.
148
* @param *pout pointer to the location where the retrieved variable
149
* is stored.
150
* @return mFail
151
* @see mFail
152
*/
153
C_INT32
getVariable
(
const
std::string& name,
154
const
std::string& type,
155
void
* pout,
156
CReadConfig::Mode
mode =
CReadConfig::NEXT
);
157
158
/**
159
* Retrieves a variable from the input file.
160
* @param name name of the variable to be retrieved.
161
* @param type type of the variable to be retrieved.
162
* @param *pout1 pointer to the location where the first part of the
163
* retrieved variable is stored.
164
* @param *pout2 pointer to the location where the second part of the
165
* retrieved variable is stored.
166
* @return mFail
167
* @see mFail
168
*/
169
C_INT32
getVariable
(
const
std::string& name,
170
const
std::string& type,
171
void
* pout1,
172
void
* pout2,
173
CReadConfig::Mode
mode =
CReadConfig::NEXT
);
174
175
/**
176
* Rewind the buffer
177
*/
178
void
rewind
();
179
};
180
181
#endif // COPASI_CReadConfig
CReadConfig::lookAhead
std::string lookAhead()
Definition:
CReadConfig.cpp:324
CReadConfig::Mode
Mode
Definition:
CReadConfig.h:39
CReadConfig::initFileBuffer
C_INT32 initFileBuffer()
Definition:
CReadConfig.cpp:282
CReadConfig::mFilename
std::string mFilename
Definition:
CReadConfig.h:97
CReadConfig::getVersion
std::string getVersion()
Definition:
CReadConfig.cpp:76
CReadConfig::mMode
CReadConfig::Mode mMode
Definition:
CReadConfig.h:80
C_INT32
#define C_INT32
Definition:
copasi.h:90
CReadConfig::fail
C_INT32 fail()
Definition:
CReadConfig.cpp:71
CReadConfig::mFail
C_INT32 mFail
Definition:
CReadConfig.h:87
CReadConfig::~CReadConfig
~CReadConfig()
Definition:
CReadConfig.cpp:68
CReadConfig::mLineNumber
C_INT32 mLineNumber
Definition:
CReadConfig.h:75
CReadConfig::CReadConfig
CReadConfig()
Definition:
CReadConfig.cpp:34
CReadConfig::mVersion
std::string mVersion
Definition:
CReadConfig.h:92
CReadConfig::SEARCH
Definition:
CReadConfig.h:42
CReadConfig::rewind
void rewind()
Definition:
CReadConfig.cpp:336
CReadConfig::mFileBuffer
std::stringstream mFileBuffer
Definition:
CReadConfig.h:102
CReadConfig::LOOP
Definition:
CReadConfig.h:43
CReadConfig
Definition:
CReadConfig.h:34
CReadConfig::NEXT
Definition:
CReadConfig.h:41
CReadConfig::getVariable
C_INT32 getVariable(const std::string &name, const std::string &type, void *pout, CReadConfig::Mode mode=CReadConfig::NEXT)
Definition:
CReadConfig.cpp:81
CReadConfig::ALL
Definition:
CReadConfig.h:44
CReadConfig::getDefaults
void getDefaults()
Definition:
CReadConfig.cpp:78
CReadConfig::mpBuffer
std::istream * mpBuffer
Definition:
CReadConfig.h:70
Generated on Thu Jul 2 2015 14:50:36 for COPASI API by
1.8.6