1 #ifndef __creaImageIOGimmick_h_INCLUDED__
2 #define __creaImageIOGimmick_h_INCLUDED__
4 #include <creaImageIOSQLiteTreeHandler.h>
5 #include <creaImageIOTreeHandlerImageAdder.h>
6 #include <creaImageIOSynchronizer.h>
11 * \defgroup Controller Controller
17 * \defgroup Model Model
20 * \defgroup GUI Top level graphical user interfaces
23 * \defgroup IO Image I/O classes
26 * \defgroup Tree Attributed tree management
29 * \defgroup Previewer Preview related
36 //=======================================================================
37 /// Central controler of the gimmick application
47 typedef TreeHandlerImageAdder::Progress AddProgress;
48 typedef TreeHandlerImageAdder::ProgressCallbackType AddProgressCallbackType;
50 /// Adds the function f to the list of functions to call
51 /// when addition operations progres.
52 /// f is of type AddProgressCallbackType which is:
53 /// void (*AddProgressCallbackType)(AddProgress&)
54 /// To pass a member function 'f' of an instance 'c' of a class 'C'
55 /// as callback you have to 'bind' it, i.e. call:
56 /// ConnectAddProgressObserver ( boost::bind( &C::f , c, _1 ) );
57 void ConnectAddProgressObserver( AddProgressCallbackType callback )
58 { mImageAdder.ConnectProgressObserver(callback); }
62 const AddProgress& GetAddProgress() const { return mImageAdder.GetProgress(); }
64 /// Initialize (read/creates databases, etc.)
67 /// Finalize (closes databases, etc.)
70 /// Sets level for messages "Gimmick!"
71 static void SetMessageLevel(int level);
72 /// Sets level for debug messages "Gimmick! DEBUG"
73 static void SetDebugMessageLevel(int level);
75 /// Type of map from TreeHandler name to TreeHandler*
76 typedef std::map<std::string, TreeHandler*> TreeHandlerMapType;
78 /// Returns the TreeHandlerMap (ref)
79 TreeHandlerMapType& GetTreeHandlerMap() { return mTreeHandlerMap; }
80 /// Returns the TreeHandlerMap (const ref)
81 const TreeHandlerMapType& GetTreeHandlerMap() const
82 { return mTreeHandlerMap; }
85 /// Add the files to the given TreeHandler
86 void AddFiles(const std::string& handler,
87 const std::vector<std::string>& filenames);
89 /// Add a dir to the given TreeHandler
90 void AddDir(const std::string& handler, const std::string& path,
93 ///Synchronizes the loaded data with the database. If remove is true the database will be updated, otherwise
94 ///only a warning sign will be issued
95 void Synchronize(bool update, TreeHandler* handler);
97 /// Prints the tree handled by the handler
98 void Print(const std::string& handler);
101 /// Returns the TreeHandler with a given name
102 TreeHandler* GetTreeHandler(const std::string& name) const;
104 SQLiteTreeHandler* GetLocalDatabase() { return mLocalDatabase; }
106 const SQLiteTreeHandler* GetLocalDatabase() const
107 { return mLocalDatabase; }
112 const std::string& GetHomeDirectory();
113 const std::string& GetUserSettingsDirectory();
114 void CreateUserSettingsDirectory();
115 const std::string& GetLocalDatabasePath();
118 //=============================================
120 SQLiteTreeHandler* mLocalDatabase;
121 TreeHandlerMapType mTreeHandlerMap;
122 Synchronizer* mSynchronizer;
124 std::string mCurrentDirectory;
125 std::string mHomeDirectory;
126 std::string mUserSettingsDirectory;
127 std::string mLocalDatabasePath;
129 TreeHandlerImageAdder mImageAdder;
132 //=======================================================================
135 } // EO namespace creaImageIO