base/FuncSignature.hpp

Go to the documentation of this file.
00001 /*
00002   This file is part of OpenFLUID software
00003   Copyright (c) 2007-2010 INRA-Montpellier SupAgro
00004 
00005 
00006  == GNU General Public License Usage ==
00007 
00008   OpenFLUID is free software: you can redistribute it and/or modify
00009   it under the terms of the GNU General Public License as published by
00010   the Free Software Foundation, either version 3 of the License, or
00011   (at your option) any later version.
00012 
00013   OpenFLUID is distributed in the hope that it will be useful,
00014   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016   GNU General Public License for more details.
00017 
00018   You should have received a copy of the GNU General Public License
00019   along with OpenFLUID.  If not, see <http://www.gnu.org/licenses/>.
00020 
00021   In addition, as a special exception, INRA gives You the additional right
00022   to dynamically link the code of OpenFLUID with code not covered
00023   under the GNU General Public License ("Non-GPL Code") and to distribute
00024   linked combinations including the two, subject to the limitations in this
00025   paragraph. Non-GPL Code permitted under this exception must only link to
00026   the code of OpenFLUID dynamically through the OpenFLUID libraries
00027   interfaces, and only for building OpenFLUID plugins. The files of
00028   Non-GPL Code may be link to the OpenFLUID libraries without causing the
00029   resulting work to be covered by the GNU General Public License. You must
00030   obey the GNU General Public License in all respects for all of the
00031   OpenFLUID code and other code used in conjunction with OpenFLUID
00032   except the Non-GPL Code covered by this exception. If you modify
00033   this OpenFLUID, you may extend this exception to your version of the file,
00034   but you are not obligated to do so. If you do not wish to provide this
00035   exception without modification, you must delete this exception statement
00036   from your version and license this OpenFLUID solely under the GPL without
00037   exception.
00038 
00039 
00040  == Other Usage ==
00041 
00042   Other Usage means a use of OpenFLUID that is inconsistent with the GPL
00043   license, and requires a written agreement between You and INRA.
00044   Licensees for Other Usage of OpenFLUID may use this file in accordance
00045   with the terms contained in the written agreement between You and INRA.
00046 */
00047 
00048 
00055 #ifndef __FUNCSIGNATURE_H__
00056 #define __FUNCSIGNATURE_H__
00057 
00058 
00059 
00060 // =====================================================================
00061 // =====================================================================
00062 
00066 #define BEGIN_SIGNATURE_HOOK \
00067   openfluid::base::FunctionSignature* GetPlugSignature() \
00068   { \
00069     openfluid::base::FunctionSignature* Signature = new openfluid::base::FunctionSignature(); \
00070     Signature->setSDKVersion(STRINGIFY(OPENFLUID_VERSION));
00071 
00072 
00076 #define END_SIGNATURE_HOOK \
00077     return Signature; \
00078   }
00079 
00080 
00081 // =====================================================================
00082 // =====================================================================
00083 
00084 
00088 #define DECLARE_SIGNATURE_ID(id) Signature->ID = id;
00089 
00093 #define DECLARE_SIGNATURE_NAME(name) Signature->Name = name;
00094 
00098 #define DECLARE_SIGNATURE_DESCRIPTION(desc) Signature->Description = desc;
00099 
00103 #define DECLARE_SIGNATURE_DOMAIN(domain) Signature->Domain = domain;
00104 
00108 #define DECLARE_SIGNATURE_PROCESS(process) Signature->Process = process;
00109 
00113 #define DECLARE_SIGNATURE_METHOD(method) Signature->Method = method;
00114 
00118 #define DECLARE_SIGNATURE_AUTHORNAME(name) Signature->Author = name;
00119 
00123 #define DECLARE_SIGNATURE_AUTHOREMAIL(email) Signature->AuthorEmail = email;
00124 
00128 #define DECLARE_SIGNATURE_VERSION(version) Signature->Version = version;
00129 
00133 #define DECLARE_SIGNATURE_STATUS(status) Signature->Status = status;
00134 
00138 #define DECLARE_SIGNATURE_SDKVERSION Signature->setSDKVersion(STRINGIFY(OPENFLUID_VERSION));
00139 
00140 // =====================================================================
00141 // =====================================================================
00142 
00143 
00150 #define DECLARE_FUNCTION_PARAM(name,description,unit) \
00151   Signature->HandledData.FunctionParams.push_back(openfluid::base::SignatureHandledDataItem((name),(""),description,unit));
00152 
00153 
00154 
00155 // =====================================================================
00156 // =====================================================================
00157 
00158 
00166 #define DECLARE_PRODUCED_VAR(name,uclass,description,unit) \
00167   Signature->HandledData.ProducedVars.push_back(openfluid::base::SignatureHandledDataItem((name),uclass,description,unit));
00168 
00176 #define DECLARE_UPDATED_VAR(name,uclass,description,unit) \
00177   Signature->HandledData.UpdatedVars.push_back(openfluid::base::SignatureHandledDataItem((name),uclass,description,unit));
00178 
00186 #define DECLARE_REQUIRED_VAR(name,uclass,description,unit) \
00187   Signature->HandledData.RequiredVars.push_back(openfluid::base::SignatureHandledDataItem((name),uclass,description,unit));
00188 
00189 
00190 
00198 #define DECLARE_REQUIRED_PREVVAR(name,uclass,description,unit) \
00199   Signature->HandledData.RequiredPrevVars.push_back(openfluid::base::SignatureHandledDataItem((name),uclass,description,unit));
00200 
00208 #define DECLARE_USED_VAR(name,uclass,description,unit) \
00209   Signature->HandledData.UsedVars.push_back(openfluid::base::SignatureHandledDataItem((name),uclass,description,unit));
00210 
00211 
00219 #define DECLARE_USED_PREVVAR(name,uclass,description,unit) \
00220   Signature->HandledData.UsedPrevVars.push_back(openfluid::base::SignatureHandledDataItem((name),uclass,description,unit));
00221 
00229 #define DECLARE_REQUIRED_INPUTDATA(name,uclass,description,unit) \
00230   Signature->HandledData.RequiredInput.push_back(openfluid::base::SignatureHandledDataItem((name),uclass,description,unit));
00231 
00239 #define DECLARE_USED_INPUTDATA(name,uclass,description,unit) \
00240   Signature->HandledData.UsedInput.push_back(openfluid::base::SignatureHandledDataItem((name),uclass,description,unit));
00241 
00246 #define DECLARE_USED_EVENTS(uclass) Signature->HandledData.UsedEventsOnUnits.push_back(uclass);
00247 
00248 
00249 
00255 #define DECLARE_UPDATED_UNITSGRAPH(description) Signature->HandledUnitsGraph.UpdatedUnitsGraph = (description);
00256 
00257 
00264 #define DECLARE_UPDATED_UNITSCLASS(uclass,description) Signature->HandledUnitsGraph.UpdatedUnitsClass.push_back(openfluid::base::SignatureHandledUnitsClassItem(uclass,description));
00265 
00266 
00271 #define DECLARE_REQUIRED_EXTRAFILE(name) \
00272   Signature->HandledData.RequiredExtraFiles.push_back(name);
00273 
00278 #define DECLARE_USED_EXTRAFILE(name) \
00279   Signature->HandledData.UsedExtraFiles.push_back(name);
00280 
00281 
00282 // =====================================================================
00283 // =====================================================================
00284 
00285 
00286 
00287 namespace openfluid { namespace base {
00288 
00289 
00290 typedef std::string FuncID_t;
00291 typedef std::string FuncName_t;
00292 typedef std::string FuncVersion_t;
00293 typedef std::string FuncMethod_t;
00294 typedef std::string FuncProcess_t;
00295 typedef std::string FuncDomain_t;
00296 
00297 
00301 enum FuncStatus_t
00302 {
00306   EXPERIMENTAL,
00307 
00311   BETA,
00312 
00316   STABLE
00317 };
00318 
00319 
00320 // =====================================================================
00321 // =====================================================================
00325 struct SignatureHandledDataItem
00326 {
00327   std::string DataName;
00328   openfluid::core::UnitClass_t UnitClass;
00329   std::string Description;
00330   std::string DataUnit;
00331 
00332   SignatureHandledDataItem()
00333   {
00334     DataName = "";
00335     UnitClass = "";
00336     Description = "";
00337     DataUnit = "";
00338   }
00339 
00340   SignatureHandledDataItem(std::string DName, openfluid::core::UnitClass_t UClass,
00341                            std::string DDescription, std::string DUnit)
00342   {
00343     DataName = DName;
00344     UnitClass = UClass;
00345     Description = DDescription;
00346     DataUnit = DUnit;
00347   }
00348 
00349 };
00350 
00351 
00355 struct SignatureHandledUnitsClassItem
00356 {
00357   openfluid::core::UnitClass_t UnitsClass;
00358   std::string Description;
00359 
00360   SignatureHandledUnitsClassItem()
00361   {
00362     UnitsClass = "";
00363     Description = "";
00364   }
00365 
00366   SignatureHandledUnitsClassItem(openfluid::core::UnitClass_t UClass,
00367                            std::string DDescription)
00368   {
00369     UnitsClass = UClass;
00370     Description = DDescription;
00371   }
00372 
00373 };
00374 
00375 
00379 struct SignatureHandledData
00380 {
00381   std::vector<SignatureHandledDataItem> ProducedVars;
00382 
00383   std::vector<SignatureHandledDataItem> UpdatedVars;
00384 
00385   std::vector<SignatureHandledDataItem> RequiredVars;
00386 
00387   std::vector<SignatureHandledDataItem> UsedVars;
00388 
00389   std::vector<SignatureHandledDataItem> RequiredPrevVars;
00390 
00391   std::vector<SignatureHandledDataItem> UsedPrevVars;
00392 
00393   std::vector<SignatureHandledDataItem> FunctionParams;
00394 
00395   std::vector<SignatureHandledDataItem> RequiredInput;
00396 
00397   std::vector<SignatureHandledDataItem> UsedInput;
00398 
00399   std::vector<std::string> RequiredExtraFiles;
00400 
00401   std::vector<std::string> UsedExtraFiles;
00402 
00403   std::vector<openfluid::core::UnitClass_t> UsedEventsOnUnits;
00404 
00405 
00406   SignatureHandledData()
00407   {
00408 
00409   }
00410 
00411 };
00412 
00413 
00414 struct SignatureHandledUnitsGraph
00415 {
00416     std::string UpdatedUnitsGraph;
00417 
00418     std::vector<SignatureHandledUnitsClassItem> UpdatedUnitsClass;
00419 
00420     SignatureHandledUnitsGraph()
00421     {
00422       UpdatedUnitsGraph.clear();
00423     }
00424 };
00425 
00426 
00427 
00432 struct FunctionSignature
00433 {
00434 
00438   FuncID_t ID;
00439 
00443   FuncName_t Name;
00444 
00448   std::string Description;
00449 
00453   FuncDomain_t Domain;
00454 
00458   FuncProcess_t Process;
00459 
00463   FuncMethod_t Method;
00464 
00468   FuncVersion_t Version;
00469 
00473   FuncStatus_t Status;
00474 
00478   std::string SDKVersion;
00479 
00483   std::string Author;
00484 
00488   std::string AuthorEmail;
00489 
00493   SignatureHandledData HandledData;
00494 
00498   SignatureHandledUnitsGraph HandledUnitsGraph;
00499 
00500 
00501   FunctionSignature()
00502   {
00503     ID = "";
00504     Name = "";
00505     Description = "";
00506     Domain = "";
00507     Process = "";
00508     Method = "";
00509     Author = "";
00510     AuthorEmail = "";
00511     Version = "";
00512     Status = EXPERIMENTAL;
00513     SDKVersion = "";
00514   }
00515 
00516   void setSDKVersion(FuncVersion_t Version)
00517   {
00518     SDKVersion = Version;
00519   }
00520 
00521 };
00522 
00523 
00524 
00525 } } // namespaces
00526 
00527 
00528 
00529 #endif

Generated using Doxygen 1.7.3
Creative Commons License Creative Commons By-NC-ND license