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 // Sterility.h 00030 // 00031 #ifndef Sterility_INCLUDED 00032 #define Sterility_INCLUDED 00033 00034 #include "String.h" 00035 #include "Boolean.h" 00036 #include <map> 00037 00038 #define IS_STERILE "T" 00039 #define NOT_STERILE "F" 00040 00041 class Sterility : public String { 00042 00043 public: 00044 // What type of Sterility? 00045 enum TYPE{ MALE_STERILITY,FEMALE_STERILITY,UNKNOWN_STERILITY_TYPE }; 00046 00047 private: 00048 00049 friend class SterilityMapLoader; 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 Sterility() { _isMissing=true; } 00068 Sterility( const std::string value ){ set(value); } 00069 Sterility( 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 addSterilityBooleanMapping(std::string relationshipValue,std::string booleanMapping); 00085 //static bool isa(std::string inString); 00086 00087 }; 00088 00089 // 00090 // Sterility Friend class that initializes the lookup table: 00091 // 00092 class SterilityMapLoader 00093 { 00094 public: 00095 static SterilityMapLoader sterilityMapLoader; 00096 00097 SterilityMapLoader(){ 00098 00099 Sterility::_lookupTable["vasectomy" ] = IS_STERILE; 00100 Sterility::_lookupTable["tubal" ] = IS_STERILE; 00101 Sterility::_lookupTable["tubal ligation"] = IS_STERILE; 00102 Sterility::_lookupTable["Vasectomy" ] = IS_STERILE; 00103 Sterility::_lookupTable["Tubal" ] = IS_STERILE; 00104 Sterility::_lookupTable["Tubal Ligation"] = IS_STERILE; 00105 Sterility::_lookupTable["VASECTOMY" ] = IS_STERILE; 00106 Sterility::_lookupTable["TUBAL" ] = IS_STERILE; 00107 Sterility::_lookupTable["TUBAL LIGATION"] = IS_STERILE; 00108 00109 Sterility::_lookupTypeTable["vasectomy" ] = Sterility::MALE_STERILITY; 00110 Sterility::_lookupTypeTable["tubal" ] = Sterility::FEMALE_STERILITY; 00111 Sterility::_lookupTypeTable["tubal ligation" ] = Sterility::FEMALE_STERILITY; 00112 Sterility::_lookupTypeTable["Vasectomy" ] = Sterility::MALE_STERILITY; 00113 Sterility::_lookupTypeTable["Tubal" ] = Sterility::FEMALE_STERILITY; 00114 Sterility::_lookupTypeTable["Tubal Ligation" ] = Sterility::FEMALE_STERILITY; 00115 Sterility::_lookupTypeTable["VASECTOMY" ] = Sterility::MALE_STERILITY; 00116 Sterility::_lookupTypeTable["TUBAL" ] = Sterility::FEMALE_STERILITY; 00117 Sterility::_lookupTypeTable["TUBAL LIGATION" ] = Sterility::FEMALE_STERILITY; 00118 00119 } 00120 }; 00121 00122 std::ostream& operator<<(std::ostream& s,const Sterility& n); 00123 00124 #endif