]> Creatis software - creaImageIO.git/commitdiff
New folder structure to comply with Linux and Mac OS standards and documentation...
authorcaballero <caballero>
Fri, 26 Jun 2009 13:08:39 +0000 (13:08 +0000)
committercaballero <caballero>
Fri, 26 Jun 2009 13:08:39 +0000 (13:08 +0000)
install/CMakeLists.txt
src2/CMakeLists.txt
src2/creaImageIOGimmick.cpp
src2/creaImageIOGimmick.h
src2/creaImageIOSettings.cpp
src2/creaImageIOSynchron.h
src2/data/localdatabase_Descriptor.txt

index 3e14d9d71158f9232b43798980c9fe27108fa606..8e179f246642ea3fef052a0cec68f2f937b4ae1f 100644 (file)
@@ -65,6 +65,8 @@ IF (WIN32)
      
 
 ENDIF (WIN32)
+
+ INSTALL( FILES ${PROJECT_SOURCE_DIR}/src2/data/localdatabase_Descriptor.txt DESTINATION bin/Shared/gimmick )
  
 IF (BUILD_STANDALONE_INSTALLER)
 
index 9aded620bca6570f3ffc86e377dc9091132da3cc..3fe2c57375bc66ec67816ed022d36865f5c31a5f 100644 (file)
@@ -146,7 +146,7 @@ SET(${LIBRARY_NAME}_ADDITIONAL_USE_FILE
   CREA_ADVANCED_INSTALL_LIBRARY_FOR_CMAKE(${LIBRARY_NAME})
 
 SET(INPUT_DATA_DIR ${PROJECT_SOURCE_DIR}/src2/data)
-SET(OUTPUT_DATA_DIR ${PROJECT_BINARY_DIR}/data)
+SET(OUTPUT_DATA_DIR ${PROJECT_BINARY_DIR}/bin/Shared/gimmick)
 CREA_CPDIR(${INPUT_DATA_DIR} ${OUTPUT_DATA_DIR})
 
   
index 1e7b74a171352092a7419b90a746b5232abc96e8..55491754e15f980b53cee48b2a8f74a4b178d0f2 100644 (file)
@@ -39,6 +39,12 @@ namespace creaImageIO
   }
   //==============================================================
   
+  //==============================================================
+  void Gimmick::Initialize(const std::string& path)
+  {
+         mDescriptorPath=path;
+         Initialize();
+  }
 
   //==============================================================
   void Gimmick::Initialize()
@@ -48,14 +54,14 @@ namespace creaImageIO
     CreateUserSettingsDirectory();
     // Sets the current directory to the home dir
     mCurrentDirectory =  GetHomeDirectory();
-       mSynchronizer= new Synchronizer(GetUserSettingsDirectory());
+       mSynchronizer= new Synchronizer(GetUserSettingsDirectory()+"Shared/gimmick/");
 
        mSettings  = new Settings(mCurrentDirectory);
        
 
        std::string dbpath = GetLocalDatabasePath();
     // Create or open local database
-       std::string dpath= mCurrentDirectory + "/.gimmick/localdatabase_Descriptor.txt";
+       std::string dpath= mCurrentDirectory + "/.gimmick/Shared/gimmick/localdatabase_Descriptor.txt";
        boost::algorithm::replace_all( dpath,
                                       INVALID_FILE_SEPARATOR , 
                                       VALID_FILE_SEPARATOR);
@@ -216,7 +222,7 @@ namespace creaImageIO
     if (mLocalDatabasePath.size()==0) 
       {
        mLocalDatabasePath = GetUserSettingsDirectory();
-       mLocalDatabasePath += "local_database.sqlite3";
+       mLocalDatabasePath += "Shared/gimmick/local_database.sqlite3";
        boost::algorithm::replace_all( mLocalDatabasePath,
                                       INVALID_FILE_SEPARATOR , 
                                       VALID_FILE_SEPARATOR);
@@ -232,7 +238,7 @@ namespace creaImageIO
     if (mTimestampDatabasePath.size()==0) 
       {
        mTimestampDatabasePath = GetUserSettingsDirectory();
-       mTimestampDatabasePath += "timestamp_database.sqlite3";
+       mTimestampDatabasePath += "Shared/gimmick/timestamp_database.sqlite3";
        boost::algorithm::replace_all( mTimestampDatabasePath,
                                       INVALID_FILE_SEPARATOR , 
                                       VALID_FILE_SEPARATOR);
@@ -259,18 +265,26 @@ namespace creaImageIO
        boost::algorithm::replace_all( setDir,
                                       INVALID_FILE_SEPARATOR , 
                                       VALID_FILE_SEPARATOR);
+       setDir+="Shared/";
+       boost::filesystem::create_directory( setDir );
+       setDir+="gimmick/";
+       boost::filesystem::create_directory( setDir );
        setDir+="localdatabase_Descriptor.txt";
-       //if(!boost::filesystem::is_regular_file(setDir))  //JPRX
+
        if(!boost::filesystem::is_regular(setDir))
        {
                char name[PATH_MAX];
 //EED          int err = GetBinaryDirectory(name, PATH_MAX);
                crea::System::GetAppPath(name,PATH_MAX);
+               std::cout<<name<<std::endl;
                
                std::string path=name;
                path=path.substr(0,path.size()-1);
                path=path.substr(0,path.find_last_of("/"));
-               path+="/data/localdatabase_Descriptor.txt";
+               //Creating directories
+               path+="/bin/Shared/gimmick/localdatabase_Descriptor.txt";
+               std::cout<<"From: "<<path<<std::endl;
+               std::cout<<"To: "<<setDir<<std::endl;
                boost::algorithm::replace_all( path,
                                                INVALID_FILE_SEPARATOR , 
                                                VALID_FILE_SEPARATOR);
index 4b307eeacc7314ed509d1c15254e65b6c6c48091..41e6b3b183d53616872fc81404fa713c02f9c099 100644 (file)
@@ -63,8 +63,11 @@ namespace creaImageIO
     ///
     const AddProgress& GetAddProgress() const { return mImageAdder.GetProgress(); }
 
-    /// Initialize (read/creates databases, etc.)
+    /// Initializes with default values (read/creates databases, etc.)
     void Initialize();
+
+       /// Initializes with the local database descriptor in the path given (read/creates databases, etc.)
+    void Initialize(const std::string& path);
     
     /// Finalize (closes databases, etc.)
     void Finalize();
index 03b4317747c56e2d16e3eeb7c254c6f6690f8cc5..92908785bc43de2a340dfba8254150d64e3ad3a7 100644 (file)
@@ -12,7 +12,7 @@ namespace creaImageIO
     Settings::Settings(const std::string i_path)
     {
         //need to position path in user directory first.
-        m_SettingsFileName = i_path + "\\.gimmick\\app.config";
+        m_SettingsFileName = i_path + "\\.gimmick\\Shared\\gimmick\\app.config";
         //Test if Settings File exist
         if(!boost::filesystem::exists(m_SettingsFileName) )
         {
index 11ecd1bbf15ec9dd2b3edeba2c79f8437c945bc3..422c2ebb79c4db2e51118a1be4b3c6a32d682b2f 100644 (file)
@@ -11,13 +11,19 @@ namespace creaImageIO
 {
        using namespace std;
    //================================================================================================================
+       ///Represents the list of currently added files
     class AddList
     {
       public :
+                 ///Key to be added into the database
               std::string key;
+                         ///Path of the directory
               std::string path;
+                         /// Defines if the operation was recursive or not
               std::string recursive;
+                         ///Number of added files
               std::string nbFiles;
+                         ///Ctor
               AddList(CppSQLite3Query& res):
                          key(res.getStringField(0)), 
                          path(res.getStringField(1)),
@@ -28,14 +34,19 @@ namespace creaImageIO
    //================================================================================================================
 
    //================================================================================================================
+       ///Represents the list of currently removed files
        class RemoveList
     {
       public :
+                 ///Key to be added into the database
               std::string key;
+                         ///Path of the remove file
               std::string path;
+                         ///Defines if the file was removed or not
               std::string remove;
+                         ///Time of the last change of the file
               std::string time;
-             
+             ///Ctor
               RemoveList(CppSQLite3Query& res):
                          key(res.getStringField(1)), 
                          path(res.getStringField(2)),
@@ -46,51 +57,70 @@ namespace creaImageIO
    //================================================================================================================
   
    //================================================================================================================
+       ///In charge of the synchronization of the database and the disk state.
     class Synchronizer
     {
       public:
+                 ///Ctor
               Synchronizer(const std::string& path);
+                         ///Dtor
               virtual ~Synchronizer();
+                         ///Initializes the database
                          void Initialize();
+                         ///Inserts an add operation to the database
                          void InsertAddOp(const std::string& path, 
                                                        const std::string& recursive,
                                                        const std::string& nChildren, 
                                                        const std::string& refdb);
+                         ///Inserts a file to be ignored
                          void InsertIgnoreFile(const std::string& addKey,
                                                        const std::string& path, 
                                                        const std::string& remove,
                                                        const std::string& time,
                                                        const std::string& refdb);
+                         ///Removes an entry that matches the given parameter
                          void RemoveEntry(const std::string i_table, const std::string i_key);
+                         ///Removes several entries
                          void RemoveEntries(const std::string i_table, 
                                                                                        const std::string i_attribute, 
                                                                                        const std::string i_operand, 
                                                                                        const std::string i_key);
+                         ///Gets the list of AddFiles
                          void GetFileList(std::vector<AddList>& files , const std::string& refdb);
+                         ///Gets the list of ignored files
                          void GetIgnoredFiles(const std::string& key, std::vector<std::string> &ignoreList);
+                         ///Gets the attribute that matches the parameters
                          std::string GetAttribute(const std::string& attribute, 
                                                                                const std::string& table, 
                                                                                const std::string& searchParam,
                                                                                const std::string& searchValue,
                                                                                const std::string& refdb);
+                         ///Sets an attribute to an entry that matches the given parameters
                          void SetAttribute(const std::string& attribute, 
                                                                                const std::string& table, 
                                                                                const std::string& value,
                                                                                const std::string& searchParam,
                                                                                const std::string& searchValue, 
                                                                                const std::string& refdb);
+                         ///The current AddList
               std::vector<AddList>  mAddList;
+                         ///The current RemoveList
               std::vector<RemoveList>  mIgnoreList;
       private :
              
               /// The DB
               CppSQLite3DB* mDB;
+                         ///Path of the current database
               std::string pathDB;
+                         ///Creates a new database
               void CreateDB();
+                         ///Updates the AddList
               void UpdateAddList(const std::string& refdb);
+                         ///Cleans the list in case operations are no longer useful (0 added files)
               void CleanList(const std::string& refdb);
+                         ///Cleans the name (changes slashes and backslashes according to the system)
                          void CleanName(std::string& str) const;
-       
+                         ///Gets the ignore list
                      std::vector<std::string> GetIgnoreList(const std::string &i_key);
 
     };
index 89072509f436bb70ec3f327c55ebffc27c5021f6..e3338aa7c50305e288382e721663fc1f688b6d75 100644 (file)
@@ -34,15 +34,11 @@ Image
 D 0x0020 0x0013 3
 D 0x0028 0x0010 3
 D 0x0028 0x0011 3
-D 0x0028 0x0012 3
-D 0x0028 0x0002 3
 D 0x0028 0x0008 3
-D 0x0028 0x0004 3
 D 0x0028 0x0103 3
 D 0x0020 0x0032 3
 D 0x0020 0x0037 3
 D 0x0020 0x1041 3
-D 0x0028 0x0006 3
 D 0x0028 0x0030 3
 D 0x0028 0x0100 3
 D 0x0028 0x0101 3