Documentation for OpenFLUID 2.2.1
ExamplesManager.hpp
Go to the documentation of this file.
1 /*
2 
3  This file is part of OpenFLUID software
4  Copyright(c) 2021-2026, INRAE
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 /**
34  @file ExamplesManager.hpp
35 
36  @author Jean-Christophe FABRE <jean-christophe.fabre@inrae.fr>
37  @author Dorian GERARDIN <dorian.gerardin@inrae.fr>
38  */
39 
40 
41 #ifndef __OPENFLUID_BASE_EXAMPLESMANAGER_HPP__
42 #define __OPENFLUID_BASE_EXAMPLESMANAGER_HPP__
43 
44 
45 #include <string>
46 
47 #include <openfluid/dllexport.hpp>
48 
49 
50 namespace openfluid { namespace base {
51 
52 
54 {
55 
56  private:
57 
58  static void printSuccessStatus(const bool& Ok);
59 
60  static std::string buildRessourcesPath(const std::string& Path);
61 
62  static std::string buildInstallPath(const std::string& Path);
63 
64  static bool installDirectory(const std::string& FromPath, const std::string& ToPath,
65  const std::string& DirName, const bool Force = false);
66 
67  public:
68 
69  ExamplesManager() = delete;
70 
71  ~ExamplesManager() = delete;
72 
73  /**
74  Installs a single example project, using its directory name
75  @param[in] ProjectDir Name of the project directory to install
76  @param[in] ResourcesPath Path to the examples ressources,
77  uses standard ressources path if empty (default is empty)
78  @param[in] InstallPath Path where to install the examples ressources,
79  uses user openfluid path if empty (default is empty)
80  @param[in] Force If true, the installation is forced even if it already exists (default is false)
81  */
82  static bool installProject(const std::string& ProjectDir,
83  const std::string& ResourcesPath = "", const std::string& InstallPath = "",
84  const bool Force = false);
85 
86  /**
87  Installs a single example simulator, using its directory name
88  @param[in] SimulatorDir Name of the simulator directory to install
89  @param[in] ResourcesPath Path to the examples ressources,
90  uses standard ressources path if empty (default is empty)
91  @param[in] InstallPath Path where to install the examples ressources,
92  uses user openfluid path if empty (default is empty)
93  @param[in] Force If true, the installation is forced even if it already exists (default is false)
94  */
95  static bool installSimulator(const std::string& SimulatorDir,
96  const std::string& ResourcesPath = "", const std::string& InstallPath = "",
97  const bool Force = false);
98 
99  static bool installObserver(const std::string& ObserverDir,
100  const std::string& ResourcesPath = "", const std::string& InstallPath = "",
101  const bool Force = false);
102 
103  /**
104  Installs all example projects
105  @param[in] ResourcesPath Path to the examples ressources,
106  uses standard ressources path if empty (default is empty)
107  @param[in] InstallPath Path where to install the examples ressources,
108  uses user openfluid path if empty (default is empty)
109  @param[in] Force If true, the installation is forced even if it already exists (default is false)
110  */
111  static bool installAllProjects(const std::string& ResourcesPath = "", const std::string& InstallPath = "",
112  const bool Force = false);
113 
114  /**
115  Installs all example simulators
116  @param[in] ResourcesPath Path to the examples ressources,
117  uses standard ressources path if empty (default is empty)
118  @param[in] InstallPath Path where to install the examples ressources,
119  uses user openfluid path if empty (default is empty)
120  @param[in] Force If true, the installation is forced even if it already exists (default is false)
121  */
122  static bool installAllSimulators(const std::string& ResourcesPath = "", const std::string& InstallPath = "",
123  const bool Force = false);
124 
125  /**
126  Installs all example observers
127  @param[in] ResourcesPath Path to the examples ressources,
128  uses standard ressources path if empty (default is empty)
129  @param[in] InstallPath Path where to install the examples ressources,
130  uses user openfluid path if empty (default is empty)
131  @param[in] Force If true, the installation is forced even if it already exists (default is false)
132  */
133  static bool installAllObservers(const std::string& ResourcesPath = "", const std::string& InstallPath = "",
134  const bool Force = false);
135 
136  /**
137  Installs all example wares (simulators and observers)
138  @param[in] ResourcesPath Path to the examples ressources,
139  uses standard ressources path if empty (default is empty)
140  @param[in] InstallPath Path where to install the examples ressources,
141  uses user openfluid path if empty (default is empty)
142  @param[in] Force If true, the installation is forced even if it already exists (default is false)
143  */
144  static bool installAllWares(const std::string& ResourcesPath = "", const std::string& InstallPath = "",
145  const bool Force = false);
146 
147  /**
148  Installs all example projects and simulators
149  @param[in] ResourcesPath Path to the examples ressources,
150  uses standard ressources path if empty (default is empty)
151  @param[in] InstallPath Path where to install the examples ressources,
152  uses user openfluid path if empty (default is empty)
153  @param[in] Force If true, the installation is forced even if it already exists (default is false)
154  */
155  static bool installAll(const std::string& ResourcesPath = "", const std::string& InstallPath = "",
156  const bool Force = false);
157 };
158 
159 
160 } } // namespaces
161 
162 
163 #endif /* __OPENFLUID_BASE_EXAMPLESMANAGER_HPP__ */
Definition: ExamplesManager.hpp:54
static bool installAllSimulators(const std::string &ResourcesPath="", const std::string &InstallPath="", const bool Force=false)
static bool installSimulator(const std::string &SimulatorDir, const std::string &ResourcesPath="", const std::string &InstallPath="", const bool Force=false)
static bool installAllWares(const std::string &ResourcesPath="", const std::string &InstallPath="", const bool Force=false)
static bool installProject(const std::string &ProjectDir, const std::string &ResourcesPath="", const std::string &InstallPath="", const bool Force=false)
static bool installAllProjects(const std::string &ResourcesPath="", const std::string &InstallPath="", const bool Force=false)
static bool installObserver(const std::string &ObserverDir, const std::string &ResourcesPath="", const std::string &InstallPath="", const bool Force=false)
static bool installAll(const std::string &ResourcesPath="", const std::string &InstallPath="", const bool Force=false)
static bool installAllObservers(const std::string &ResourcesPath="", const std::string &InstallPath="", const bool Force=false)
#define OPENFLUID_API
Definition: dllexport.hpp:86
FilesystemPath Path
Definition: FilesystemPath.hpp:308
Definition: ApplicationException.hpp:47