renamed *M routines without the M

git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/branches/class@4223 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
Scott R Charlton 2010-04-07 21:30:49 +00:00
parent 1a9e010282
commit 57c0ad5a75
4 changed files with 482 additions and 486 deletions

View File

@ -29,7 +29,7 @@ extern "C" {
* Internally used to create an error condition.
* @internal
*/
int AddErrorM(int id, const char* error_msg);
int AddError(int id, const char* error_msg);
/**
* TODO
@ -62,7 +62,7 @@ extern "C" {
* </CODE>
* @endhtmlonly
*/
int LoadDatabaseM(int id, const char* filename);
int LoadDatabase(int id, const char* filename);
/**
* Load the specified string as a database into phreeqc.
@ -82,14 +82,14 @@ extern "C" {
* </CODE>
* @endhtmlonly
*/
int LoadDatabaseStringM(int id, const char* input);
int LoadDatabaseString(int id, const char* input);
/**
* Unload any database currently loaded into phreeqc.
* @remarks
* Any previous database definitions are cleared.
*/
int UnLoadDatabaseM(int id);
int UnLoadDatabase(int id);
/**
* Output the error messages normally stored in the phreeqc.err file to stdout.
@ -103,18 +103,18 @@ extern "C" {
* </CODE>
* @endhtmlonly
*/
void OutputLastErrorM(int id);
void OutputLastError(int id);
const char* GetLastErrorStringM(int id);
const char* GetLastErrorString(int id);
// TODO const char* GetLastWarningString(void);
const char* GetDumpStringM(int id);
const char* GetDumpString(int id);
int GetDumpLineCountM(int id);
int GetDumpLineCount(int id);
const char* GetDumpLineM(int id, int n);
const char* GetDumpLine(int id, int n);
/**
* Accumlulate lines for input to phreeqc.
@ -133,7 +133,7 @@ extern "C" {
* </CODE>
* @endhtmlonly
*/
IPQ_RESULT AccumulateLineM(int id, const char *line);
IPQ_RESULT AccumulateLine(int id, const char *line);
/**
* Sets the selected_output flag on or off
@ -149,8 +149,8 @@ extern "C" {
* </CODE>
* @endhtmlonly
*/
int GetSelectedOutputOnM(int id);
IPQ_RESULT SetSelectedOutputOnM(int id, int value);
int GetSelectedOutputOn(int id);
IPQ_RESULT SetSelectedOutputOn(int id, int value);
/**
* Sets the output flag on or off
@ -166,8 +166,8 @@ extern "C" {
* </CODE>
* @endhtmlonly
*/
int GetOutputOnM(int id);
IPQ_RESULT SetOutputOnM(int id, int value);
int GetOutputOn(int id);
IPQ_RESULT SetOutputOn(int id, int value);
/**
* Sets the error flag on or off
@ -183,8 +183,8 @@ extern "C" {
* </CODE>
* @endhtmlonly
*/
int GetErrorOnM(int id);
IPQ_RESULT SetErrorOnM(int id, int value);
int GetErrorOn(int id);
IPQ_RESULT SetErrorOn(int id, int value);
/**
* Sets the log flag on or off
@ -200,8 +200,8 @@ extern "C" {
* </CODE>
* @endhtmlonly
*/
int GetLogOnM(int id);
IPQ_RESULT SetLogOnM(int id, int value);
int GetLogOn(int id);
IPQ_RESULT SetLogOn(int id, int value);
/**
* Sets the dump flag on or off
@ -217,8 +217,8 @@ extern "C" {
* </CODE>
* @endhtmlonly
*/
int GetDumpOnM(int id);
IPQ_RESULT SetDumpOnM(int id, int value);
int GetDumpOn(int id);
IPQ_RESULT SetDumpOn(int id, int value);
/**
* Sets the dump string flag on or off
@ -234,8 +234,8 @@ extern "C" {
* </CODE>
* @endhtmlonly
*/
int GetDumpStringOnM(int id);
IPQ_RESULT SetDumpStringOnM(int id, int value);
int GetDumpStringOn(int id);
IPQ_RESULT SetDumpStringOn(int id, int value);
/**
* Runs the accumulated input sent to AccumulateLine.
@ -254,7 +254,7 @@ extern "C" {
* </CODE>
* @endhtmlonly
*/
int RunAccumulatedM(int id);
int RunAccumulated(int id);
/**
* Runs the specified phreeqc input file.
@ -273,7 +273,7 @@ extern "C" {
* </CODE>
* @endhtmlonly
*/
int RunFileM(int id, const char* filename);
int RunFile(int id, const char* filename);
/**
* Runs the specified string as input to phreeqc.
@ -292,7 +292,7 @@ extern "C" {
* </CODE>
* @endhtmlonly
*/
int RunStringM(int id, const char* input);
int RunString(int id, const char* input);
/**
* Returns the number of rows currently contained within selected_output.
@ -307,7 +307,7 @@ extern "C" {
* </CODE>
* @endhtmlonly
*/
int GetSelectedOutputRowCountM(int id);
int GetSelectedOutputRowCount(int id);
/**
* Returns the number of columns currently contained within selected_output.
@ -322,7 +322,7 @@ extern "C" {
* </CODE>
* @endhtmlonly
*/
int GetSelectedOutputColumnCountM(int id);
int GetSelectedOutputColumnCount(int id);
/**
* Returns the \c VAR associated with the specified row and column.
@ -489,7 +489,7 @@ Headings
* </CODE>
* @endhtmlonly
*/
IPQ_RESULT GetSelectedOutputValueM(int id, int row, int col, VAR* pVAR);
IPQ_RESULT GetSelectedOutputValue(int id, int row, int col, VAR* pVAR);
/**
* TODO
@ -504,7 +504,7 @@ Headings
* </CODE>
* @endhtmlonly
*/
int GetComponentCountM(int id);
int GetComponentCount(int id);
/**
* TODO
@ -519,7 +519,7 @@ Headings
* </CODE>
* @endhtmlonly
*/
const char* GetComponentM(int id, int n);
const char* GetComponent(int id, int n);
/**
* Send the accumulated input to stdout.
@ -534,7 +534,7 @@ Headings
* </CODE>
* @endhtmlonly
*/
void OutputLinesM(int id);
void OutputLines(int id);
// TODO int RunWithCallback(PFN_PRERUN_CALLBACK pfn_pre, PFN_POSTRUN_CALLBACK pfn_post, void *cookie, int output_on, int error_on, int log_on, int selected_output_on);
@ -553,7 +553,7 @@ Headings
* </CODE>
* @endhtmlonly
*/
int GetErrorLineCountM(int id);
int GetErrorLineCount(int id);
/**
* TODO
@ -569,26 +569,11 @@ int GetErrorLineCountM(int id);
* </CODE>
* @endhtmlonly
*/
const char* GetErrorLineM(int id, int n);
const char* GetErrorLine(int id, int n);
#if defined(__cplusplus)
}
#endif
class IPhreeqcLib
{
public:
static int CreateIPhreeqc(void);
static IPQ_RESULT DestroyIPhreeqc(int n);
static IPhreeqc2* GetInstance(int n);
private:
static std::map<size_t, IPhreeqc2*> Instances;
static size_t InstancesIndex;
};
#endif // __IPHREEQC_LIB_H

