SHOGUN
v3.2.0
|
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 <shogun/base/Version.h> 00012 #include <shogun/base/SGObject.h> 00013 #include <shogun/lib/versionstring.h> 00014 #include <shogun/lib/RefCount.h> 00015 00016 using namespace shogun; 00017 00018 namespace shogun 00019 { 00020 const int32_t Version::version_revision = VERSION_REVISION; 00021 const int32_t Version::version_year = VERSION_YEAR; 00022 const int32_t Version::version_month = VERSION_MONTH; 00023 const int32_t Version::version_day = VERSION_DAY; 00024 const int32_t Version::version_hour = VERSION_HOUR; 00025 const int32_t Version::version_minute = VERSION_MINUTE; 00026 const int32_t Version::version_parameter=VERSION_PARAMETER; 00027 const char Version::version_extra[128] = VERSION_EXTRA; 00028 const char Version::version_release[128] = VERSION_RELEASE; 00029 } 00030 00031 Version::Version() 00032 { 00033 m_refcount = new RefCount(); 00034 } 00035 00036 00037 Version::~Version() 00038 { 00039 delete m_refcount; 00040 } 00041 00042 void Version::print_version() 00043 { 00044 SG_SPRINT("libshogun (%s/%s%d)\n\n", MACHINE, VERSION_RELEASE, version_revision) 00045 SG_SPRINT("Copyright (C) 1999-2009 Fraunhofer Institute FIRST\n") 00046 SG_SPRINT("Copyright (C) 1999-2011 Max Planck Society\n") 00047 SG_SPRINT("Copyright (C) 2009-2011 Berlin Institute of Technology\n") 00048 SG_SPRINT("Copyright (C) 2012-2014 Soeren Sonnenburg, Sergey Lisitsyn, Heiko Strathmann, Viktor Gal, Fernando Iglesias et al\n") 00049 SG_SPRINT("Written (W) 1999-2012 Soeren Sonnenburg, Gunnar Raetsch et al.\n\n") 00050 #ifndef USE_SVMLIGHT 00051 SG_SPRINT("This is free software; see the source for copying conditions. There is NO\n") 00052 SG_SPRINT("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n") 00053 #endif 00054 00055 #ifdef LINKFLAGS 00056 SG_SPRINT("( configure options: \"%s\" compile flags: \"%s\" link flags: \"%s\" )\n", 00057 CONFIGURE_OPTIONS, COMPFLAGS_CPP, LINKFLAGS) 00058 #else 00059 SG_SPRINT("( configure options: \"%s\" compile flags: \"%s\" link flags: None )\n", 00060 CONFIGURE_OPTIONS, COMPFLAGS_CPP) 00061 #endif 00062 } 00063 00064 const char* Version::get_version_extra() 00065 { 00066 return version_extra; 00067 } 00068 00069 const char* Version::get_version_release() 00070 { 00071 return version_release; 00072 } 00073 00074 int32_t Version::get_version_revision() 00075 { 00076 return version_revision; 00077 } 00078 00079 int32_t Version::get_version_year() 00080 { 00081 return version_year; 00082 } 00083 00084 int32_t Version::get_version_month() 00085 { 00086 return version_month; 00087 } 00088 00089 int32_t Version::get_version_day() 00090 { 00091 return version_day; 00092 } 00093 00094 int32_t Version::get_version_hour() 00095 { 00096 return version_hour; 00097 } 00098 00099 int32_t Version::get_version_minute() 00100 { 00101 return version_year; 00102 } 00103 00104 int32_t Version::get_version_parameter() 00105 { 00106 return version_parameter; 00107 } 00108 00109 int64_t Version::get_version_in_minutes() 00110 { 00111 return ((((version_year)*12 + version_month)*30 + version_day)* 24 + version_hour)*60 + version_minute; 00112 } 00113 00114 int32_t Version::ref() 00115 { 00116 return m_refcount->ref(); 00117 } 00118 00119 int32_t Version::ref_count() const 00120 { 00121 return m_refcount->ref_count(); 00122 } 00123 00124 int32_t Version::unref() 00125 { 00126 int32_t rc = m_refcount->unref(); 00127 00128 if (rc==0) 00129 { 00130 delete this; 00131 return 0; 00132 } 00133 00134 return rc; 00135 }