X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src2%2FcreaImageIOTreeHandlerImageAdder.h;h=521f0ffc13bf31d4d7fe8a6c1b45b0d44f7aa89c;hb=e4c4c1a9a170f8eb89f8e8642a510c4499465280;hp=6fdaf99a55375260ec431ad3ba156b7aaa32cdf1;hpb=7c6f60361461c27cb809f3e5d0473f211801b813;p=creaImageIO.git diff --git a/src2/creaImageIOTreeHandlerImageAdder.h b/src2/creaImageIOTreeHandlerImageAdder.h index 6fdaf99..521f0ff 100644 --- a/src2/creaImageIOTreeHandlerImageAdder.h +++ b/src2/creaImageIOTreeHandlerImageAdder.h @@ -2,9 +2,12 @@ #define __creaImageIOTreeHandlerImageAdder_h_INCLUDED__ #include +#include +#include #include #include #include +#include // Signal/slot mechanism for progress events #include #include @@ -21,6 +24,7 @@ namespace creaImageIO class TreeHandlerImageAdder { + public: //==================================================================== /// Ctor @@ -29,6 +33,12 @@ namespace creaImageIO ~TreeHandlerImageAdder(); /// Sets the TreeHandler void SetTreeHandler(TreeHandler* tree) { mTreeHandler = tree;} + /// Sets the TimestampDatabaseHandler + void SetTimestampHandler(TimestampDatabaseHandler* tdh) { mTimestampHandler = tdh;} + /// Sets the synchronizer + void SetSynchronizer(Synchronizer* s){mSynchronizer=s;} + /// Sets the synchronizer + void SetCurrentDatabase(std::string cur){mCurrentDB=cur;} //==================================================================== //==================================================================== @@ -98,7 +108,48 @@ namespace creaImageIO void AddFiles( const std::vector& filename ); /// (Recursively) adds the files of a directory to the TreeHandler void AddDirectory( const std::string& directory, - bool recurse ); + bool recurse); + /// Removes a file from the databases + void RemoveFile(tree::Node* node); + /// Removes files from the databases + void RemoveFiles(const std::vector& nodes); + /// Synchronizes the DB and disk by repeating the operations the user has done and returns a report + std::string Synchronize(bool repair, bool checkAttributes); + ///Recursively checks if the directory is synchronized and optionally the state of the attributes + void CheckSyncDirectory(const std::string &dirpath, + bool recursive, + bool repair, + bool checkAttributes, + std::vector &i_ignorefiles, + std::vector & attsModified, + std::vector & newfiles); + ///Copies the files indicated in the vector and updates all databases + void CopyFiles(const std::vector& filenames, const std::string directory ); + ///Finds the node that matches the specified parameters + void FindNode(tree::Node* parent, int level, + const std::string& searchParam, + const std::string& searchVal, + tree::Node*& node); + + ///Finds the nodes that partially match the searchVal + void FindNodePartial(tree::Node* parent, int level, const std::string& searchParam, const std::string& searchVal, tree::Node*& node); + + ///Checks the attributes of the database against the ones in disk + void CheckAttributes(bool repair, std::string& file, std::vector& attsModified); + ///Deletes the drive with the given name (use for all databases except maintenance and timestamp) + void DeleteDriveFromMainDB(const std::string& drive); + ///Deletes the drive with the given name (use for maintenance and timestamp databases) + void DeleteDriveFromOtherDB(const std::string& drive); + ///Edits the given field and sets the new parameters + void EditField(tree::Node* node, const std::string& name, const std::string& key, const std::string& val); + ///Returns the demanded attributes for the given file + void GetAttributes(const std::vector& params, + const std::string& filename, + std::vector& results); + + + + //==================================================================== private: @@ -110,17 +161,14 @@ namespace creaImageIO /// Recursive method which does the main job for AddDirectory void AddDirectoryRecursor( const std::string& directory, - bool recurse ); - - ///Sets the number of children for the tree - void SetNumberOfChildren(); - - ///Sets the number of children recursively for the given node - void SetNumberOfChildrenRecursor(tree::Node* node); - + bool recurse, + const std::string &addKey); TreeHandler* mTreeHandler; + TimestampDatabaseHandler* mTimestampHandler; + Synchronizer* mSynchronizer; ImageReader mReader; + std::string mCurrentDB; Progress mProgress; ProgressSignalType mProgressSignal;