Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

ColumnClassifier.h

Go to the documentation of this file.
00001 
00002 //
00003 // This file is part of the MADELINE 2 program 
00004 // written by Edward H. Trager and Ritu Khanna
00005 // Copyright (c) 2005 by the
00006 // Regents of the University of Michigan.
00007 // All Rights Reserved.
00008 // 
00009 // The latest version of this program is available from:
00010 // 
00011 //   http://eyegene.ophthy.med.umich.edu/madeline/
00012 //   
00013 // Released under the GNU General Public License.
00014 // A copy of the GPL is included in the distribution
00015 // package of this software, or see:
00016 // 
00017 //   http://www.gnu.org/copyleft/
00018 //   
00019 // ... for licensing details.
00020 // 
00022 //
00023 // 2005.02.04.ET
00024 //
00025 
00026 #ifndef COLUMNCLASSIFIER_INCLUDED
00027 #define COLUMNCLASSIFIER_INCLUDED
00028 
00029 #include <string>
00030 #include "DataTypes.h"
00031 
00032 //
00033 // Originally written as the column classifier for
00034 // Madeline flat file tables, this class is now used
00035 // to provide uniform column classification behaviour
00036 // in the DataTable class.  The way the parameters
00037 // of the scan method and other methods are set up
00038 // reflects the original history of the class' use
00039 // with the Madeline flat file tables.
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

Generated on Fri Nov 18 16:24:39 2011 for MADELINE by  doxygen 1.4.4