View File

@ -3,6 +3,17 @@
#include <cassert>
#include <iostream>
class IPhreeqcLib
{
public:
static int CreateIPhreeqc(void);
static IPQ_RESULT DestroyIPhreeqc(int n);
static IPhreeqc2* GetInstance(int n);
private:
static std::map<size_t, IPhreeqc2*> Instances;
static size_t InstancesIndex;
};
int
CreateIPhreeqc(void)
@ -17,7 +28,7 @@ DestroyIPhreeqc(int id)
}
int
LoadDatabaseM(int id, const char* filename)
LoadDatabase(int id, const char* filename)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -28,7 +39,7 @@ LoadDatabaseM(int id, const char* filename)
}
int
LoadDatabaseStringM(int id, const char* input)
LoadDatabaseString(int id, const char* input)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -39,7 +50,7 @@ LoadDatabaseStringM(int id, const char* input)
}
int
UnLoadDatabaseM(int id)
UnLoadDatabase(int id)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -51,7 +62,7 @@ UnLoadDatabaseM(int id)
}
void
OutputLastErrorM(int id)
OutputLastError(int id)
{
static const char err_msg[] = "OutputLastError: Bad instance.\n";
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
@ -64,7 +75,7 @@ OutputLastErrorM(int id)
}
const char*
GetLastErrorStringM(int id)
GetLastErrorString(int id)
{
static const char err_msg[] = "GetLastErrorString: Bad instance.\n";
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
@ -76,7 +87,7 @@ GetLastErrorStringM(int id)
}
const char*
GetDumpStringM(int id)
GetDumpString(int id)
{
static const char empty[] = "";
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
@ -88,7 +99,7 @@ GetDumpStringM(int id)
}
int
GetDumpLineCountM(int id)
GetDumpLineCount(int id)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -99,7 +110,7 @@ GetDumpLineCountM(int id)
}
const char*
GetDumpLineM(int id, int n)
GetDumpLine(int id, int n)
{
static const char err_msg[] = "GetDumpLine: Bad instance.\n";
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
@ -111,7 +122,7 @@ GetDumpLineM(int id, int n)
}
int
GetComponentCountM(int id)
GetComponentCount(int id)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -122,7 +133,7 @@ GetComponentCountM(int id)
}
const char*
GetComponentM(int id, int n)
GetComponent(int id, int n)
{
static const char err_msg[] = "GetComponent: Bad instance.\n";
static const char empty[] = "";
@ -148,7 +159,7 @@ GetComponentM(int id, int n)
}
IPQ_RESULT
AccumulateLineM(int id, const char *line)
AccumulateLine(int id, const char *line)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -167,7 +178,7 @@ AccumulateLineM(int id, const char *line)
}
int
GetSelectedOutputOnM(int id)
GetSelectedOutputOn(int id)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -185,7 +196,7 @@ GetSelectedOutputOnM(int id)
}
IPQ_RESULT
SetSelectedOutputOnM(int id, int value)
SetSelectedOutputOn(int id, int value)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -197,7 +208,7 @@ SetSelectedOutputOnM(int id, int value)
}
int
GetOutputOnM(int id)
GetOutputOn(int id)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -215,7 +226,7 @@ GetOutputOnM(int id)
}
IPQ_RESULT
SetOutputOnM(int id, int value)
SetOutputOn(int id, int value)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -227,7 +238,7 @@ SetOutputOnM(int id, int value)
}
int
GetErrorOnM(int id)
GetErrorOn(int id)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -245,7 +256,7 @@ GetErrorOnM(int id)
}
IPQ_RESULT
SetErrorOnM(int id, int value)
SetErrorOn(int id, int value)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -257,7 +268,7 @@ SetErrorOnM(int id, int value)
}
int
GetLogOnM(int id)
GetLogOn(int id)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -275,7 +286,7 @@ GetLogOnM(int id)
}
IPQ_RESULT
SetLogOnM(int id, int value)
SetLogOn(int id, int value)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -288,7 +299,7 @@ SetLogOnM(int id, int value)
int
GetDumpOnM(int id)
GetDumpOn(int id)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -306,7 +317,7 @@ GetDumpOnM(int id)
}
IPQ_RESULT
SetDumpOnM(int id, int value)
SetDumpOn(int id, int value)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -318,7 +329,7 @@ SetDumpOnM(int id, int value)
}
int
GetDumpStringOnM(int id)
GetDumpStringOn(int id)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -336,7 +347,7 @@ GetDumpStringOnM(int id)
}
IPQ_RESULT
SetDumpStringOnM(int id, int value)
SetDumpStringOn(int id, int value)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -348,7 +359,7 @@ SetDumpStringOnM(int id, int value)
}
int
RunAccumulatedM(int id)
RunAccumulated(int id)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -359,7 +370,7 @@ RunAccumulatedM(int id)
}
int
RunFileM(int id, const char* filename)
RunFile(int id, const char* filename)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -370,7 +381,7 @@ RunFileM(int id, const char* filename)
}
int
RunStringM(int id, const char* input)
RunString(int id, const char* input)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -381,7 +392,7 @@ RunStringM(int id, const char* input)
}
int
GetSelectedOutputRowCountM(int id)
GetSelectedOutputRowCount(int id)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -392,7 +403,7 @@ GetSelectedOutputRowCountM(int id)
}
int
GetSelectedOutputColumnCountM(int id)
GetSelectedOutputColumnCount(int id)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -404,7 +415,7 @@ GetSelectedOutputColumnCountM(int id)
IPQ_RESULT
GetSelectedOutputValueM(int id, int row, int col, VAR* pVAR)
GetSelectedOutputValue(int id, int row, int col, VAR* pVAR)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -425,7 +436,7 @@ GetSelectedOutputValueM(int id, int row, int col, VAR* pVAR)
}
int
AddErrorM(int id, const char* error_msg)
AddError(int id, const char* error_msg)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -436,7 +447,7 @@ AddErrorM(int id, const char* error_msg)
}
void
OutputLinesM(int id)
OutputLines(int id)
{
static const char err_msg[] = "OutputLines: Bad instance.\n";
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
@ -449,7 +460,7 @@ OutputLinesM(int id)
}
int
GetErrorLineCountM(int id)
GetErrorLineCount(int id)
{
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr)
@ -460,7 +471,7 @@ GetErrorLineCountM(int id)
}
const char*
GetErrorLineM(int id, int n)
GetErrorLine(int id, int n)
{
static const char err_msg[] = "GetErrorLine: Bad instance.\n";
IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);

