mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-15 16:18:22 +01:00
Working on Create and Destroy methods
git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/branches/class@4187 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
09aa7f357e
commit
91ccdfab2f
30
IPhreeqc.cpp
30
IPhreeqc.cpp
@ -235,6 +235,36 @@ IPhreeqc::~IPhreeqc(void)
|
||||
delete this->SelectedOutput;
|
||||
}
|
||||
|
||||
std::map<size_t, IPhreeqc*> IPhreeqc::Instances;
|
||||
size_t IPhreeqc::InstancesIndex = 0;
|
||||
|
||||
int
|
||||
IPhreeqc::Create(void)
|
||||
{
|
||||
int n = (int)IPhreeqc::InstancesIndex;
|
||||
try
|
||||
{
|
||||
IPhreeqc* instance = new IPhreeqc;
|
||||
if (instance)
|
||||
{
|
||||
IPhreeqc::Instances[IPhreeqc::InstancesIndex] = instance;
|
||||
++IPhreeqc::InstancesIndex;
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
void
|
||||
Destroy(int n)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
// the library singleton
|
||||
IPhreeqc* IPhreeqc::Instance = 0;
|
||||
|
||||
|
||||
@ -74,7 +74,9 @@ public:
|
||||
void ClearAccumulatedLines(void);
|
||||
|
||||
// Singleton for library
|
||||
static IPhreeqc* LibraryInstance();
|
||||
static IPhreeqc* LibraryInstance(void);
|
||||
static int Create(void);
|
||||
static void Destroy(int n);
|
||||
|
||||
// Callbacks
|
||||
//
|
||||
@ -129,6 +131,8 @@ protected:
|
||||
|
||||
private:
|
||||
static IPhreeqc* Instance;
|
||||
static std::map<size_t, IPhreeqc*> Instances;
|
||||
static size_t InstancesIndex;
|
||||
};
|
||||
|
||||
#endif /* _INC_IPHREEQC_HPP */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user