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