Manual for OpenFLUID 2.1.10

DatastoreItem.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 DatastoreItem.hpp
35 
36  @author Aline LIBRES <libres@supagro.inra.fr>
37 */
38 
39 
40 #ifndef __OPENFLUID_CORE_DATASTOREITEM_HPP__
41 #define __OPENFLUID_CORE_DATASTOREITEM_HPP__
42 
43 
44 #include <string>
45 
46 #include <openfluid/dllexport.hpp>
48 
49 
50 namespace openfluid { namespace core {
51 
52 
53 /**
54  Item of a Datastore, giving information about an additional resource.
55 */
57 {
58  private:
59 
60  std::string m_ID;
61 
62  std::string m_PrefixPath;
63 
64  std::string m_RelativePath;
65 
66  std::string m_UnitsClass;
67 
68  UnstructuredValue* m_Value;
69 
70 
71  public:
72 
73  /**
74  @brief Creates a new resource item.
75 
76  Tries to create a new resource item and its associated UnstructuredValue,
77  depending on the given type.
78 
79  @param ID The ID of the item.
80  @param PrefixPath The prefix path of the item, usually the IN directory of the project.
81  @param RelativePath The relative path of the item from the PrefixPath
82  @param Type The type of the item.
83  @param UnitsClass (optional) The associated unit class of the item.
84  @throw openfluid::base::FrameworkException if the given type is unknown.
85  */
86  DatastoreItem(const std::string& ID,
87  const std::string& PrefixPath, const std::string& RelativePath,
88  UnstructuredValue::UnstructuredType Type, const std::string& UnitsClass = "");
89 
90  /**
91  @brief Destroys the resource and its associated value.
92  */
93  ~DatastoreItem();
94 
95  std::string getID() const;
96 
97  /**
98  @brief Returns the prefix path of the resource
99  */
100  std::string getPrefixPath() const;
101 
102  /**
103  @brief Returns the path of the resource, relative to prefix path.
104  */
105  std::string getRelativePath() const;
106 
107  std::string getUnitsClass() const;
108 
109  /**
110  @deprecated Since version 2.1.0. Use openfluid::core::DatastoreItem::getUnitsClass() instead
111  */
112  [[deprecated]] std::string getUnitClass() const
113  {
114  return getUnitsClass();
115  }
116 
117  /**
118  @brief Gets the associated value of the resource.
119  */
120  UnstructuredValue* value();
121 
122  /**
123  @brief Gets the associated value of the resource.
124  */
125  const UnstructuredValue* value() const;
126 };
127 
128 
129 } } // namespaces
130 
131 
132 #endif /* __OPENFLUID_CORE_DATASTOREITEM_HPP__ */
Definition: ApplicationException.hpp:47
Definition: DatastoreItem.hpp:56
Definition: UnstructuredValue.hpp:53
std::string getUnitClass() const
Definition: DatastoreItem.hpp:112
#define OPENFLUID_API
Definition: dllexport.hpp:86
UnstructuredType
Definition: UnstructuredValue.hpp:57