All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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  */
39 
40 
41 #ifndef __OPENFLUID_WARESDEV_WARESRCMANAGER_HPP__
42 #define __OPENFLUID_WARESDEV_WARESRCMANAGER_HPP__
43 
44 #include <openfluid/dllexport.hpp>
46 
47 #include <QString>
48 #include <QMap>
49 
50 
51 namespace openfluid { namespace waresdev {
52 
54 {
55  public:
56 
57  enum WareType
58  {
59  SIMULATOR = 1, OBSERVER = 2, BUILDEREXT = 3
60  };
61 
62  struct PathInfo
63  {
64  QString m_AbsolutePath;
67  QString m_WareName;
68  bool m_isAWare;
72  QString m_FileName;
73 
74 
76  m_AbsolutePath(""), m_IsInCurrentWorkspace(false), m_WareType(WareType(0)), m_WareName(""),
77  m_isAWare(false), m_isAWareFile(false), m_RelativePathToWareDir(""), m_AbsolutePathOfWare(""),
78  m_FileName("")
79  {
80  }
81  };
82 
83 
84  private:
85 
86  static WareSrcManager* mp_Instance;
87 
88  QString m_WaresdevDirName;
89 
90  QString m_WorkspacePath;
91 
92  QString m_WaresdevPath;
93 
94  /**
95  * Absolute paths of each ware type sub-directory in the current workspace
96  */
97  QMap<WareType, QString> m_WareTypePathByWareType;
98 
100 
101  ~WareSrcManager();
102 
103 
104  public:
105 
106  static WareSrcManager* instance();
107 
108  /**
109  * Set default internal paths (workspace and waresdev sub dirs) and create them if they don't exist.
110  * @param NewAbsoluteWorkspacePath
111  * @throws openfluid::base::FrameworkException if a path can not be created
112  */
113  void switchWorkspace(const QString& NewAbsoluteWorkspacePath);
114 
115  QString getWareTypePath(WareType WareSrcType);
116 
117  QString getWarePath(const QString& WareID, openfluid::ware::PluggableWare::WareType OFWareType, QString& ErrMsg);
118 
119  /**
120  * Make Path absolute then splits it to retrieve PathInfo attributes.
121  * @param Path
122  * @return A new PathInfo
123  */
124  PathInfo getPathInfo(const QString& Path);
125 
126  QString getWaresdevPath() const;
127 
128  QString getWorkspacePath() const;
129 };
130 
131 } } // namespaces
132 
133 
134 #endif /* __OPENFLUID_WARESDEV_WARESRCMANAGER_HPP__ */
QString m_RelativePathToWareDir
Definition: WareSrcManager.hpp:70
bool m_IsInCurrentWorkspace
Definition: WareSrcManager.hpp:65
Definition: WareSrcManager.hpp:53
WareType m_WareType
Definition: WareSrcManager.hpp:66
QString m_AbsolutePath
Definition: WareSrcManager.hpp:64
bool m_isAWareFile
Definition: WareSrcManager.hpp:69
QString m_FileName
Definition: WareSrcManager.hpp:72
QString m_WareName
Definition: WareSrcManager.hpp:67
QString m_AbsolutePathOfWare
Definition: WareSrcManager.hpp:71
WareType
Definition: WareSrcManager.hpp:57
PathInfo()
Definition: WareSrcManager.hpp:75
Definition: WareSrcManager.hpp:62
WareType
Definition: PluggableWare.hpp:101
bool m_isAWare
Definition: WareSrcManager.hpp:68
#define OPENFLUID_API
Definition: dllexport.hpp:87