Documentation for OpenFLUID 2.2.2
Loading...
Searching...
No Matches
DatastoreItem.hpp
Go to the documentation of this file.
1/*
2
3 This file is part of OpenFLUID software
4 Copyright(c) 2021-2026, INRAE
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#include <memory>
46
49
50
51namespace openfluid { namespace core {
52
53
54/**
55 Item of a Datastore, giving information about an additional resource.
56*/
58{
59 private:
60
61 std::string m_ID;
62
63 std::string m_PrefixPath;
64
65 std::string m_RelativePath;
66
67 std::string m_UnitsClass;
68
69 std::shared_ptr<UnstructuredValue> m_Value;
70
71
72 public:
73
74 /**
75 @brief Creates a new resource item.
76
77 Tries to create a new resource item and its associated UnstructuredValue,
78 depending on the given type.
79
80 @param ID The ID of the item.
81 @param PrefixPath The prefix path of the item, usually the IN directory of the project.
82 @param RelativePath The relative path of the item from the PrefixPath
83 @param Type The type of the item.
84 @param UnitsClass (optional) The associated unit class of the item.
85 @throw openfluid::base::FrameworkException if the given type is unknown.
86 */
87 DatastoreItem(const std::string& ID,
88 const std::string& PrefixPath, const std::string& RelativePath,
89 UnstructuredValue::UnstructuredType Type, const std::string& UnitsClass = "");
90
91 std::string getID() const;
92
93 /**
94 @brief Returns the prefix path of the resource
95 */
96 std::string getPrefixPath() const;
97
98 /**
99 @brief Returns the path of the resource, relative to prefix path.
100 */
101 std::string getRelativePath() const;
102
103 std::string getUnitsClass() const;
104
105 /**
106 @deprecated Since version 2.1.0. Use openfluid::core::DatastoreItem::getUnitsClass() instead
107 */
108 [[deprecated]] std::string getUnitClass() const
109 {
110 return getUnitsClass();
111 }
112
113 /**
114 @brief Gets the associated value of the resource.
115 */
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__ */
Definition DatastoreItem.hpp:58
std::string getPrefixPath() const
Returns the prefix path of the resource.
std::string getUnitsClass() const
std::string getUnitClass() const
Definition DatastoreItem.hpp:108
const UnstructuredValue * value() const
Gets the associated value of the resource.
DatastoreItem(const std::string &ID, const std::string &PrefixPath, const std::string &RelativePath, UnstructuredValue::UnstructuredType Type, const std::string &UnitsClass="")
Creates a new resource item.
UnstructuredValue * value()
Gets the associated value of the resource.
std::string getID() const
std::string getRelativePath() const
Returns the path of the resource, relative to prefix path.
Definition UnstructuredValue.hpp:54
UnstructuredType
Definition UnstructuredValue.hpp:58
#define OPENFLUID_API
Definition dllexport.hpp:86
Definition ApplicationException.hpp:47