mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 08:38:23 +01:00
git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/branches/class@4227 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
7499d8f14d
commit
95e46c1659
50
IPhreeqc.cpp
50
IPhreeqc.cpp
@ -270,9 +270,9 @@ size_t IPhreeqc::AddError(const char* error_msg)
|
||||
return this->ErrorReporter->AddError(error_msg);
|
||||
}
|
||||
|
||||
size_t IPhreeqc::AddWarning(const char* error_msg)
|
||||
size_t IPhreeqc::AddWarning(const char* warn_msg)
|
||||
{
|
||||
return this->WarningReporter->AddError(error_msg);
|
||||
return this->WarningReporter->AddError(warn_msg);
|
||||
}
|
||||
|
||||
const std::string& IPhreeqc::GetAccumulatedLines(void)
|
||||
@ -285,6 +285,11 @@ void IPhreeqc::OutputLastError(void)
|
||||
std::cout << this->GetLastErrorString() << std::endl;
|
||||
}
|
||||
|
||||
void IPhreeqc::OutputLastWarning(void)
|
||||
{
|
||||
std::cout << this->GetLastWarningString() << std::endl;
|
||||
}
|
||||
|
||||
void IPhreeqc::OutputLines(void)
|
||||
{
|
||||
std::cout << this->StringInput.c_str() << std::endl;
|
||||
@ -1228,16 +1233,45 @@ const char* IPhreeqc::GetErrorLine(int n)
|
||||
return this->ErrorLines[n].c_str();
|
||||
}
|
||||
|
||||
int IPhreeqc::GetWarningLineCount(void)const
|
||||
{
|
||||
return (int)this->WarningLines.size();
|
||||
}
|
||||
|
||||
const char* IPhreeqc::GetWarningLine(int n)
|
||||
{
|
||||
static const char empty[] = "";
|
||||
if (n < 0 || n >= this->GetWarningLineCount())
|
||||
{
|
||||
return empty;
|
||||
}
|
||||
return this->WarningLines[n].c_str();
|
||||
}
|
||||
|
||||
void IPhreeqc::update_errors(void)
|
||||
{
|
||||
this->LastErrorString = ((CErrorReporter<std::ostringstream>*)this->ErrorReporter)->GetOS()->str();
|
||||
|
||||
this->ErrorLines.clear();
|
||||
std::istringstream iss(this->LastErrorString);
|
||||
std::string line;
|
||||
while (std::getline(iss, line))
|
||||
this->LastErrorString = ((CErrorReporter<std::ostringstream>*)this->ErrorReporter)->GetOS()->str();
|
||||
if (this->LastErrorString.size())
|
||||
{
|
||||
this->ErrorLines.push_back(line);
|
||||
std::istringstream iss(this->LastErrorString);
|
||||
std::string line;
|
||||
while (std::getline(iss, line))
|
||||
{
|
||||
this->ErrorLines.push_back(line);
|
||||
}
|
||||
}
|
||||
|
||||
this->WarningLines.clear();
|
||||
this->LastWarningString = ((CErrorReporter<std::ostringstream>*)this->WarningReporter)->GetOS()->str();
|
||||
if (this->LastWarningString.size())
|
||||
{
|
||||
std::istringstream iss(this->LastWarningString);
|
||||
std::string line;
|
||||
while (std::getline(iss, line))
|
||||
{
|
||||
this->WarningLines.push_back(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -74,6 +74,19 @@ OutputLastError(int id)
|
||||
std::cout << err_msg << std::endl;
|
||||
}
|
||||
|
||||
void
|
||||
OutputLastWarning(int id)
|
||||
{
|
||||
static const char err_msg[] = "OutputLastWarning: Bad instance.\n";
|
||||
IPhreeqc* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
|
||||
if (IPhreeqcPtr)
|
||||
{
|
||||
IPhreeqcPtr->OutputLastWarning();
|
||||
return;
|
||||
}
|
||||
std::cout << err_msg << std::endl;
|
||||
}
|
||||
|
||||
const char*
|
||||
GetLastErrorString(int id)
|
||||
{
|
||||
@ -86,6 +99,18 @@ GetLastErrorString(int id)
|
||||
return err_msg;
|
||||
}
|
||||
|
||||
const char*
|
||||
GetLastWarningString(int id)
|
||||
{
|
||||
static const char err_msg[] = "GetLastWarningString: Bad instance.\n";
|
||||
IPhreeqc* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
|
||||
if (IPhreeqcPtr)
|
||||
{
|
||||
return IPhreeqcPtr->GetLastWarningString();
|
||||
}
|
||||
return err_msg;
|
||||
}
|
||||
|
||||
const char*
|
||||
GetDumpString(int id)
|
||||
{
|
||||
@ -482,6 +507,28 @@ GetErrorLine(int id, int n)
|
||||
return err_msg;
|
||||
}
|
||||
|
||||
int
|
||||
GetWarningLineCount(int id)
|
||||
{
|
||||
IPhreeqc* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
|
||||
if (IPhreeqcPtr)
|
||||
{
|
||||
return (int)IPhreeqcPtr->GetWarningLineCount();
|
||||
}
|
||||
return IPQ_BADINSTANCE;
|
||||
}
|
||||
|
||||
const char*
|
||||
GetWarningLine(int id, int n)
|
||||
{
|
||||
static const char err_msg[] = "GetWarningLine: Bad instance.\n";
|
||||
IPhreeqc* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
|
||||
if (IPhreeqcPtr)
|
||||
{
|
||||
return IPhreeqcPtr->GetWarningLine(n);
|
||||
}
|
||||
return err_msg;
|
||||
}
|
||||
|
||||
std::map<size_t, IPhreeqc*> IPhreeqcLib::Instances;
|
||||
size_t IPhreeqcLib::InstancesIndex = 0;
|
||||
|
||||
@ -15,7 +15,6 @@
|
||||
#include <vector>
|
||||
#include "CVar.hxx"
|
||||
|
||||
// TODO: templatize
|
||||
class CSelectedOutput
|
||||
{
|
||||
public:
|
||||
|
||||
20
fwrap.cpp
20
fwrap.cpp
@ -187,6 +187,18 @@ GetErrorLineF(int *id, int* n, char* line, unsigned int line_length)
|
||||
padfstring(line, ::GetErrorLine(*id, (*n) - 1), line_length);
|
||||
}
|
||||
|
||||
int
|
||||
GetWarningLineCountF(int *id)
|
||||
{
|
||||
return ::GetWarningLineCount(*id);
|
||||
}
|
||||
|
||||
void
|
||||
GetWarningLineF(int *id, int* n, char* line, unsigned int line_length)
|
||||
{
|
||||
padfstring(line, ::GetWarningLine(*id, (*n) - 1), line_length);
|
||||
}
|
||||
|
||||
int
|
||||
GetComponentCountF(int *id)
|
||||
{
|
||||
@ -402,6 +414,14 @@ void __stdcall GETERRORLINE(int *id, int *n, char* line, unsigned int line_lengt
|
||||
{
|
||||
GetErrorLineF(id, n, line, line_length);
|
||||
}
|
||||
int __stdcall GETWARNINGLINECOUNT(int *id)
|
||||
{
|
||||
return GetWarningLineCountF(id);
|
||||
}
|
||||
void __stdcall GETWARNINGLINE(int *id, int *n, char* line, unsigned int line_length)
|
||||
{
|
||||
GetWarningLineF(id, n, line, line_length);
|
||||
}
|
||||
int __stdcall GETCOMPONENTCOUNT(int *id)
|
||||
{
|
||||
return GetComponentCountF(id);
|
||||
|
||||
4
fwrap.h
4
fwrap.h
@ -46,6 +46,10 @@ extern "C" {
|
||||
|
||||
void GetErrorLineF(int *id, int* n, char* line, unsigned int line_length);
|
||||
|
||||
int GetWarningLineCountF(int *id);
|
||||
|
||||
void GetWarningLineF(int *id, int* n, char* line, unsigned int line_length);
|
||||
|
||||
int GetComponentCountF(int *id);
|
||||
|
||||
void GetComponentF(int *id, int* n, char* line, unsigned int line_length);
|
||||
|
||||
@ -66,6 +66,14 @@ void GETERRORLINE(int *id, int *n, char* line, unsigned int line_length)
|
||||
{
|
||||
GetErrorLineF(id, n, line, line_length);
|
||||
}
|
||||
int GETWARNINGLINECOUNT(int *id)
|
||||
{
|
||||
return GetWarningLineCountF(id);
|
||||
}
|
||||
void GETWARNINGLINE(int *id, int *n, char* line, unsigned int line_length)
|
||||
{
|
||||
GetWarningLineF(id, n, line, line_length);
|
||||
}
|
||||
int GETCOMPONENTCOUNT(int *id)
|
||||
{
|
||||
return GetComponentCountF(id);
|
||||
|
||||
@ -66,6 +66,14 @@ void geterrorline_(int *id, int *n, char* line, unsigned int line_length)
|
||||
{
|
||||
GetErrorLineF(id, n, line, line_length);
|
||||
}
|
||||
int getwarninglinecount_(int *id)
|
||||
{
|
||||
return GetWarningLineCountF(id);
|
||||
}
|
||||
void getwarningline_(int *id, int *n, char* line, unsigned int line_length)
|
||||
{
|
||||
GetWarningLineF(id, n, line, line_length);
|
||||
}
|
||||
int getcomponentcount_(int *id)
|
||||
{
|
||||
return GetComponentCountF(id);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user