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 @file 00034 00035 @author Jean-Christophe FABRE <fabrejc@supagro.inra.fr> 00036 */ 00037 00038 #ifndef __WARESETDESCRIPTOR_HPP__ 00039 #define __WARESETDESCRIPTOR_HPP__ 00040 00041 #include <list> 00042 #include <openfluid/fluidx/ModelItemDescriptor.hpp> 00043 #include <openfluid/dllexport.hpp> 00044 00045 namespace openfluid { 00046 namespace fluidx { 00047 00048 template<class T> 00049 class DLLEXPORT WareSetDescriptor 00050 { 00051 public: 00052 typedef std::list<T*> SetDescription_t; 00053 00054 private: 00055 SetDescription_t m_SetDescription; 00056 00057 openfluid::ware::WareParams_t m_Params; 00058 00059 public: 00060 00061 WareSetDescriptor<T>() 00062 { 00063 } 00064 ; 00065 00066 inline SetDescription_t& getItems() 00067 { 00068 return (m_SetDescription); 00069 } 00070 ; 00071 00072 // ===================================================================== 00073 // ===================================================================== 00074 00075 inline const SetDescription_t& getItems() const 00076 { 00077 return (m_SetDescription); 00078 } 00079 ; 00080 00081 // ===================================================================== 00082 // ===================================================================== 00083 00084 void setGlobalParameter(const openfluid::ware::WareParamKey_t& Key, 00085 const openfluid::ware::WareParamValue_t& Value) 00086 { 00087 m_Params[Key] = Value; 00088 } 00089 00090 // ===================================================================== 00091 // ===================================================================== 00092 00093 void setGlobalParameters(const openfluid::ware::WareParams_t& Params) 00094 { 00095 openfluid::ware::WareParams_t::const_iterator it; 00096 00097 for (it=Params.begin();it!=Params.end();++it) 00098 m_Params[it->first] = it->second; 00099 } 00100 00101 // ===================================================================== 00102 // ===================================================================== 00103 00104 openfluid::ware::WareParams_t getGlobalParameters() 00105 { 00106 return m_Params; 00107 } 00108 00109 // ===================================================================== 00110 // ===================================================================== 00111 00112 void eraseGlobalParameter(const openfluid::ware::WareParamKey_t& Key) 00113 { 00114 m_Params.erase(Key); 00115 } 00116 00117 // ===================================================================== 00118 // ===================================================================== 00119 00120 void appendItem(T *Item) 00121 { 00122 m_SetDescription.push_back(Item); 00123 } 00124 00125 }; 00126 00127 } 00128 } // namespaces 00129 00130 #endif /* __MODELDESCRIPTOR_HPP__ */