Documentation for OpenFLUID 2.2.0
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 /**
34  @file Variables.hpp
35 
36  @author Jean-Christophe Fabre <jean-christophe.fabre@inra.fr>
37 */
38 
39 
40 #ifndef __OPENFLUID_CORE_VARIABLES_HPP__
41 #define __OPENFLUID_CORE_VARIABLES_HPP__
42 
43 
44 #include <openfluid/dllexport.hpp>
45 #include <openfluid/core/TypeDefs.hpp>
47 
48 
49 namespace openfluid { namespace core {
50 
51 
53 {
54  private:
55 
56  typedef std::map<VariableName_t, std::pair<ValuesBuffer,Value::Type> > VariablesMap_t;
57 
58  VariablesMap_t m_Data;
59 
60 
61  public:
62 
63  bool createVariable(const VariableName_t& aName);
64 
65  bool createVariable(const VariableName_t& aName, const Value::Type& aType);
66 
67  bool modifyValue(const VariableName_t& aName, const TimeIndex_t& anIndex, const Value& aValue);
68 
69  bool modifyCurrentValue(const VariableName_t& aName, const Value& aValue);
70 
71  bool appendValue(const VariableName_t& aName, const TimeIndex_t& anIndex, const Value& aValue);
72 
73  bool getValue(const VariableName_t& aName, const TimeIndex_t& anIndex,Value* aValue) const;
74 
75  const Value* value(const VariableName_t& aName, const TimeIndex_t& anIndex) const;
76 
77  const Value* currentValue(const VariableName_t& aName) const;
78 
79  bool getCurrentValue(const VariableName_t& aName, Value* aValue) const;
80 
81  bool getLatestIndexedValue(const VariableName_t& aName, IndexedValue& IndValue) const;
82 
83  bool getLatestIndexedValues(const VariableName_t& aName, const TimeIndex_t& anIndex,
84  IndexedValueList& IndValueList) const;
85 
86  bool getIndexedValues(const VariableName_t& aName,
87  const TimeIndex_t& aBeginIndex, const TimeIndex_t& anEndIndex,
88  IndexedValueList& IndValueList) const;
89 
90  bool getCurrentValueIfIndex(const VariableName_t& aName, const TimeIndex_t& Index, Value* aValue) const;
91 
92  Value* currentValueIfIndex(const VariableName_t& aName, const TimeIndex_t& Index) const;
93 
94  bool isVariableExist(const VariableName_t& aName) const;
95 
96  bool isVariableExist(const VariableName_t& aName, const TimeIndex_t& anIndex) const;
97 
98  bool isVariableExist(const VariableName_t& aName, const TimeIndex_t& anIndex,
99  Value::Type ValueType) const;
100 
101  bool isTypedVariableExist(const VariableName_t& aName, const Value::Type& VarType) const;
102 
104  const TimeIndex_t& anIndex, const Value::Type& VarType) const;
105 
106  std::vector<VariableName_t> getVariablesNames() const;
107 
108  int getVariableValuesCount(const VariableName_t& aName) const;
109 
110  bool checkAllVariablesCount(unsigned int Count, VariableName_t& ErrorVarName) const;
111 
112  void clear();
113 
114  void displayContent(const VariableName_t& aName, std::ostream& OStream) const;
115 
116 };
117 
118 
119 } } // namespaces
120 
121 
122 #endif /* __OPENFLUID_CORE_VARIABLES_HPP__ */
Definition: IndexedValue.hpp:64
Definition: Value.hpp:63
Type
Definition: Value.hpp:66
Definition: Variables.hpp:53
bool getCurrentValueIfIndex(const VariableName_t &aName, const TimeIndex_t &Index, Value *aValue) const
Value * currentValueIfIndex(const VariableName_t &aName, const TimeIndex_t &Index) const
const Value * value(const VariableName_t &aName, const TimeIndex_t &anIndex) const
bool isVariableExist(const VariableName_t &aName) const
bool getValue(const VariableName_t &aName, const TimeIndex_t &anIndex, Value *aValue) const
bool createVariable(const VariableName_t &aName)
const Value * currentValue(const VariableName_t &aName) const
bool isTypedVariableExist(const VariableName_t &aName, const TimeIndex_t &anIndex, const Value::Type &VarType) const
bool getLatestIndexedValues(const VariableName_t &aName, const TimeIndex_t &anIndex, IndexedValueList &IndValueList) const
bool modifyValue(const VariableName_t &aName, const TimeIndex_t &anIndex, const Value &aValue)
bool checkAllVariablesCount(unsigned int Count, VariableName_t &ErrorVarName) const
bool createVariable(const VariableName_t &aName, const Value::Type &aType)
std::vector< VariableName_t > getVariablesNames() const
bool getLatestIndexedValue(const VariableName_t &aName, IndexedValue &IndValue) const
bool getIndexedValues(const VariableName_t &aName, const TimeIndex_t &aBeginIndex, const TimeIndex_t &anEndIndex, IndexedValueList &IndValueList) const
void displayContent(const VariableName_t &aName, std::ostream &OStream) const
int getVariableValuesCount(const VariableName_t &aName) const
bool appendValue(const VariableName_t &aName, const TimeIndex_t &anIndex, const Value &aValue)
bool isVariableExist(const VariableName_t &aName, const TimeIndex_t &anIndex, Value::Type ValueType) const
bool getCurrentValue(const VariableName_t &aName, Value *aValue) const
bool isVariableExist(const VariableName_t &aName, const TimeIndex_t &anIndex) const
bool isTypedVariableExist(const VariableName_t &aName, const Value::Type &VarType) const
bool modifyCurrentValue(const VariableName_t &aName, const Value &aValue)
#define OPENFLUID_API
Definition: dllexport.hpp:86
std::uint64_t TimeIndex_t
Definition: TypeDefs.hpp:298
std::string VariableName_t
Definition: TypeDefs.hpp:131
std::list< IndexedValue > IndexedValueList
Definition: IndexedValue.hpp:182
Definition: ApplicationException.hpp:47