View File

@ -83,11 +83,11 @@ LoadDatabaseF(int *id, char* filename, unsigned int filename_length)
cfilename = f2cstring(filename, filename_length);
if (!cfilename)
{
::AddErrorM(*id, "LoadDatabase: Out of memory.\n");
::AddError(*id, "LoadDatabase: Out of memory.\n");
return VR_OUTOFMEMORY;
}
int n = ::LoadDatabaseM(*id, cfilename);
int n = ::LoadDatabase(*id, cfilename);
free(cfilename);
return n;
}
@ -100,11 +100,11 @@ LoadDatabaseStringF(int *id, char* input, unsigned int input_length)
cinput = f2cstring(input, input_length);
if (!cinput)
{
::AddErrorM(*id, "LoadDatabaseString: Out of memory.\n");
::AddError(*id, "LoadDatabaseString: Out of memory.\n");
return VR_OUTOFMEMORY;
}
int n = ::LoadDatabaseStringM(*id, cinput);
int n = ::LoadDatabaseString(*id, cinput);
free(cinput);
return n;
}
@ -118,11 +118,11 @@ AccumulateLineF(int *id, char *line, unsigned int line_length)
cline = f2cstring(line, line_length);
if (!cline)
{
::AddErrorM(*id, "AccumulateLine: Out of memory.\n");
::AddError(*id, "AccumulateLine: Out of memory.\n");
return IPQ_OUTOFMEMORY;
}
n = ::AccumulateLineM(*id, cline);
n = ::AccumulateLine(*id, cline);
free(cline);
return n;
}
@ -130,79 +130,79 @@ AccumulateLineF(int *id, char *line, unsigned int line_length)
IPQ_RESULT
SetSelectedOutputOnF(int *id, int* sel_on)
{
return ::SetSelectedOutputOnM(*id, *sel_on);
return ::SetSelectedOutputOn(*id, *sel_on);
}
IPQ_RESULT
SetOutputOnF(int *id, int* output_on)
{
return ::SetOutputOnM(*id, *output_on);
return ::SetOutputOn(*id, *output_on);
}
IPQ_RESULT
SetErrorOnF(int *id, int* error_on)
{
return ::SetErrorOnM(*id, *error_on);
return ::SetErrorOn(*id, *error_on);
}
IPQ_RESULT
SetLogOnF(int *id, int* log_on)
{
return ::SetLogOnM(*id, *log_on);
return ::SetLogOn(*id, *log_on);
}
IPQ_RESULT
SetDumpOnF(int *id, int* dump_on)
{
return ::SetDumpOnM(*id, *dump_on);
return ::SetDumpOn(*id, *dump_on);
}
IPQ_RESULT
SetDumpStringOnF(int *id, int* dump_string_on)
{
return ::SetDumpStringOnM(*id, *dump_string_on);
return ::SetDumpStringOn(*id, *dump_string_on);
}
int
GetDumpLineCountF(int *id)
{
return ::GetDumpLineCountM(*id);
return ::GetDumpLineCount(*id);
}
void
GetDumpLineF(int *id, int* n, char* line, unsigned int line_length)
{
padfstring(line, ::GetDumpLineM(*id, (*n) - 1), line_length);
padfstring(line, ::GetDumpLine(*id, (*n) - 1), line_length);
}
int
GetErrorLineCountF(int *id)
{
return ::GetErrorLineCountM(*id);
return ::GetErrorLineCount(*id);
}
void
GetErrorLineF(int *id, int* n, char* line, unsigned int line_length)
{
padfstring(line, ::GetErrorLineM(*id, (*n) - 1), line_length);
padfstring(line, ::GetErrorLine(*id, (*n) - 1), line_length);
}
int
GetComponentCountF(int *id)
{
return ::GetComponentCountM(*id);
return ::GetComponentCount(*id);
}
void
GetComponentF(int *id, int *n, char* comp, unsigned int line_length)
{
padfstring(comp, ::GetComponentM(*id, (*n) - 1), line_length);
padfstring(comp, ::GetComponent(*id, (*n) - 1), line_length);
}
int
RunAccumulatedF(int *id)
{
return ::RunAccumulatedM(*id);
return ::RunAccumulated(*id);
}
int
@ -213,11 +213,11 @@ RunFileF(int *id, char* filename, unsigned int filename_length)
cfilename = f2cstring(filename, filename_length);
if (!cfilename)
{
::AddErrorM(*id, "RunFile: Out of memory.\n");
::AddError(*id, "RunFile: Out of memory.\n");
return (int)VR_OUTOFMEMORY;
}
int n = ::RunFileM(*id, cfilename);
int n = ::RunFile(*id, cfilename);
free(cfilename);
return n;
}
@ -230,11 +230,11 @@ RunStringF(int *id, char* input, unsigned int input_length)
cinput = f2cstring(input, input_length);
if (!cinput)
{
::AddErrorM(*id, "RunString: Out of memory.\n");
::AddError(*id, "RunString: Out of memory.\n");
return (int)VR_OUTOFMEMORY;
}
int n = ::RunStringM(*id, cinput);
int n = ::RunString(*id, cinput);
free(cinput);
return n;
}
@ -242,7 +242,7 @@ RunStringF(int *id, char* input, unsigned int input_length)
int
GetSelectedOutputRowCountF(int *id)
{
int rows = ::GetSelectedOutputRowCountM(*id);
int rows = ::GetSelectedOutputRowCount(*id);
if (rows > 0)
{
rows -= 1;
@ -253,7 +253,7 @@ GetSelectedOutputRowCountF(int *id)
int
GetSelectedOutputColumnCountF(int *id)
{
return ::GetSelectedOutputColumnCountM(*id);
return ::GetSelectedOutputColumnCount(*id);
}
IPQ_RESULT
@ -265,7 +265,7 @@ GetSelectedOutputValueF(int *id, int *row, int *col, int *vtype, double* dvalue,
char buffer[100];
int adjcol = *col - 1;
result = ::GetSelectedOutputValueM(*id, *row, adjcol, &v);
result = ::GetSelectedOutputValue(*id, *row, adjcol, &v);
switch (v.type)
{
@ -301,13 +301,13 @@ GetSelectedOutputValueF(int *id, int *row, int *col, int *vtype, double* dvalue,
void
OutputLastErrorF(int *id)
{
::OutputLastErrorM(*id);
::OutputLastError(*id);
}
void
OutputLinesF(int *id)
{
::OutputLinesM(*id);
::OutputLines(*id);
}
#if defined(__cplusplus)

File diff suppressed because it is too large Load Diff