00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00022 
00023 
00024 
00025 
00026 #ifndef COLUMNCLASSIFIER_INCLUDED
00027 #define COLUMNCLASSIFIER_INCLUDED
00028 
00029 #include <string>
00030 #include "DataTypes.h"
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 class ColumnClassifier{
00042         
00043 private:
00044         
00045         static const char _THOUSANDS_SEPARATOR=',';
00046         static const char _DECIMAL_CHARACTER='.';
00047         
00048         int _missingOrDotCounter;
00049         int _numericCounter;
00050         int _dateCounter;
00051         int _genotypeCounter;
00052         int _genderCounter;
00053         int _totalCounter;
00054         
00055         const char *test;
00056         const char *_stt;
00057         const char *_end;
00058         
00059         
00060         bool _isEmptyOrDot(const char *p, int stt, int end);
00061         bool _isGender    (const char *p, int stt, int end);
00062         bool _isNumeric   (const char *p, int stt, int end);
00063         bool _isGenotype  (const char *p, int stt, int end);
00064         bool _isDate      (const char *p, int stt, int end);
00065         bool _isASCII(const char *p,int stt, int end);
00066         
00067 public:
00068         
00069         ColumnClassifier(){ resetCounters(); }
00070         void scan( const char *p, int stt, int end);
00071         void scan( const char *s);
00072         void scan( const std::string &s);
00073         
00074         void resetCounters( void ){
00075                 
00076                 _missingOrDotCounter = _numericCounter = _dateCounter =0;
00077                 _genotypeCounter = _genderCounter = _totalCounter = 0;
00078                 
00079         }
00080         
00081         DATATYPE classify( void );
00082         
00083         
00084 };
00085 
00086 #endif