Version.h

Go to the documentation of this file.
00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 3 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * Written (W) 1999-2009 Soeren Sonnenburg
00008  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max Planck Society
00009  */
00010 
00011 #include "base/init.h"
00012 
00013 #include "lib/common.h"
00014 #include "lib/io.h"
00015 #include "lib/versionstring.h"
00016 #include "lib/config.h"
00017 
00018 #ifndef VERSION_H__
00019 #define VERSION_H__
00020 
00021 namespace shogun
00022 {
00023 class IO;
00024 
00031 class Version
00032 {
00033 public:
00034     Version();
00035     virtual ~Version();
00036 
00037     static inline void print_version()
00038     {
00039         SG_SPRINT("libshogun (%s/%s%d)\n\n", MACHINE, VERSION_RELEASE, version_revision);
00040         SG_SPRINT("Copyright (C) 1999-2009 Fraunhofer Institute FIRST\n");
00041         SG_SPRINT("Copyright (C) 1999-2010 Max Planck Society\n");
00042         SG_SPRINT("Copyright (C) 2009-2010 Berlin Institute of Technology\n");
00043         SG_SPRINT("Written   (W) 1999-2010 Soeren Sonnenburg, Gunnar Raetsch et al.\n\n");
00044 #ifndef USE_SVMLIGHT
00045         SG_SPRINT("This is free software; see the source for copying conditions.  There is NO\n");
00046         SG_SPRINT("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n");
00047 #endif
00048         SG_SPRINT( "( configure options: \"%s\" compile flags: \"%s\" link flags: \"%s\" )\n", CONFIGURE_OPTIONS, COMPFLAGS_CPP, LINKFLAGS);
00049     }
00050 
00051     static inline const char* get_version_extra()
00052     {
00053         return version_extra;
00054     }
00055 
00056     static inline const char* get_version_release()
00057     {
00058         return version_release;
00059     }
00060 
00061     static inline int32_t get_version_revision()
00062     {
00063         return version_revision;
00064     }
00065 
00066     static inline int32_t get_version_year()
00067     {
00068         return version_year;
00069     }
00070 
00071     static inline int32_t get_version_month()
00072     {
00073         return version_month;
00074     }
00075 
00076     static inline int32_t get_version_day()
00077     {
00078         return version_day;
00079     }
00080 
00081     static inline int32_t get_version_hour()
00082     {
00083         return version_hour;
00084     }
00085 
00086     static inline int32_t get_version_minute()
00087     {
00088         return version_year;
00089     }
00090 
00091     static inline int64_t get_version_in_minutes()
00092     {
00093         return ((((version_year)*12 + version_month)*30 + version_day)* 24 + version_hour)*60 + version_minute;
00094     }
00095 
00096     inline int32_t ref()
00097     {
00098         ++refcount;
00099         return refcount;
00100     }
00101 
00102     inline int32_t ref_count() const
00103     {
00104         return refcount;
00105     }
00106 
00107     inline int32_t unref()
00108     {
00109         if (refcount==0 || --refcount==0)
00110         {
00111             delete this;
00112             return 0;
00113         }
00114         else
00115             return refcount;
00116     }
00117 
00118 protected:
00119     static const char version_release[128];
00120     static const char version_extra[128];
00121 
00122     static const int32_t version_revision;
00123     static const int32_t version_year;
00124     static const int32_t version_month;
00125     static const int32_t version_day;
00126     static const int32_t version_hour;
00127     static const int32_t version_minute;
00128 private:
00129     int32_t refcount;
00130 };
00131 }
00132 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation