![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2006 MAK Technologies, Inc.** All rights reserved. 00003 ******************************************************************************/ 00004 /****************************************************************************** 00005 * $RCSfile: vpfTable.h,v $ $Revision: 1.11 $ $State: Exp $ 00006 ******************************************************************************/ 00007 00008 #ifndef VPF_TABLE_H_ 00009 #define VPF_TABLE_H_ 00010 00013 00014 #include <string> 00015 #include <iostream> 00016 #include <fstream> 00017 #include <vector> 00018 00019 #include <vlutil/vlString.h> 00020 #include <vlutil/vlFilename.h> 00021 00022 #include "vmap/vmapDefines.h" 00023 00024 //forward defs 00025 class DtVpfIndexTable; 00026 class DtVpfColumn; 00027 class DtVpfRow; 00028 00029 typedef std::vector<DtVpfColumn*> DtColumnList; 00030 typedef std::vector<DtVpfRow*> DtRowList; 00031 00032 00034 class DT_DLL_vmap DtVpfTable 00035 { 00037 enum DtByteOrderEnum {LSB, MSB}; 00038 00039 private: 00041 DtVpfTable(const DtVpfTable& table); 00042 00044 DtVpfTable& operator=(const DtVpfTable& table); 00045 00046 public: 00049 DtVpfTable(const DtFilename& path); 00050 00052 virtual ~DtVpfTable(); 00053 00056 virtual std::istream& file(); 00057 00060 virtual const DtFilename& fileName() const; 00061 00064 virtual const DtFilename& filePath(); 00065 00068 virtual bool mustSwap() const; 00069 00074 virtual const DtVpfColumn* column(const DtString& columnName) const; 00075 00078 virtual const DtColumnList* columns() const; 00079 00082 virtual unsigned int numColumns() const; 00083 00088 virtual const DtVpfRow* row(int unsigned rowNumber) const; 00089 00094 virtual const DtVpfRow* rowById(int unsigned id) const; 00095 00098 virtual const DtRowList* rows() const; 00099 00102 virtual unsigned int numRows() const; 00103 00106 virtual const DtVpfTable* intDescriptionTable() const; 00107 00110 virtual const DtVpfTable* charDescriptionTable() const; 00111 00112 protected: 00115 virtual bool readTable(); 00116 00119 virtual bool readHeader(); 00120 00123 virtual bool readData(); 00124 00126 virtual void calculateByteOrder(); 00127 00130 virtual bool loadValueDescriptionTable(const DtString &tableName); 00131 00132 int myHeaderLength; 00133 DtByteOrderEnum myFileByteOrder; 00134 DtByteOrderEnum myMachineByteOrder; 00135 DtString myTableDescription; 00136 DtString myNarrativeTableFileName; 00137 DtFilename myFileName; 00138 DtFilename myFilePath; 00139 std::ifstream myFile; 00140 std::ifstream::pos_type myFileSize; 00141 00142 DtColumnList myColumns; 00143 DtRowList myRows; 00144 00145 //some columns have descriptions stored in these tables 00146 //a columns description() function will reference these tables 00147 DtVpfTable* myIntDescriptions; 00148 DtVpfTable* myCharDescriptions; 00149 }; 00150 00151 #endif