ware/WareSignature.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 WareSignature.hpp
00035   \brief Header of ...
00036 
00037   \author Jean-Christophe FABRE <fabrejc@supagro.inra.fr>
00038  */
00039 
00040 #include <openfluid/dllexport.hpp>
00041 #include <openfluid/tools/SwissTools.hpp>
00042 
00043 
00044 #ifndef __WARESIGNATURE_HPP__
00045 #define __WARESIGNATURE_HPP__
00046 
00047 
00048 /**
00049   Macro for declaration of the ware name
00050 */
00051 #define DECLARE_NAME(name) Signature->Name = name;
00052 
00053 /**
00054   Macro for declaration of the ware description
00055 */
00056 #define DECLARE_DESCRIPTION(desc) Signature->Description = desc;
00057 
00058 /**
00059   Macro for declaration of the ware author name and email
00060 */
00061 #define DECLARE_AUTHOR(name,email) Signature->Authors.push_back(std::make_pair((name),(email)));
00062 
00063 /**
00064   Macro for declaration of the ware version
00065 */
00066 #define DECLARE_VERSION(version) Signature->Version = version;
00067 
00068 /**
00069   Macro for declaration of the ware status
00070 */
00071 #define DECLARE_STATUS(status) Signature->Status = status;
00072 
00073 /**
00074   Macro for declaration of ABI version used to build the ware
00075 */
00076 #define DECLARE_SDKVERSION Signature->setABIVersion(openfluid::config::FULL_VERSION);
00077 
00078 
00079 // =====================================================================
00080 // =====================================================================
00081 
00082 
00083 namespace openfluid { namespace ware {
00084 
00085 
00086 typedef std::string WareID_t;
00087 
00088 typedef std::string WareName_t;
00089 
00090 typedef std::string WareVersion_t;
00091 
00092 
00093 /**
00094   Ware status
00095 */
00096 enum WareStatus_t
00097 {
00098   /**
00099     Experimental status, for testing only
00100   */
00101   EXPERIMENTAL,
00102 
00103   /**
00104     Beta status, on the road to a stable status
00105   */
00106   BETA,
00107 
00108   /**
00109     Stable status
00110   */
00111   STABLE
00112 };
00113 
00114 
00115 // =====================================================================
00116 // =====================================================================
00117 
00118 
00119 class DLLEXPORT WareSignature
00120 {
00121   public:
00122 
00123     typedef std::list<std::pair<std::string,std::string> > AuthorsList_t;
00124 
00125     WareID_t ID;
00126 
00127     WareName_t Name;
00128 
00129     std::string Description;
00130 
00131     /**
00132     Version number
00133     */
00134     WareVersion_t Version;
00135 
00136     /**
00137     Development status
00138     */
00139     WareStatus_t Status;
00140 
00141     /**
00142     ABI version number used to build the ware
00143     */
00144     WareVersion_t ABIVersion;
00145 
00146     /**
00147     Authors as a list of pairs [name,email]
00148     */
00149     AuthorsList_t Authors;
00150 
00151 
00152     WareSignature() :
00153       ID(""),Name(""),Description(""),Version(""),
00154       Status(EXPERIMENTAL),ABIVersion("")
00155       {
00156         Authors.clear();
00157       }
00158 
00159 
00160     virtual ~WareSignature()
00161       {}
00162 
00163 
00164     void setABIVersion(WareVersion_t Version)
00165     {
00166       ABIVersion = Version;
00167     }
00168 
00169 
00170     std::string getAuthorsAsString() const
00171     {
00172       std::string Str = "";
00173 
00174       for (openfluid::ware::WareSignature::AuthorsList_t::const_iterator it = Authors.begin(); it != Authors.end();++it)
00175       {
00176         if (it != Authors.begin())
00177           Str+= ", ";
00178 
00179         Str += openfluid::tools::ReplaceEmptyString((*it).first,("(unknown author)"));
00180         Str += " <";
00181         Str += openfluid::tools::ReplaceEmptyString((*it).second,("(unknown author email)"));
00182         Str += ">";
00183       }
00184       return Str;
00185     }
00186 
00187 
00188 };
00189 
00190 
00191 
00192 } } // openfluid::ware
00193 
00194 
00195 
00196 #endif /* __WARESIGNATURE_HPP__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines