1 #ifndef __creaImageIOGimmick_h_INCLUDED__
2 #define __creaImageIOGimmick_h_INCLUDED__
4 #include <creaImageIOSQLiteTreeHandler.h>
5 #include <creaImageIOTreeHandlerImageAdder.h>
6 #include <creaImageIOTimestampDatabaseHandler.h>
7 #include <creaImageIOSynchron.h>
12 * \defgroup Controller Controller
18 * \defgroup Model Model
21 * \defgroup GUI Top level graphical user interfaces
24 * \defgroup IO Image I/O classes
27 * \defgroup Tree Attributed tree management
30 * \defgroup Previewer Preview related
37 //=======================================================================
38 /// Central controler of the gimmick application
48 typedef TreeHandlerImageAdder::Progress AddProgress;
49 typedef TreeHandlerImageAdder::ProgressCallbackType AddProgressCallbackType;
51 /// Adds the function f to the list of functions to call
52 /// when addition operations progres.
53 /// f is of type AddProgressCallbackType which is:
54 /// void (*AddProgressCallbackType)(AddProgress&)
55 /// To pass a member function 'f' of an instance 'c' of a class 'C'
56 /// as callback you have to 'bind' it, i.e. call:
57 /// ConnectAddProgressObserver ( boost::bind( &C::f , c, _1 ) );
58 void ConnectAddProgressObserver( AddProgressCallbackType callback )
59 { mImageAdder.ConnectProgressObserver(callback); }
63 const AddProgress& GetAddProgress() const { return mImageAdder.GetProgress(); }
65 /// Initialize (read/creates databases, etc.)
68 /// Finalize (closes databases, etc.)
71 /// Sets level for messages "Gimmick!"
72 static void SetMessageLevel(int level);
73 /// Sets level for debug messages "Gimmick! DEBUG"
74 static void SetDebugMessageLevel(int level);
76 /// Type of map from TreeHandler name to TreeHandler*
77 typedef std::map<std::string, TreeHandler*> TreeHandlerMapType;
79 /// Returns the TreeHandlerMap (ref)
80 TreeHandlerMapType& GetTreeHandlerMap() { return mTreeHandlerMap; }
81 /// Returns the TreeHandlerMap (const ref)
82 const TreeHandlerMapType& GetTreeHandlerMap() const
83 { return mTreeHandlerMap; }
86 /// Add the files to the given TreeHandler
87 void AddFiles(const std::string& handler,
88 const std::vector<std::string>& filenames);
90 /// Add a dir to the given TreeHandler
91 void AddDir(const std::string& handler, const std::string& path,
94 /// Removes a file from the given TreeHandler
95 void RemoveFile(const std::string& d,
96 const tree::Node* & filename);
98 ///Synchronizes the loaded data with the database. If remove is true the database will be updated, otherwise
99 ///only a warning sign will be issued
100 std::string Synchronize(bool repair, bool checkAttributes);
102 /// Prints the tree handled by the handler
103 void Print(const std::string& handler);
105 ///create a DB from a given descriptor file and for a specific location
106 SQLiteTreeHandler *createDB(std::string &i_name, std::string &i_locDesc, std::string &i_locDB);
108 // add an existent DB
109 void addDB(std::string &i_nameDB, std::string &i_locationDB);
111 /// Returns the TreeHandler with a given name
112 TreeHandler* GetTreeHandler(const std::string& name) const;
114 /// Returns the TimestampDatabase
115 TimestampDatabaseHandler* GetTimestampDatabase() const;
117 SQLiteTreeHandler* GetLocalDatabase() { return mLocalDatabase; }
119 const SQLiteTreeHandler* GetLocalDatabase() const
120 { return mLocalDatabase; }
125 const std::string& GetHomeDirectory();
126 const std::string& GetUserSettingsDirectory();
127 void CreateUserSettingsDirectory();
128 const std::string& GetLocalDatabasePath();
129 const std::string& GetTimestampDatabasePath();
132 //=============================================
134 SQLiteTreeHandler* mLocalDatabase;
135 TimestampDatabaseHandler* mTimestampDatabase;
136 TreeHandlerMapType mTreeHandlerMap;
137 Synchronizer* mSynchronizer;
139 std::string mCurrentDirectory;
140 std::string mHomeDirectory;
141 std::string mUserSettingsDirectory;
142 std::string mLocalDatabasePath;
143 std::string mTimestampDatabasePath;
145 TreeHandlerImageAdder mImageAdder;
148 //=======================================================================
151 } // EO namespace creaImageIO