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:
Scott R Charlton 2010-03-23 22:29:50 +00:00
parent 09aa7f357e
commit 91ccdfab2f
2 changed files with 35 additions and 1 deletions

View File

@ -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;

View File

@ -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 */