GlsMap Toolkit  1.7.0
disti::VPFTable Class Reference

#include <vpf_table.h>

Public Types

typedef VPFUtil::PointerArray< VPFDataValueRow
 
typedef VPFUtil::PointerArray< RowTableData
 

Public Member Functions

 VPFTable (const char *const fname, volatile bool &abortLoad)
 
 VPFTable (const char *const fname, const VPFTableHeader::ColumnDefinition::Check *const columnCheck, const unsigned int numColumnCheck, volatile bool &abortLoad)
 
virtual ~VPFTable ()
 
const VPFTableHeaderGetTableHeader (void) const
 
const TableDataGetTableData (void) const
 
unsigned int GetRowCount (void) const
 
const VPFDataValueGetTableValue (const unsigned int rowNum, const unsigned int colNum) const
 
bool IsValid (void) const
 

Protected Member Functions

void Initialize (const char *const fname, volatile bool &abortLoad)
 
RowReadRow (VPFFile &infile, VPFTableHeader &tableHeader, volatile bool &abortLoad) const
 
bool CheckColumn (const unsigned int col, const VPFTableHeader::ColumnDefinition::Check &check, const bool colCanBeNULL=false) const
 
bool CheckColumnForeignKey (const unsigned int col, const char *const colName, const bool colCanBeNULL=false) const
 

Protected Attributes

VPFUtil::WarningBool _isValid
 
VPFTableHeader_tableHeader
 
TableData_data
 

Detailed Description

encapsulates a VPF table

Member Typedef Documentation

array of Row pointers

Constructor & Destructor Documentation

VPFTable::VPFTable ( const char *const  fname,
volatile bool &  abortLoad 
)

Load the VPF table with the given filename es

Parameters
fnamefilename of VPF table to load
abortLoadcan be set true by another thread to async abort the load
VPFTable::VPFTable ( const char *const  fname,
const VPFTableHeader::ColumnDefinition::Check *const  columnCheck,
const unsigned int  numColumnCheck,
volatile bool &  abortLoad 
)

Load the VPF table with the given filename and ensure that its columns match the columns described by the given column check structures. Check IsValid() to ensure that table was loaded successfully and columns match check structures

Parameters
fnamefilename of VPF table to load
columnCheckarray of column check structures (!=NULL)
numColumnChecknumber of check structures in columnCheckArray
abortLoadcan be set true by another thread to async abort the load
VPFTable::~VPFTable ( )
virtual

Dtor

Member Function Documentation

bool VPFTable::CheckColumn ( const unsigned int  col,
const VPFTableHeader::ColumnDefinition::Check check,
const bool  colCanBeNULL = false 
) const
protected

Check if a given column definition matches the given column check

Parameters
colzero based column number
checkcolumn check
colCanBeNULL[optional, defaults to false] true if column can optionally be a NULL data type and pass this check test
Returns
true if matches else false
bool VPFTable::CheckColumnForeignKey ( const unsigned int  col,
const char *const  colName,
const bool  colCanBeNULL = false 
) const
protected

Check if a given column definition matches a foreign key definition

Parameters
colzero based column number
colNamename of column
colCanBeNULL[optional, defaults to false] true if column can optionally be a NULL data type and pass this check test
Returns
true if matches else false
unsigned int disti::VPFTable::GetRowCount ( void  ) const
inline

Get number of rows in table ( shortcut for GetTableData()->GetRowCount() )

Returns
number of rows in table
const TableData* disti::VPFTable::GetTableData ( void  ) const
inline

Get the data in the table

Returns
table data else NULL
const VPFTableHeader* disti::VPFTable::GetTableHeader ( void  ) const
inline

Get the table header for this table

Returns
table header for table else NULL
const VPFDataValue * VPFTable::GetTableValue ( const unsigned int  rowNum,
const unsigned int  colNum 
) const

Get a specific column value from a specific row in the table

Parameters
rowNumzero based row number
colNumzero based column number
Returns
data value from table else NULL
void VPFTable::Initialize ( const char *const  fname,
volatile bool &  abortLoad 
)
protected

Initialize instance and load table from file. Used by Ctor

Parameters
fnamename of file to load
abortLoadcan be set true by another thread to async abort the load
bool disti::VPFTable::IsValid ( void  ) const
inline

Determine if the table was loaded successfully

Returns
true if loaded else false
VPFTable::Row * VPFTable::ReadRow ( VPFFile &  infile,
VPFTableHeader tableHeader,
volatile bool &  abortLoad 
) const
protected

Read a row of data described by the given table header from the given file

Parameters
infilefile to read
tableHeadertable header describing data to read
abortLoadcan be set true by another thread to async abort the load
Returns
new row else NULL

Member Data Documentation

TableData* disti::VPFTable::_data
protected

rows of table data values else NULL

VPFUtil::WarningBool disti::VPFTable::_isValid
protected

true if a valid table was loaded else false

VPFTableHeader* disti::VPFTable::_tableHeader
protected

header for table else NULL


The documentation for this class was generated from the following files: