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