Framework.cpp

00001 #include "Framework.h"
00002 
00003 extern StreamOutput cout;
00004 
00005 bool Framework::m_isClassificationDataset;
00006 int Framework::m_maxThreads;
00007 int Framework::m_randomSeed;
00008 int Framework::m_frameworkMode;
00009 int Framework::m_additionalStartupParameter;
00010 
00014 Framework::Framework()
00015 {
00016     //cout<<"Framework"<<endl;
00017 }
00018 
00022 Framework::~Framework()
00023 {
00024     //cout<<"descructor Framework"<<endl;
00025 }
00026 
00032 void Framework::setDatasetType ( bool isClassification )
00033 {
00034     m_isClassificationDataset = isClassification;
00035     cout<<"isClassificationDataset: "<<m_isClassificationDataset<<endl;
00036 }
00037 
00043 bool Framework::getDatasetType()
00044 {
00045     return m_isClassificationDataset;
00046 }
00047 
00053 void Framework::setMaxThreads ( int n )
00054 {
00055     m_maxThreads = n;
00056     omp_set_num_threads ( m_maxThreads );  // set this value for OPENMP pragmas
00057     cout<<"maxThreads(OPENMP): "<<m_maxThreads<<endl;
00058 }
00059 
00065 int Framework::getMaxThreads()
00066 {
00067     return m_maxThreads;
00068 }
00069 
00075 void Framework::setRandomSeed ( int s )
00076 {
00077     m_randomSeed = s;
00078     cout<<"randomSeed: "<<m_randomSeed<<endl;
00079 }
00080 
00086 int Framework::getRandomSeed()
00087 {
00088     return m_randomSeed;
00089 }
00090 
00097 void Framework::setFrameworkMode ( int mode )
00098 {
00099     m_frameworkMode = mode;
00100     cout<<"frameworkMode: "<<m_frameworkMode<<endl;
00101 }
00102 
00108 int Framework::getFrameworkMode()
00109 {
00110     return m_frameworkMode;
00111 }
00112 
00118 void Framework::setAdditionalStartupParameter ( char* s )
00119 {
00120     int n = -1;
00121     sscanf ( s,"%d",&n );
00122     m_additionalStartupParameter = n;
00123     cout<<"additionalStartupParameter: "<<m_additionalStartupParameter<<endl;
00124 }
00125 
00131 int Framework::getAdditionalStartupParameter()
00132 {
00133     return m_additionalStartupParameter;
00134 }
00135 
00147 uint Framework::convertDateToInt(uint day, uint month, uint year, uint hour, uint minute, uint second)
00148 {
00149     struct tm t;
00150     t.tm_year = year - 1900;
00151     t.tm_mon = month - 1;
00152     t.tm_mday = day;
00153     t.tm_hour = hour;
00154     t.tm_min = minute;
00155     t.tm_sec = second;
00156     t.tm_isdst = 0;
00157     time_t tt = mktime(&t);
00158     
00159     time_t secondsFromNow = time(0);
00160     tm* t0 = gmtime(&secondsFromNow);
00161     
00162     if(t0->tm_isdst == 0)
00163         tt += 3600;
00164     
00165     return tt;
00166 }
00167 
00179 void Framework::convertIntToDate(uint date,uint &day, uint &month, uint &year, uint &hour, uint &minute, uint &second, uint &weekday)
00180 {
00181     time_t seconds = date;
00182     struct tm t = *gmtime(&seconds);
00183     day = t.tm_mday;
00184     month = t.tm_mon + 1;
00185     year = t.tm_year + 1900;
00186     hour = t.tm_hour;
00187     minute = t.tm_min;
00188     second = t.tm_sec;
00189     weekday = t.tm_wday; // 0..6  days since Sunday
00190 }

Generated on Tue Jan 26 09:20:58 2010 for ELF by  doxygen 1.5.8