From: Frederic Cervenansky Date: Fri, 6 Nov 2009 15:52:06 +0000 (+0000) Subject: addding desciptor name and DB name as Gimmick options X-Git-Tag: CREATOOLS.2-0-3~101 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=a56d83cfd745de68ef8ec4250c9ef6f9fe3ab776;p=creaImageIO.git addding desciptor name and DB name as Gimmick options --- diff --git a/src2/creaImageIOGimmick.cpp b/src2/creaImageIOGimmick.cpp index 877a21e..58b4c96 100644 --- a/src2/creaImageIOGimmick.cpp +++ b/src2/creaImageIOGimmick.cpp @@ -9,6 +9,11 @@ # define PATH_MAX 2048 #endif +#ifdef _RELWITHDEBINFO +#define new DEBUG_NEW +#endif + + #ifdef _DEBUG #define new DEBUG_NEW #endif @@ -22,6 +27,8 @@ namespace creaImageIO RegisterGimmickMessageTypes(); mSettings=0; mSynchronizer=0; + mLocalDescpName = "localdatabase_Descriptor.dscp"; + mLocalDBName = "Local database"; } //============================================================== @@ -42,15 +49,17 @@ namespace creaImageIO //============================================================== //============================================================== - void Gimmick::Initialize(const std::string& path) + void Gimmick::Initialize(const std::string& i_namedescp, const std::string i_namedb) { + mLocalDescpName = i_namedescp; + mLocalDBName = i_namedb; Initialize(); } //============================================================== void Gimmick::Initialize() { - std::string i_nameDB = "Local database"; + std::string i_nameDB = mLocalDBName; // Create the UserSettings dir if does not exist CreateUserSettingsDirectory(); // Sets the current directory to the home dir @@ -61,7 +70,7 @@ namespace creaImageIO std::string dbpath = GetLocalDatabasePath(); // Create or open local database - std::string dpath= mCurrentDirectory + "/.gimmick/Shared/gimmick/localdatabase_Descriptor.dscp"; + std::string dpath= mCurrentDirectory + "/.gimmick/Shared/gimmick/" + mLocalDescpName; boost::algorithm::replace_all( dpath, INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR); @@ -227,7 +236,7 @@ namespace creaImageIO boost::filesystem::create_directory( setDir ); setDir+="gimmick/"; boost::filesystem::create_directory( setDir ); - setDir+="localdatabase_Descriptor.dscp"; + setDir+=mLocalDescpName; if(!boost::filesystem::is_regular(setDir)) { @@ -244,9 +253,11 @@ namespace creaImageIO // The following stuff works on Linux, NOT CHECKED on Windows // JPR #if defined(_WIN32) - path+="/bin/Shared/gimmick/localdatabase_Descriptor.dscp"; + path+="/bin/Shared/gimmick/"; + path+=mLocalDescpName; #else - path+="/Shared/gimmick/localdatabase_Descriptor.dscp"; + path+="/Shared/gimmick/"; + path+= mLocalDescpName; #endif std::cout <<"From: " << path < #include +#ifdef _RELWITHDEBINFO +#include +#define DEBUG_NEW new(_NORMAL_BLOCK ,__FILE__, __LINE__) +#else +#define DEBUG_NEW new +#endif #ifdef _DEBUG #include @@ -97,7 +103,7 @@ namespace creaImageIO void Initialize(); /// Initializes with the local database descriptor in the path given (read/creates databases, etc.) - void Initialize(const std::string& path); + void Initialize(const std::string& namedescp, const std::string namedb = "Local Database"); /// Finalize (closes databases, etc.) void Finalize(); @@ -197,6 +203,8 @@ namespace creaImageIO std::string mLocalDatabasePath; Settings *mSettings; TreeHandlerImageAdder mImageAdder; + std::string mLocalDBName; + std::string mLocalDescpName; }; // EO class Gimmick //=======================================================================