core/Variables.hpp
Go to the documentation of this file.
00001 /*
00002 
00003   This file is part of OpenFLUID software
00004   Copyright(c) 2007, INRA - Montpellier SupAgro
00005 
00006 
00007  == GNU General Public License Usage ==
00008 
00009   OpenFLUID is free software: you can redistribute it and/or modify
00010   it under the terms of the GNU General Public License as published by
00011   the Free Software Foundation, either version 3 of the License, or
00012   (at your option) any later version.
00013 
00014   OpenFLUID is distributed in the hope that it will be useful,
00015   but WITHOUT ANY WARRANTY; without even the implied warranty of
00016   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017   GNU General Public License for more details.
00018 
00019   You should have received a copy of the GNU General Public License
00020   along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
00021 
00022 
00023  == Other Usage ==
00024 
00025   Other Usage means a use of OpenFLUID that is inconsistent with the GPL
00026   license, and requires a written agreement between You and INRA.
00027   Licensees for Other Usage of OpenFLUID may use this file in accordance
00028   with the terms contained in the written agreement between You and INRA.
00029 
00030 */
00031 
00032 
00033 #ifndef __VARIABLES_HPP__
00034 #define __VARIABLES_HPP__
00035 
00036 #include <openfluid/core/TypeDefs.hpp>
00037 #include <openfluid/core/ValuesBuffer.hpp>
00038 #include <openfluid/dllexport.hpp>
00039 
00040 namespace openfluid {
00041 namespace core {
00042 
00043 class DLLEXPORT Variables
00044 {
00045   private:
00046 
00047     typedef std::map<VariableName_t, std::pair<ValuesBuffer,Value::Type> > VariablesMap_t;
00048     VariablesMap_t m_Data;
00049 
00050   public:
00051 
00052     Variables();
00053 
00054     ~Variables();
00055 
00056     bool createVariable(const VariableName_t& aName);
00057 
00058     bool createVariable(const VariableName_t& aName, const Value::Type& aType);
00059 
00060     bool modifyValue(const VariableName_t& aName, const TimeIndex_t& anIndex,
00061         const Value& aValue);
00062 
00063     bool modifyCurrentValue(const VariableName_t& aName, const Value& aValue);
00064 
00065     bool appendValue(const VariableName_t& aName, const TimeIndex_t& anIndex, const Value& aValue);
00066 
00067     bool getValue(const VariableName_t& aName, const TimeIndex_t& anIndex,
00068         Value* aValue) const;
00069 
00070     Value* getValue(const VariableName_t& aName, const TimeIndex_t& anIndex) const;
00071 
00072     Value* getCurrentValue(const VariableName_t& aName) const;
00073 
00074     bool getCurrentValue(const VariableName_t& aName, Value* aValue) const;
00075 
00076     bool getLatestIndexedValue(const VariableName_t& aName, IndexedValue& IndValue) const;
00077 
00078     bool getLatestIndexedValues(const VariableName_t& aName, const TimeIndex_t& anIndex, IndexedValueList& IndValueList) const;
00079 
00080     bool getIndexedValues(const VariableName_t& aName,
00081                           const TimeIndex_t& aBeginIndex, const TimeIndex_t& anEndIndex,
00082                           IndexedValueList& IndValueList) const;
00083 
00084     bool getCurrentValueIfIndex(const VariableName_t& aName, const TimeIndex_t& Index, Value* aValue) const;
00085 
00086     Value* getCurrentValueIfIndex(const VariableName_t& aName, const TimeIndex_t& Index) const;
00087 
00088     bool isVariableExist(const VariableName_t& aName) const;
00089 
00090     bool isVariableExist(const VariableName_t& aName, const TimeIndex_t& anIndex) const;
00091 
00092     bool isVariableExist(const VariableName_t& aName, const TimeIndex_t& anIndex,
00093         Value::Type ValueType) const;
00094 
00095     bool isTypedVariableExist(const VariableName_t& aName, const Value::Type& VarType) const;
00096 
00097     bool isTypedVariableExist(const VariableName_t& aName, const TimeIndex_t& anIndex,
00098         const Value::Type& VarType) const;
00099 
00100     std::vector<VariableName_t> getVariablesNames() const;
00101 
00102     int getVariableValuesCount(const VariableName_t& aName) const;
00103 
00104     bool isAllVariablesCount(unsigned int Count) const;
00105 
00106     void clear();
00107 
00108     void displayContent(const VariableName_t& aName, std::ostream& OStream) const;
00109 
00110 };
00111 
00112 }  } // namespaces
00113 
00114 
00115 #endif /* __VARIABLES_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines