diff --git a/src/IPhreeqc.cpp b/src/IPhreeqc.cpp index 74a7e154..3c8fbc92 100644 --- a/src/IPhreeqc.cpp +++ b/src/IPhreeqc.cpp @@ -235,6 +235,36 @@ IPhreeqc::~IPhreeqc(void) delete this->SelectedOutput; } +std::map 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; diff --git a/src/IPhreeqc.hpp b/src/IPhreeqc.hpp index 04b53b8b..e202550a 100644 --- a/src/IPhreeqc.hpp +++ b/src/IPhreeqc.hpp @@ -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 Instances; + static size_t InstancesIndex; }; #endif /* _INC_IPHREEQC_HPP */