Documentation for OpenFLUID 2.2.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
WorkspaceManager.hpp
Go to the documentation of this file.
1 /*
2 
3  This file is part of OpenFLUID software
4  Copyright(c) 2007, INRA - Montpellier SupAgro
5 
6 
7  == GNU General Public License Usage ==
8 
9  OpenFLUID is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  OpenFLUID is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21 
22 
23  == Other Usage ==
24 
25  Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26  license, and requires a written agreement between You and INRA.
27  Licensees for Other Usage of OpenFLUID may use this file in accordance
28  with the terms contained in the written agreement between You and INRA.
29 
30 */
31 
32 /**
33  @file WorkspaceManager.hpp
34 
35  @author Jean-Christophe Fabre <jean-christophe.fabre@inrae.fr>
36  */
37 
38 
39 #ifndef __OPENFLUID_BASE_WORKSPACEMANAGER_HPP__
40 #define __OPENFLUID_BASE_WORKSPACEMANAGER_HPP__
41 
42 
43 #include <memory>
44 
45 #include <openfluid/ware/TypeDefs.hpp>
48 #include <openfluid/dllexport.hpp>
49 
50 
51 namespace openfluid { namespace base {
52 
53 
55 {
56 
58 
59 
60  private:
61 
62  std::string m_WorkspacePath;
63 
64  std::unique_ptr<openfluid::tools::SettingsBackend> m_Settings;
65 
66  bool m_IsOpen = false;
67 
69 
71 
72  static void updateSettingsFile(const std::string& FilePath);
73 
74  void prepareWorkspace();
75 
76  void loadSettings();
77 
78 
79  public:
80 
82  {
83  std::string Name;
84 
85  std::string Path;
86  };
87 
88  static void prepareWorkspace(const std::string& Path);
89 
90  void openWorkspace(const std::string& Path);
91 
93 
94  bool isOpen() const
95  {
96  return m_IsOpen;
97  }
98 
99  std::string getWorkspacePath() const
100  {
101  return m_WorkspacePath;
102  }
103 
104  static std::string getSettingsFile(const std::string& WorkspacePath);
105 
106  static std::string getProjectsPath(const std::string& WorkspacePath);
107 
108  static std::string getWaresPath(const std::string& WorkspacePath,
110 
111  static std::string getWarePath(const std::string& WorkspacePath,
113 
114  std::string getSettingsFile() const;
115 
116  std::string getProjectsPath() const;
117 
118  std::string getProjectPath(const std::string& Name) const;
119 
120  void insertRecentProject(const std::string& Name, const std::string& Path);
121 
122  std::list<RecentProject> getRecentProjects() const;
123 
124  inline const static unsigned int RecentProjectsMax = 10;
125 
127 
129 
131 
132  std::vector<std::string> getOpenWaresPaths() const;
133 
134  void setOpenWaresPaths(const std::vector<std::string>& Paths);
135 
136  std::string getActiveWarePath() const;
137 
138  void setActiveWarePath(const std::string& Path);
139 
140  std::string getWaresConfigureMode() const;
141 
142  void setWaresConfigureMode(const std::string& Mode);
143 
144  std::string getWaresBuildMode() const;
145 
146  void setWaresBuildMode(const std::string& Mode);
147 
149 
150  void setWaresParallelJobsEnabled(bool Enabled);
151 
153 
155 };
156 
157 
158 } } //namespaces
159 
160 
161 #endif /* __OPENFLUID_BASE_WORKSPACEMANAGER_HPP__ */
#define OPENFLUID_SINGLETON_DEFINITION(T)
Definition: SingletonMacros.hpp:55
Definition: WorkspaceManager.hpp:55
bool isOpen() const
Definition: WorkspaceManager.hpp:94
static std::string getWaresPath(const std::string &WorkspacePath, openfluid::ware::WareType Type=openfluid::ware::WareType::UNDEFINED)
std::string getProjectPath(const std::string &Name) const
std::vector< std::string > getOpenWaresPaths() const
static std::string getSettingsFile(const std::string &WorkspacePath)
void setWaresParallelJobsCount(int Jobs)
std::string getActiveWarePath() const
void setWaresConfigureMode(const std::string &Mode)
std::string getWaresBuildMode() const
std::string getProjectsPath() const
std::string getWaresPath(openfluid::ware::WareType Type=openfluid::ware::WareType::UNDEFINED) const
static std::string getProjectsPath(const std::string &WorkspacePath)
std::string getWorkspacePath() const
Definition: WorkspaceManager.hpp:99
std::string getSettingsFile() const
void insertRecentProject(const std::string &Name, const std::string &Path)
std::list< RecentProject > getRecentProjects() const
static void prepareWorkspace(const std::string &Path)
void setWaresParallelJobsEnabled(bool Enabled)
std::string getWarePath(openfluid::ware::WareType Type, const openfluid::ware::WareID_t &ID) const
std::string getWaresConfigureMode() const
static std::string getWarePath(const std::string &WorkspacePath, openfluid::ware::WareType Type, const openfluid::ware::WareID_t &ID)
void setOpenWaresPaths(const std::vector< std::string > &Paths)
void setActiveWarePath(const std::string &Path)
void setWaresBuildMode(const std::string &Mode)
void openWorkspace(const std::string &Path)
#define OPENFLUID_API
Definition: dllexport.hpp:86
FilesystemPath Path
Definition: FilesystemPath.hpp:308
WareType
Definition: TypeDefs.hpp:61
std::string WareID_t
Definition: TypeDefs.hpp:49
Definition: ApplicationException.hpp:47
Definition: WorkspaceManager.hpp:82
std::string Name
Definition: WorkspaceManager.hpp:83
std::string Path
Definition: WorkspaceManager.hpp:85