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 // 2009.05.19.ET 00024 // 00025 // Last updated 2011.11.18.ET 00026 // 00027 00028 // 00029 // Infertility.h 00030 // 00031 #ifndef Infertility_INCLUDED 00032 #define Infertility_INCLUDED 00033 00034 #include "String.h" 00035 #include "Boolean.h" 00036 #include <map> 00037 00038 #define IS_INFERTILE "T" 00039 #define NOT_INFERTILE "F" 00040 00041 class Infertility : public String { 00042 00043 public: 00044 // What type of Infertility? 00045 enum TYPE{ MALE_INFERTILITY,FEMALE_INFERTILITY,UNKNOWN_INFERTILITY_TYPE }; 00046 00047 private: 00048 00049 friend class InfertilityMapLoader; 00050 // 00051 static std::map<std::string,std::string> _lookupTable; 00052 00053 // See TYPE enum below: 00054 static std::map<std::string,TYPE> _lookupTypeTable; 00055 00056 // Here is the "Boolean" attribute that the regular "String" 00057 // class lacks: this defaults to missing: 00058 Boolean _booleanValue; 00059 00060 TYPE _type; 00061 00062 public: 00063 00064 // 00065 // Constructors: 00066 // 00067 Infertility() { _isMissing=true; } 00068 Infertility( const std::string value ){ set(value); } 00069 Infertility( const char* value ){ set(value); } 00070 00071 // 00072 // Set methods: 00073 // 00074 void set(const char *value); 00075 void set(const std::string value); 00076 00077 // 00078 // Get methods not present in base "String" class: 00079 // 00080 const bool getBoolean( void ) const; 00081 char getBooleanAsChar(void) const; 00082 const TYPE getType(void) const; 00083 00084 static void addInfertilityBooleanMapping(std::string relationshipValue,std::string booleanMapping); 00085 //static bool isa(std::string inString); 00086 00087 }; 00088 00089 // 00090 // Infertility Friend class that initializes the lookup table: 00091 // 00092 class InfertilityMapLoader 00093 { 00094 public: 00095 static InfertilityMapLoader infertilityMapLoader; 00096 00097 InfertilityMapLoader(){ 00098 00099 Infertility::_lookupTable["azoospermia" ] = IS_INFERTILE; 00100 Infertility::_lookupTable["endometriosis" ] = IS_INFERTILE; 00101 Infertility::_lookupTable["Azoospermia" ] = IS_INFERTILE; 00102 Infertility::_lookupTable["Endometriosis" ] = IS_INFERTILE; 00103 Infertility::_lookupTable["AZOOSPERMIA" ] = IS_INFERTILE; 00104 Infertility::_lookupTable["ENDOMETRIOSIS" ] = IS_INFERTILE; 00105 00106 Infertility::_lookupTypeTable["azoospermia" ] = Infertility::MALE_INFERTILITY; 00107 Infertility::_lookupTypeTable["endometriosis" ] = Infertility::FEMALE_INFERTILITY; 00108 Infertility::_lookupTypeTable["Azoospermia" ] = Infertility::MALE_INFERTILITY; 00109 Infertility::_lookupTypeTable["Endometriosis" ] = Infertility::FEMALE_INFERTILITY; 00110 Infertility::_lookupTypeTable["AZOOSPERMIA" ] = Infertility::MALE_INFERTILITY; 00111 Infertility::_lookupTypeTable["ENDOMETRIOSIS" ] = Infertility::FEMALE_INFERTILITY; 00112 00113 } 00114 }; 00115 00116 std::ostream& operator<<(std::ostream& s,const Infertility& n); 00117 00118 #endif