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

Proband.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, Ritu Khanna and Adrian Marrs
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.03.07.ET.RK
00024 //
00025 // Last updated 2011.11.18.ET
00026 //
00027 
00028 //
00029 // Proband.h
00030 //
00031 #ifndef Proband_INCLUDED
00032 #define Proband_INCLUDED
00033 
00034 #include "Boolean.h"
00035 
00036 class ProbandMapLoader;
00038 
00040 class Proband : public Boolean
00041 {
00042 public:
00043         
00044         enum PROBAND{ NOT_PROBAND, IS_PROBAND, MISSING }; 
00045 private:
00046         
00047         friend class ProbandMapLoader;
00048         static std::map<std::string,bool> _lookupTable;
00049 public:
00050         
00051         //
00052         // Constructors:
00053         //
00054         // Note: Boolean value true indicates a Proband
00055         // Boolean value false indicates not a Proband
00056         // 
00057         Proband() : Boolean() { }
00058         Proband(const char *value){ set(value); }
00059         Proband(const std::string &value){ set( value.c_str() ); }
00060         //
00061         // Static Methods:
00062         //
00063         static void addLookupTableEntry(std::string label, bool value);
00064         
00065         //
00066         //  Methods required by Variable virtual base class:
00067         //
00068         void set( const char *value );
00069         void set( const std::string &value);
00070         const std::string get( void ) const { if(isMissing()) return "."; if(_value) return "Y"; else return "N";}
00071         void set( const bool value ) { Boolean::set(value); }
00072         
00073         //
00074         // Additional Setters/Getters not present in virtual base class:
00075         //
00076         void set(PROBAND proband);
00077         const PROBAND getEnum( void ) const { if(_isMissing) return Proband::MISSING; if(_value) return Proband::IS_PROBAND; else return NOT_PROBAND; }
00078         
00079 };
00080 
00081 //
00082 // Proband Friend class that initializes the lookup table:
00083 //
00084 class ProbandMapLoader
00085 {
00086 public:
00087         static ProbandMapLoader probandMapLoader;
00088         ProbandMapLoader(){
00089                 Proband::_lookupTable["N"] = false;
00090                 Proband::_lookupTable["Y"] = true;
00091                 Proband::_lookupTable["y"] = true;
00092                 Proband::_lookupTable["n"] = false;
00093                 Proband::_lookupTable["yes"] = true;
00094                 Proband::_lookupTable["no" ] = false;
00095                 Proband::_lookupTable["Yes"] = true;
00096                 Proband::_lookupTable["No" ] = false;
00097                 Proband::_lookupTable["YES"] = true;
00098                 Proband::_lookupTable["NO" ] = false;
00099                 Proband::_lookupTable["p"      ] = true;
00100                 Proband::_lookupTable["P"      ] = true;
00101                 Proband::_lookupTable["proband"] = true;
00102                 Proband::_lookupTable["Proband"] = true;
00103                 Proband::_lookupTable["PROBAND"] = true;
00104         }
00105 };
00106 
00107 #endif

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