All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Variables.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 #ifndef __VARIABLES_HPP__
34 #define __VARIABLES_HPP__
35 
38 #include <openfluid/dllexport.hpp>
39 
40 namespace openfluid {
41 namespace core {
42 
44 {
45  private:
46 
47  typedef std::map<VariableName_t, std::pair<ValuesBuffer,Value::Type> > VariablesMap_t;
48  VariablesMap_t m_Data;
49 
50  public:
51 
52  Variables();
53 
54  ~Variables();
55 
56  bool createVariable(const VariableName_t& aName);
57 
58  bool createVariable(const VariableName_t& aName, const Value::Type& aType);
59 
60  bool modifyValue(const VariableName_t& aName, const TimeIndex_t& anIndex,
61  const Value& aValue);
62 
63  bool modifyCurrentValue(const VariableName_t& aName, const Value& aValue);
64 
65  bool appendValue(const VariableName_t& aName, const TimeIndex_t& anIndex, const Value& aValue);
66 
67  bool getValue(const VariableName_t& aName, const TimeIndex_t& anIndex,
68  Value* aValue) const;
69 
70  Value* getValue(const VariableName_t& aName, const TimeIndex_t& anIndex) const;
71 
72  Value* getCurrentValue(const VariableName_t& aName) const;
73 
74  bool getCurrentValue(const VariableName_t& aName, Value* aValue) const;
75 
76  bool getLatestIndexedValue(const VariableName_t& aName, IndexedValue& IndValue) const;
77 
78  bool getLatestIndexedValues(const VariableName_t& aName, const TimeIndex_t& anIndex, IndexedValueList& IndValueList) const;
79 
80  bool getIndexedValues(const VariableName_t& aName,
81  const TimeIndex_t& aBeginIndex, const TimeIndex_t& anEndIndex,
82  IndexedValueList& IndValueList) const;
83 
84  bool getCurrentValueIfIndex(const VariableName_t& aName, const TimeIndex_t& Index, Value* aValue) const;
85 
86  Value* getCurrentValueIfIndex(const VariableName_t& aName, const TimeIndex_t& Index) const;
87 
88  bool isVariableExist(const VariableName_t& aName) const;
89 
90  bool isVariableExist(const VariableName_t& aName, const TimeIndex_t& anIndex) const;
91 
92  bool isVariableExist(const VariableName_t& aName, const TimeIndex_t& anIndex,
93  Value::Type ValueType) const;
94 
95  bool isTypedVariableExist(const VariableName_t& aName, const Value::Type& VarType) const;
96 
97  bool isTypedVariableExist(const VariableName_t& aName, const TimeIndex_t& anIndex,
98  const Value::Type& VarType) const;
99 
100  std::vector<VariableName_t> getVariablesNames() const;
101 
102  int getVariableValuesCount(const VariableName_t& aName) const;
103 
104  bool isAllVariablesCount(unsigned int Count) const;
105 
106  void clear();
107 
108  void displayContent(const VariableName_t& aName, std::ostream& OStream) const;
109 
110 };
111 
112 } } // namespaces
113 
114 
115 #endif /* __VARIABLES_H_ */
unsigned long long TimeIndex_t
Definition: DateTime.hpp:62
std::list< IndexedValue > IndexedValueList
Definition: ValuesBuffer.hpp:118
Definition: Variables.hpp:43
Type
Definition: Value.hpp:68
Definition: Value.hpp:64
std::string VariableName_t
Definition: TypeDefs.hpp:79
Definition: ValuesBuffer.hpp:57
#define DLLEXPORT
Definition: dllexport.hpp:51