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

Affected.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.08.31.ET
00024 //
00025 // Last updated 2011.11.18.ET
00026 // 
00027 
00028 //
00029 // Affected.h
00030 //
00031 #ifndef Affected_INCLUDED
00032 #define Affected_INCLUDED
00033 
00034 #include "String.h"
00035 #include "Boolean.h"
00036 #include <map>
00037 
00038 #define BOOLEAN_AFFECTED "T"
00039 #define BOOLEAN_UNAFFECTED "F"
00040 
00041 class Affected : public String {
00042         
00043 private:
00044         
00045         friend class AffectedMapLoader;
00046         static std::map<std::string,std::string> _lookupTable;
00047         
00048         // Here is the "Boolean" attribute that the regular "String" 
00049         // class lacks: this defaults to missing:
00050         Boolean _booleanValue;
00051         
00052 public:
00053         
00054         //
00055         // Constructors:
00056         //
00057         Affected() { _isMissing=true; }
00058         Affected( const std::string value ){ set(value); }
00059         Affected( const char* value ){ set(value); }
00060         
00061         //
00062         // Set methods:
00063         //
00064         void set(const char *value);
00065         void set(const std::string value);
00066         
00067         //
00068         // Get methods not present in base "String" class:
00069         //
00070         const bool getBoolean( void ) const;
00071         char getBooleanAsChar(void) const;
00072         
00073         static void addAffectedBooleanMapping(std::string affectedValue,std::string booleanMapping);
00074         static bool isa(std::string inString);
00075         
00076 };
00077 
00078 //
00079 // Affected Friend class that initializes the lookup table:
00080 //
00081 class AffectedMapLoader
00082 {
00083 public:
00084         static AffectedMapLoader affectedMapLoader;
00085         
00086         AffectedMapLoader(){
00087                 Affected::_lookupTable["a"]  = BOOLEAN_AFFECTED;
00088                 Affected::_lookupTable["u"]  = BOOLEAN_UNAFFECTED;
00089                 Affected::_lookupTable["A"]  = BOOLEAN_AFFECTED;
00090                 Affected::_lookupTable["U"]  = BOOLEAN_UNAFFECTED;
00091                 Affected::_lookupTable["affected"  ]  = BOOLEAN_AFFECTED;
00092                 Affected::_lookupTable["unaffected"]  = BOOLEAN_UNAFFECTED;
00093                 Affected::_lookupTable["Affected"  ]  = BOOLEAN_AFFECTED;
00094                 Affected::_lookupTable["Unaffected"]  = BOOLEAN_UNAFFECTED;
00095                 Affected::_lookupTable["AFFECTED"  ]  = BOOLEAN_AFFECTED;
00096                 Affected::_lookupTable["UNAFFECTED"]  = BOOLEAN_UNAFFECTED;
00097         }
00098 };
00099 
00100 std::ostream& operator<<(std::ostream& s,const Affected& n);
00101 
00102 #endif

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