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

DataColumn.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 //
00024 // DataColumn.h
00025 //
00026 
00027 #ifndef DATACOLUMN_INCLUDED
00028 #define DATACOLUMN_INCLUDED
00029 
00030 #include <string>
00031 
00032 // DEBUG:
00033 #include <iostream>
00034 
00035 #include "DataTypes.h"
00036 
00037 // Data is the virtual base class:
00038 #include "Data.h"
00039 #include "Date.h"
00040 #include "Gender.h"
00041 #include "Genotype.h"
00042 #include "Haplotype.h"
00043 #include "Number.h"
00044 #include "String.h"
00045 #include "Affected.h"
00046 #include "LivingDead.h"
00047 #include "Sampled.h"
00048 #include "Proband.h"
00049 #include "Consultand.h"
00050 #include "Carrier.h"
00051 #include "RelationshipEnded.h"
00052 #include "Sterility.h"
00053 #include "Infertility.h"
00054 #include "Twin.h"
00055 
00056 #include "Exception.h"
00057 #include "Warning.h"
00058 #include <vector>
00059 
00060 #include "UniqueList.h"
00061 
00068 //
00069 // DataColumn:
00070 //
00071 class DataColumn {
00072         
00073 private:
00074         std::string _name;                // column name
00075         int _ordinal;                     // physical position of the column 
00076         DATATYPE _columnType;             // Type of data
00077         
00078         unsigned long _rows;               // Number of values (i.e., rows) in the column
00079         std::vector<Data*> _data;
00080         
00081         bool _showOnPedigree;             // Flag indicating that the column should appear on the pedigree.
00082         bool _showOnIcon;                 // Flag indicating that the column should appear on the icon.
00083         
00084         UniqueList *_uniqueList;
00085         
00086         
00087 public:
00088         
00089         //
00090         // Constructors:
00091         //
00092         DataColumn();
00093 
00094         DataColumn(const std::string &name,DATATYPE columnType=MISSING, unsigned long rows=0, unsigned  ordinal=0 );
00095         
00096         // Destructor:
00097         ~DataColumn();
00098         
00099         // Setters:
00100         void setColumnType   ( DATATYPE columnType    ){ _columnType=columnType; };
00101         void setName         ( const char *name       ){ _name=name;             };
00102         void setName         ( const std::string &name){ _name=name;
00103                      };
00104         void setShowOnPedigree(bool value);
00105         void setShowOnIcon(bool value);
00106         
00107         void set(std::vector<std::string> & vec);
00108         void setRow( unsigned long row , const std::string & value);
00109 
00110         bool True() const {return true;}
00111         bool False() const {return false;}
00112         
00113         // Getters:
00114         DATATYPE getColumnType     ( void ) const { return _columnType; };
00115         std::string getColumnTypeAsString(void) const;
00116         int      getOrdinal        ( void ) const { return _ordinal;    };
00117         int      getNumberOfRows   ( void ) const { return _rows;       };
00118         std::string getName        ( void ) const { return _name;       };
00119         std::string getCaseInvariantName( void ) const;
00120         bool getShowOnPedigree(void) const;
00121         bool getShowOnIcon(void) const;
00122         
00123         // DEBUGGING:
00124         void printData( void );
00125         void printData( unsigned long i );
00126         
00127         // get the ith row / element from the column
00128         std::string get( unsigned long i) const;
00129         Data* getDataAtIndex(unsigned long i) const;
00130         std::vector<Data*> getData(){ return _data; }
00131         
00132         //
00133         // This cannot be a const method because it needs
00134         // to create the private _uniqueList if not yet present:
00135         // 
00136         const UniqueList *const getUniqueList(void);
00137 
00138 };
00139 
00140 #endif

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