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 "Twin.h"
00050 
00051 #include "Exception.h"
00052 #include "Warning.h"
00053 #include <vector>
00054 
00055 #include "UniqueList.h"
00056 
00063 //
00064 // DataColumn:
00065 //
00066 class DataColumn {
00067         
00068 private:
00069         std::string _name;                // column name
00070         int _ordinal;                     // physical position of the column 
00071         DATATYPE _columnType;             // Type of data
00072         
00073         unsigned long _rows;               // Number of values (i.e., rows) in the column
00074         std::vector<Data*> _data;
00075         
00076         bool _showOnPedigree;             // Flag indicating that the column should appear on the pedigree.
00077         bool _showOnIcon;                 // Flag indicating that the column should appear on the icon.
00078         
00079         UniqueList *_uniqueList;
00080         
00081         
00082 public:
00083         
00084         //
00085         // Constructors:
00086         //
00087         DataColumn();
00088 
00089         DataColumn(const std::string &name,DATATYPE columnType=MISSING, unsigned long rows=0, unsigned  ordinal=0 );
00090         
00091         // Destructor:
00092         ~DataColumn();
00093         
00094         // Setters:
00095         void setColumnType   ( DATATYPE columnType    ){ _columnType=columnType; };
00096         void setName         ( const char *name       ){ _name=name;             };
00097         void setName         ( const std::string &name){ _name=name;
00098                      };
00099         void setShowOnPedigree(bool value);
00100         void setShowOnIcon(bool value);
00101         
00102         void set(std::vector<std::string> & vec);
00103         void setRow( unsigned long row , const std::string & value);
00104 
00105         bool True() const {return true;}
00106         bool False() const {return false;}
00107         
00108         // Getters:
00109         DATATYPE getColumnType     ( void ) const { return _columnType; };
00110         std::string getColumnTypeAsString(void) const;
00111         int      getOrdinal        ( void ) const { return _ordinal;    };
00112         int      getNumberOfRows   ( void ) const { return _rows;       };
00113         std::string getName        ( void ) const { return _name;       };
00114         std::string getCaseInvariantName( void ) const;
00115         bool getShowOnPedigree(void) const;
00116         bool getShowOnIcon(void) const;
00117         
00118         // DEBUGGING:
00119         void printData( void );
00120         void printData( unsigned long i );
00121         
00122         // get the ith row / element from the column
00123         std::string get( unsigned long i) const;
00124         Data* getDataAtIndex(unsigned long i) const;
00125         std::vector<Data*> getData(){ return _data; }
00126         
00127         //
00128         // This cannot be a const method because it needs
00129         // to create the private _uniqueList if not yet present:
00130         // 
00131         const UniqueList *const getUniqueList(void);
00132 
00133 };
00134 
00135 #endif

Generated on Tue Feb 27 14:39:23 2007 for MINIMADELINE by  doxygen 1.4.4