Manual for OpenFLUID 2.1.11

WareSrcManager.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 /**
34  @file WareSrcManager.hpp
35  @brief Header of ...
36 
37  @author Aline LIBRES <aline.libres@gmail.com>
38  @author Jean-Christophe Fabre <jean-christophe.fabre@inra.fr>
39 */
40 
41 
42 #ifndef __OPENFLUID_WARESDEV_WARESRCMANAGER_HPP__
43 #define __OPENFLUID_WARESDEV_WARESRCMANAGER_HPP__
44 
45 
46 #include <QString>
47 #include <QMap>
48 
49 #include <openfluid/dllexport.hpp>
52 
53 
54 namespace openfluid { namespace waresdev {
55 
56 
58 {
59 
61 
62 
63  public:
64 
65  struct PathInfo
66  {
67  QString m_AbsolutePath;
68 
70 
72 
74 
75  QString m_WareName;
76 
77  bool m_isAWare;
78 
80 
82 
84 
85  QString m_FileName;
86 
88  m_AbsolutePath(""), m_IsInCurrentWorkspace(false), m_IsInExamples(false),
89  m_WareType(openfluid::ware::WareType::UNDEFINED), m_WareName(""),
90  m_isAWare(false), m_isAWareFile(false), m_RelativePathToWareDir(""), m_AbsolutePathOfWare(""),
91  m_FileName("")
92  { }
93  };
94 
95 
96  private:
97 
98  QString m_WaresdevDirName;
99 
100  QString m_WorkspacePath;
101 
102  QString m_WaresdevPath;
103 
104  /**
105  * Absolute paths of each ware type sub-directory in the current workspace
106  */
107  QMap<openfluid::ware::WareType, QString> m_WareTypePathByWareType;
108 
109  WareSrcManager();
110 
111  ~WareSrcManager();
112 
113 
114  public:
115 
116  /**
117  Set default internal paths (workspace and waresdev sub dirs) and create them if they don't exist.
118  @param NewAbsoluteWorkspacePath
119  @throws openfluid::base::FrameworkException if a path can not be created
120  */
121  void switchWorkspace(const QString& NewAbsoluteWorkspacePath);
122 
123  QString getWareTypePath(openfluid::ware::WareType WareSrcType);
124 
125  QString getWarePath(const QString& WareID, openfluid::ware::WareType OFWareType, QString& ErrMsg);
126 
127  /**
128  Make Path absolute then splits it to retrieve PathInfo attributes.
129  @param Path
130  @return A new PathInfo
131  */
132  PathInfo getPathInfo(const QString& Path);
133 
134  QString getWaresdevPath() const;
135 
136  QString getWorkspacePath() const;
137 
138 };
139 
140 
141 } } // namespaces
142 
143 
144 #endif /* __OPENFLUID_WARESDEV_WARESRCMANAGER_HPP__ */
OPENFLUID_API
#define OPENFLUID_API
Definition: dllexport.hpp:86
openfluid::waresdev::WareSrcManager::PathInfo
Definition: WareSrcManager.hpp:65
openfluid::waresdev::WareSrcManager::PathInfo::m_isAWareFile
bool m_isAWareFile
Definition: WareSrcManager.hpp:79
OPENFLUID_SINGLETON_DEFINITION
#define OPENFLUID_SINGLETON_DEFINITION(T)
Definition: SingletonMacros.hpp:55
openfluid::waresdev::WareSrcManager::PathInfo::m_RelativePathToWareDir
QString m_RelativePathToWareDir
Definition: WareSrcManager.hpp:81
openfluid::ware::WareType
WareType
Definition: TypeDefs.hpp:60
openfluid::waresdev::WareSrcManager::PathInfo::m_IsInCurrentWorkspace
bool m_IsInCurrentWorkspace
Definition: WareSrcManager.hpp:69
openfluid::waresdev::WareSrcManager::PathInfo::m_AbsolutePathOfWare
QString m_AbsolutePathOfWare
Definition: WareSrcManager.hpp:83
openfluid::waresdev::WareSrcManager::PathInfo::m_IsInExamples
bool m_IsInExamples
Definition: WareSrcManager.hpp:71
openfluid::waresdev::WareSrcManager::PathInfo::m_WareName
QString m_WareName
Definition: WareSrcManager.hpp:75
openfluid
Definition: ApplicationException.hpp:47
openfluid::waresdev::WareSrcManager::PathInfo::PathInfo
PathInfo()
Definition: WareSrcManager.hpp:87
SingletonMacros.hpp
openfluid::waresdev::WareSrcManager::PathInfo::m_WareType
openfluid::ware::WareType m_WareType
Definition: WareSrcManager.hpp:73
PluggableWare.hpp
openfluid::waresdev::WareSrcManager::PathInfo::m_AbsolutePath
QString m_AbsolutePath
Definition: WareSrcManager.hpp:67
openfluid::waresdev::WareSrcManager
Definition: WareSrcManager.hpp:57
dllexport.hpp
openfluid::waresdev::WareSrcManager::PathInfo::m_isAWare
bool m_isAWare
Definition: WareSrcManager.hpp:77
openfluid::waresdev::WareSrcManager::PathInfo::m_FileName
QString m_FileName
Definition: WareSrcManager.hpp:85