]> Creatis software - creaImageIO.git/blob - src2/creaImageIOGimmick.h
*** empty log message ***
[creaImageIO.git] / src2 / creaImageIOGimmick.h
1 #ifndef __creaImageIOGimmick_h_INCLUDED__
2 #define __creaImageIOGimmick_h_INCLUDED__
3
4 #include <creaImageIOSQLiteTreeHandler.h>
5
6 namespace creaImageIO
7 {
8         /**
9         * \defgroup Controller Controller
10         */
11         /**
12         * \defgroup View View
13         */
14         /**
15         * \defgroup Model Model
16         */
17         /**
18         * \defgroup GUI Top level graphical user interfaces
19         */
20
21         /**
22         * \ingroup Controller
23         */
24
25   //=======================================================================
26   /// Central controler of the gimmick application
27   class Gimmick
28   {
29   public:
30     /// Ctor
31     Gimmick();
32     /// Dtor
33     ~Gimmick();
34     
35     /// Initialize (read/creates databases, etc.)
36     void Initialize();
37     
38     /// Finalize (closes databases, etc.)
39     void Finalize();
40
41     /// Sets level for messages "Gimmick!" 
42     static void SetMessageLevel(int level);
43     /// Sets level for debug messages "Gimmick! DEBUG" 
44     static void SetDebugMessageLevel(int level);
45     
46     /// Type of map from TreeHandler name to TreeHandler*
47     typedef std::map<std::string, TreeHandler*> TreeHandlerMapType;
48
49     /// Returns the TreeHandlerMap (ref)
50     TreeHandlerMapType& GetTreeHandlerMap() { return mTreeHandlerMap; }
51     /// Returns the TreeHandlerMap (const ref)
52     const TreeHandlerMapType& GetTreeHandlerMap() const
53     { return mTreeHandlerMap; }
54     
55
56     /// Add a file to the given TreeHandler
57     void AddFile(const std::string& handler, const std::string& filename);
58     /// Add a dir to the given TreeHandler
59     void AddDir(const std::string& handler, const std::string& path, 
60                 bool recurse);
61
62     /// Prints the tree handled by the handler
63     void Print(const std::string& handler);
64
65
66     /// Returns the TreeHandler with a given name
67     TreeHandler* GetTreeHandler(const std::string& name) const;
68     /// 
69     SQLiteTreeHandler* GetLocalDatabase() { return mLocalDatabase; }
70
71     const SQLiteTreeHandler* GetLocalDatabase() const 
72     { return mLocalDatabase; }
73
74     
75
76     /// 
77     const std::string& GetHomeDirectory();
78     const std::string& GetUserSettingsDirectory();
79     void CreateUserSettingsDirectory();
80     const std::string& GetLocalDatabasePath();
81
82   private:
83     SQLiteTreeHandler* mLocalDatabase;
84     TreeHandlerMapType mTreeHandlerMap;
85
86     std::string mCurrentDirectory;
87     std::string mHomeDirectory;
88     std::string mUserSettingsDirectory;
89     std::string mLocalDatabasePath;
90     
91   };
92   // EO class Gimmick
93   //=======================================================================
94
95
96 } // EO namespace creaImageIO
97
98 // EOF
99 #endif  
100
101