Documentation for OpenFLUID 2.2.0
WareSrcEnquirer.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 WareSrcEnquirer.hpp
35 
36  @author Jean-Christophe Fabre <jean-christophe.fabre@inrae.fr>
37 */
38 
39 
40 #ifndef __OPENFLUID_WARESDEV_WARESRCENQUIRER_HPP__
41 #define __OPENFLUID_WARESDEV_WARESRCENQUIRER_HPP__
42 
43 
44 #include <openfluid/ware/TypeDefs.hpp>
45 #include <openfluid/dllexport.hpp>
46 
47 
48 namespace openfluid { namespace waresdev {
49 
50 
52 {
53 
54  public:
55 
56  struct WarePathInfo
57  {
58  std::string AbsolutePath;
59 
60  std::string AbsoluteWarePath;
61 
62  std::string FileName;
63 
64  std::string RelativePathToWare;
65 
66  bool IsInCurrentWorkspace = false;
67 
68  bool IsInExamples = false;
69 
71 
72  std::string WareDirName;
73 
74  bool IsWareDirectory = false;
75 
76  bool IsWareFile = false;
77 
78  bool isValid()
79  {
80  return (IsWareDirectory || IsWareFile) &&
81  (IsInCurrentWorkspace || IsInExamples) &&
83  }
84  };
85 
86 
87  public:
88 
89  /**
90  Try to detect full ware sources path using its type and its supposed directory name.
91  It searches first in the current workspace then in the user examples
92  @param[in] WareType the type of the ware to find
93  @param[in] WareDirName the expected directory name for the ware
94  @return the full path of the found ware sources, empty if not found
95  */
96  static std::string findWarePath(openfluid::ware::WareType WareType, const std::string& WareDirName);
97 
98  /**
99  Returns information about the wares sources located at the given path.
100  @param[in] Path the path to the ware to inspect
101  @return the information about the ware
102  */
103  static WarePathInfo getWareInfoFromPath(const std::string& Path);
104 
105 };
106 
107 
108 } } // namespaces
109 
110 
111 #endif /* __OPENFLUID_WARESDEV_WARESRCENQUIRER_HPP__ */
Definition: WareSrcEnquirer.hpp:52
static WarePathInfo getWareInfoFromPath(const std::string &Path)
static std::string findWarePath(openfluid::ware::WareType WareType, const std::string &WareDirName)
#define OPENFLUID_API
Definition: dllexport.hpp:86
FilesystemPath Path
Definition: FilesystemPath.hpp:308
WareType
Definition: TypeDefs.hpp:61
Definition: ApplicationException.hpp:47
Definition: WareSrcEnquirer.hpp:57
std::string WareDirName
Definition: WareSrcEnquirer.hpp:72
std::string FileName
Definition: WareSrcEnquirer.hpp:62
std::string AbsolutePath
Definition: WareSrcEnquirer.hpp:58
bool isValid()
Definition: WareSrcEnquirer.hpp:78
std::string AbsoluteWarePath
Definition: WareSrcEnquirer.hpp:60
std::string RelativePathToWare
Definition: WareSrcEnquirer.hpp:64