ware/SimulationContributorWare.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 /**
00034   \file SimulationContributorWare.hpp
00035   \brief Header of ...
00036 
00037   \author Jean-Christophe FABRE <fabrejc@supagro.inra.fr>
00038  */
00039 
00040 
00041 #ifndef __SIMULATIONCONTRIBUTORWARE_HPP__
00042 #define __SIMULATIONCONTRIBUTORWARE_HPP__
00043 
00044 #include <openfluid/dllexport.hpp>
00045 #include <openfluid/ware/SimulationInspectorWare.hpp>
00046 
00047 
00048 namespace openfluid { namespace ware {
00049 
00050 
00051 class DLLEXPORT SimulationContributorWare : public SimulationInspectorWare
00052 {
00053   private:
00054 
00055   protected:
00056 
00057     /**
00058        Sets attribute for a unit
00059        @param[in] UnitPtr a Unit
00060        @param[in] AttrName the name of the set attribute
00061        @param[in] Val the value of the set attribute
00062      */
00063      void OPENFLUID_SetAttribute(openfluid::core::Unit *UnitPtr,
00064                                  const openfluid::core::AttributeName_t& AttrName,
00065                                  const openfluid::core::Value& Val);
00066 
00067      /**
00068        Sets attribute for a unit, as a double
00069        @param[in] UnitPtr a Unit
00070        @param[in] AttrName the name of the set attribute
00071        @param[in] Val the value of the set attribute
00072      */
00073      void OPENFLUID_SetAttribute(openfluid::core::Unit *UnitPtr,
00074                                  const openfluid::core::AttributeName_t& AttrName,
00075                                  const double& Val);
00076 
00077      /**
00078        Sets attribute for a unit, as a long integer
00079        @param[in] UnitPtr a Unit
00080        @param[in] AttrName the name of the set attribute
00081        @param[in] Val the value of the set attribute
00082      */
00083      void OPENFLUID_SetAttribute(openfluid::core::Unit *UnitPtr,
00084                                  const openfluid::core::AttributeName_t& AttrName,
00085                                  const long& Val);
00086 
00087      /**
00088        Sets attribute for a unit, as a string
00089        @param[in] UnitPtr a Unit
00090        @param[in] AttrName the name of the set attribute
00091        @param[out] Val the value of the set attribute
00092      */
00093      void OPENFLUID_SetAttribute(openfluid::core::Unit *UnitPtr,
00094                                  const openfluid::core::AttributeName_t& AttrName,
00095                                  const std::string& Val);
00096 
00097 
00098      /**
00099        Initializes a distributed variable value for a unit
00100        @param[in] UnitPtr a Unit
00101        @param[in] VarName the name of the variable
00102        @param[in] Val the added value of the variable
00103        @deprecated
00104      */
00105      void OPENFLUID_InitializeVariable(openfluid::core::Unit *UnitPtr,
00106                                    const openfluid::core::VariableName_t& VarName,
00107                                    const openfluid::core::Value& Val);
00108 
00109      /**
00110        Initializes a distributed variable value for a unit
00111        @param[in] aUnit a Unit
00112        @param[in] VarName the name of the variable
00113        @param[in] Val the added value of the variable
00114      */
00115      void OPENFLUID_InitializeVariable(openfluid::core::Unit& aUnit,
00116                                        const openfluid::core::VariableName_t& VarName,
00117                                        const openfluid::core::Value& Val);
00118 
00119      /**
00120        Initializes a distributed double variable value for a unit
00121        @param[in] UnitPtr a Unit
00122        @param[in] VarName the name of the variable
00123        @param[in] Val the added value of the variable (double)
00124      */
00125      void OPENFLUID_InitializeVariable(openfluid::core::Unit *UnitPtr,
00126                                    const openfluid::core::VariableName_t& VarName,
00127                                    const double& Val);
00128 
00129      /**
00130        Initializes a distributed long variable value for a unit
00131        @param[in] UnitPtr a Unit
00132        @param[in] VarName the name of the variable
00133        @param[in] Val the added value of the variable (long)
00134      */
00135      void OPENFLUID_InitializeVariable(openfluid::core::Unit *UnitPtr,
00136                                    const openfluid::core::VariableName_t& VarName,
00137                                    const long& Val);
00138 
00139      /**
00140        Initializes a distributed boolean variable value for a unit
00141        @param[in] UnitPtr a Unit
00142        @param[in] VarName the name of the variable
00143        @param[in] Val the added value of the variable (bool)
00144      */
00145      void OPENFLUID_InitializeVariable(openfluid::core::Unit *UnitPtr,
00146                                    const openfluid::core::VariableName_t& VarName,
00147                                    const bool& Val);
00148 
00149      /**
00150        Initializes a distributed string variable value for a unit
00151        @param[in] UnitPtr a Unit
00152        @param[in] VarName the name of the variable
00153        @param[in] Val the added value of the variable (string)
00154      */
00155      void OPENFLUID_InitializeVariable(openfluid::core::Unit *UnitPtr,
00156                                    const openfluid::core::VariableName_t& VarName,
00157                                    const std::string& Val);
00158 
00159     /**
00160       Appends a distributed variable value for a unit at the end of the previously added values for this variable
00161       @param[in] UnitPtr a Unit
00162       @param[in] VarName the name of the variable
00163       @param[in] Val the added value of the variable
00164       @deprecated
00165     */
00166     void OPENFLUID_AppendVariable(openfluid::core::Unit *UnitPtr,
00167                                   const openfluid::core::VariableName_t& VarName,
00168                                   const openfluid::core::Value& Val);
00169 
00170     /**
00171       Appends a distributed variable value for a unit at the end of the previously added values for this variable
00172       @param[in] aUnit a Unit
00173       @param[in] VarName the name of the variable
00174       @param[in] Val the added value of the variable
00175     */
00176     void OPENFLUID_AppendVariable(openfluid::core::Unit& aUnit,
00177                                   const openfluid::core::VariableName_t& VarName,
00178                                   const openfluid::core::Value& Val);
00179 
00180     /**
00181       Appends a distributed double variable value for a unit at the end of the previously added values for this variable
00182       @param[in] UnitPtr a Unit
00183       @param[in] VarName the name of the variable
00184       @param[in] Val the added value of the variable (double)
00185     */
00186     void OPENFLUID_AppendVariable(openfluid::core::Unit *UnitPtr,
00187                                   const openfluid::core::VariableName_t& VarName,
00188                                   const double& Val);
00189 
00190     /**
00191       Appends a distributed long variable value for a unit at the end of the previously added values for this variable
00192       @param[in] UnitPtr a Unit
00193       @param[in] VarName the name of the variable
00194       @param[in] Val the added value of the variable (long)
00195     */
00196     void OPENFLUID_AppendVariable(openfluid::core::Unit *UnitPtr,
00197                                   const openfluid::core::VariableName_t& VarName,
00198                                   const long& Val);
00199 
00200     /**
00201       Appends a distributed boolean variable value for a unit at the end of the previously added values for this variable
00202       @param[in] UnitPtr a Unit
00203       @param[in] VarName the name of the variable
00204       @param[in] Val the added value of the variable (bool)
00205     */
00206     void OPENFLUID_AppendVariable(openfluid::core::Unit *UnitPtr,
00207                                   const openfluid::core::VariableName_t& VarName,
00208                                   const bool& Val);
00209 
00210     /**
00211       Appends a distributed string variable value for a unit at the end of the previously added values for this variable
00212       @param[in] UnitPtr a Unit
00213       @param[in] VarName the name of the variable
00214       @param[in] Val the added value of the variable (string)
00215     */
00216     void OPENFLUID_AppendVariable(openfluid::core::Unit *UnitPtr,
00217                                   const openfluid::core::VariableName_t& VarName,
00218                                   const std::string& Val);
00219 
00220 
00221     /**
00222       Sets a distributed variable value for a unit at the current time index
00223       @param[in] UnitPtr a Unit
00224       @param[in] VarName the name of the variable
00225       @param[in] Val the added value of the variable
00226     */
00227     void OPENFLUID_SetVariable(openfluid::core::Unit *UnitPtr,
00228                                const openfluid::core::VariableName_t& VarName,
00229                                const openfluid::core::Value& Val);
00230 
00231     /**
00232       Sets a distributed double variable value for a unit at the current time index
00233       @param[in] UnitPtr a Unit
00234       @param[in] VarName the name of the variable
00235       @param[in] Val the added value of the variable (double)
00236     */
00237     void OPENFLUID_SetVariable(openfluid::core::Unit *UnitPtr,
00238                                const openfluid::core::VariableName_t& VarName,
00239                                const double& Val);
00240 
00241     /**
00242       Sets a distributed double variable value for a unit at the current time index
00243       @param[in] UnitPtr a Unit
00244       @param[in] VarName the name of the variable
00245       @param[in] Val the added value of the variable (long)
00246     */
00247     void OPENFLUID_SetVariable(openfluid::core::Unit *UnitPtr,
00248                                const openfluid::core::VariableName_t& VarName,
00249                                const long& Val);
00250 
00251     /**
00252       Sets a distributed double variable value for a unit at the current time index
00253       @param[in] UnitPtr a Unit
00254       @param[in] VarName the name of the variable
00255       @param[in] Val the added value of the variable (bool)
00256     */
00257     void OPENFLUID_SetVariable(openfluid::core::Unit *UnitPtr,
00258                                const openfluid::core::VariableName_t& VarName,
00259                                const bool& Val);
00260 
00261     /**
00262       Sets a distributed double variable value for a unit at the current time index
00263       @param[in] UnitPtr a Unit
00264       @param[in] VarName the name of the variable
00265       @param[in] Val the added value of the variable (string)
00266     */
00267     void OPENFLUID_SetVariable(openfluid::core::Unit *UnitPtr,
00268                                const openfluid::core::VariableName_t& VarName,
00269                                const std::string& Val);
00270 
00271     /**
00272       Appends an event on a unit
00273       @param[in] UnitPtr a Unit
00274       @param[in] Ev the event to append
00275     */
00276     void OPENFLUID_AppendEvent(openfluid::core::Unit *UnitPtr,
00277                                openfluid::core::Event& Ev);
00278 
00279 
00280     /**
00281       Adds a unit to the set of units if not already exists
00282       @param[in] ClassName class name of the added unit
00283       @param[in] ID ID of the added unit
00284       @param[in] PcsOrder Process order of the added unit
00285     */
00286     void OPENFLUID_AddUnit(openfluid::core::UnitClass_t ClassName,
00287                            openfluid::core::UnitID_t ID,
00288                            openfluid::core::PcsOrd_t PcsOrder);
00289 
00290     /**
00291       Deletes a unit from the set of units if exists
00292       @param[in] ClassName class name of the removed unit
00293       @param[in] ID ID of the added unit
00294       @return true if the unit has been correctly deleted
00295     */
00296     void OPENFLUID_DeleteUnit(openfluid::core::UnitClass_t ClassName,
00297                               openfluid::core::UnitID_t ID);
00298 
00299 
00300     /**
00301       Adds a from-to connection between two units
00302       @param[in] ClassNameFrom class name of the "from" unit
00303       @param[in] IDFrom ID of the "from" unit
00304       @param[in] ClassNameTo class name of the "to" unit
00305       @param[in] IDTo ID of the "to" unit
00306       @return false if the unit connection already exists
00307     */
00308     bool OPENFLUID_AddFromToConnection(openfluid::core::UnitClass_t ClassNameFrom,
00309                                        openfluid::core::UnitID_t IDFrom,
00310                                        openfluid::core::UnitClass_t ClassNameTo,
00311                                        openfluid::core::UnitID_t IDTo);
00312 
00313     /**
00314       Adds a from-to connection between two units
00315       @param[in] FromUnit pointer to the "from" unit
00316       @param[in] ToUnit pointer to the "to" unit
00317       @return false if the connection already exists
00318     */
00319     bool OPENFLUID_AddFromToConnection(openfluid::core::Unit* FromUnit,
00320                                        openfluid::core::Unit* ToUnit);
00321 
00322     /**
00323       Removes a from-to connection between two units
00324       @param[in] ClassNameFrom class name of the "from" unit
00325       @param[in] IDFrom ID of the "from" unit
00326       @param[in] ClassNameTo class name of the "to" unit
00327       @param[in] IDTo ID of the "to" unit
00328       @return false if the unit connection does not exist
00329     */
00330     bool OPENFLUID_RemoveFromToConnection(openfluid::core::UnitClass_t ClassNameFrom,
00331                                           openfluid::core::UnitID_t IDFrom,
00332                                           openfluid::core::UnitClass_t ClassNameTo,
00333                                           openfluid::core::UnitID_t IDTo);
00334 
00335     /**
00336       Removes a from-to connection between two units
00337       @param[in] FromUnit pointer to the "from" unit
00338       @param[in] ToUnit pointer to the "to" unit
00339       @return false if the connection does not exist
00340     */
00341     bool OPENFLUID_RemoveFromToConnection(openfluid::core::Unit* FromUnit,
00342                                           openfluid::core::Unit* ToUnit);
00343 
00344 
00345     /**
00346       Adds a child-parent connection between two units
00347       @param[in] ClassNameChild class name of the "child" unit
00348       @param[in] IDChild ID of the "child" unit
00349       @param[in] ClassNameParent class name of the "parent" unit
00350       @param[in] IDParent ID of the "parent" unit
00351       @return false if the connection already exists
00352     */
00353     bool OPENFLUID_AddChildParentConnection(openfluid::core::UnitClass_t ClassNameChild,
00354                                             openfluid::core::UnitID_t IDChild,
00355                                             openfluid::core::UnitClass_t ClassNameParent,
00356                                             openfluid::core::UnitID_t IDParent);
00357 
00358     /**
00359       Adds a child-parent connection between two units
00360       @param[in] ChildUnit pointer to the "child" unit
00361       @param[in] ParentUnit pointer to the "parent" unit
00362       @return false if the connection already exists
00363     */
00364     bool OPENFLUID_AddChildParentConnection(openfluid::core::Unit* ChildUnit,
00365                                             openfluid::core::Unit* ParentUnit);
00366 
00367 
00368     /**
00369       Removes a child-parent connection between two units
00370       @param[in] ClassNameChild class name of the "child" unit
00371       @param[in] IDChild ID of the "child" unit
00372       @param[in] ClassNameParent class name of the "parent" unit
00373       @param[in] IDParent ID of the "parent" unit
00374       @return false if the connection does not exist
00375     */
00376     bool OPENFLUID_RemoveChildParentConnection(openfluid::core::UnitClass_t ClassNameChild,
00377                                                 openfluid::core::UnitID_t IDChild,
00378                                                 openfluid::core::UnitClass_t ClassNameParent,
00379                                                 openfluid::core::UnitID_t IDParent);
00380 
00381     /**
00382       Removes a child-parent connection between two units
00383       @param[in] ChildUnit pointer to the "child" unit
00384       @param[in] ParentUnit pointer to the "parent" unit
00385       @return false if the connection does not exist
00386     */
00387     bool OPENFLUID_RemoveChildParentConnection(openfluid::core::Unit* ChildUnit,
00388                                                 openfluid::core::Unit* ParentUnit);
00389 
00390     /**
00391       Builds a ColsNbr x RowsNbr unix matrix with bi-directionnal connections
00392       @param[in] UnitsClass the name of units class
00393       @param[in] ColsNbr the number of units on the X axis
00394       @param[in] RowsNbr the number of units on the Y axis
00395     */
00396     void OPENFLUID_BuildUnitsMatrix(const openfluid::core::UnitClass_t& UnitsClass,
00397                                     const unsigned int& ColsNbr,
00398                                     const unsigned int& RowsNbr);
00399 
00400     SimulationContributorWare(WareType WType) : SimulationInspectorWare(WType)
00401     {};
00402 
00403 
00404   public:
00405 
00406 
00407     virtual ~SimulationContributorWare() {};
00408 
00409 
00410 };
00411 
00412 
00413 
00414 } } // openfluid::ware
00415 
00416 
00417 
00418 #endif /* __SIMULATIONCONTRIBUTORWARE_HPP__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines