#include <FlatFileParser.h>
Public Member Functions | |
FlatFileRowDescriptor () | |
Construct a new row descriptor. | |
void | setUnbounded () |
Set scan to run in an unbounded mode, with a dynamic number of columns, and unbounded column sizes. | |
bool | isBounded () const |
Whether to run regular scan mode, bounded by column descriptions, or to run in an unbounded scan mode. | |
void | setMap (VectorOfUint map) |
Sets a mapping from source column ordinal to target column ordinal. | |
bool | isMapped () const |
Whether using a mapping from source to column ordinal. | |
int | getMap (uint iSource) const |
Gets the mapping from source to target column. | |
void | setLenient (bool lenientIn) |
bool | isLenient () const |
uint | getMaxColumns () const |
Gets the expected number of columns to scan for this row. | |
uint | getMaxLength (uint i) const |
Gets the expected length of a column being scanned. | |
Static Public Attributes | |
static const int | MAX_COLUMNS = 1024 |
Maximum number of columns in an unbounded scan. | |
static const int | MAX_COLUMN_LENGTH = 65535 |
Maximum length of a column in an unbounded scan. | |
Private Attributes | |
bool | bounded |
bool | lenient |
VectorOfUint | columnMap |
There are two main types of scans. An unbounded scan and a bounded scan. By default, the scan is bounded.
Definition at line 261 of file FlatFileParser.h.
FlatFileRowDescriptor::FlatFileRowDescriptor | ( | ) |
Construct a new row descriptor.
Definition at line 50 of file FlatFileParser.cpp.
References bounded.
00050 : 00051 std::vector<FlatFileColumnDescriptor>() 00052 { 00053 bounded = true; 00054 }
void FlatFileRowDescriptor::setUnbounded | ( | ) |
Set scan to run in an unbounded mode, with a dynamic number of columns, and unbounded column sizes.
Definition at line 56 of file FlatFileParser.cpp.
References bounded.
Referenced by FlatFileExecStreamImpl::open(), and FlatFileExecStreamImpl::readTupleDescriptor().
00057 { 00058 bounded = false; 00059 }
bool FlatFileRowDescriptor::isBounded | ( | ) | const |
Whether to run regular scan mode, bounded by column descriptions, or to run in an unbounded scan mode.
Definition at line 61 of file FlatFileParser.cpp.
References bounded.
Referenced by FlatFileParser::scanRow().
00062 { 00063 return bounded; 00064 }
void FlatFileRowDescriptor::setMap | ( | VectorOfUint | map | ) | [inline] |
Sets a mapping from source column ordinal to target column ordinal.
If a source column does not appear in the target, it should be mapped to -1. If no source columns are present, all values will be -1. The behavior is undefined if two source columns map to the same target.
Definition at line 304 of file FlatFileParser.h.
Referenced by FlatFileExecStreamImpl::open().
00305 { 00306 columnMap = map; 00307 }
bool FlatFileRowDescriptor::isMapped | ( | ) | const [inline] |
Whether using a mapping from source to column ordinal.
Definition at line 312 of file FlatFileParser.h.
Referenced by FlatFileParser::scanRow().
00313 { 00314 return columnMap.size() > 0; 00315 }
int FlatFileRowDescriptor::getMap | ( | uint | iSource | ) | const [inline] |
Gets the mapping from source to target column.
Returns -1 if no mapping exists.
Definition at line 321 of file FlatFileParser.h.
Referenced by FlatFileParser::scanRow().
00322 { 00323 if (iSource >= columnMap.size()) { 00324 return -1; 00325 } 00326 return columnMap[iSource]; 00327 }
void FlatFileRowDescriptor::setLenient | ( | bool | lenientIn | ) | [inline] |
Definition at line 329 of file FlatFileParser.h.
Referenced by FlatFileExecStreamImpl::open(), and FlatFileExecStreamImpl::prepare().
00330 { 00331 lenient = lenientIn; 00332 }
bool FlatFileRowDescriptor::isLenient | ( | ) | const [inline] |
Definition at line 334 of file FlatFileParser.h.
Referenced by FlatFileParser::scanRow().
00335 { 00336 return lenient; 00337 }
uint FlatFileRowDescriptor::getMaxColumns | ( | ) | const [inline] |
Gets the expected number of columns to scan for this row.
If the scan is unbounded, then MAX_COLUMNS is returned. If there is a column mapping, the size of the map is returned. Otherwise the size of this descriptor is returned.
Definition at line 345 of file FlatFileParser.h.
Referenced by FlatFileParser::scanRow().
00346 { 00347 if (!bounded) { 00348 return MAX_COLUMNS; 00349 } else if (isMapped()) { 00350 return columnMap.size(); 00351 } else { 00352 return size(); 00353 } 00354 }
Gets the expected length of a column being scanned.
i | column index, before mapping |
Definition at line 361 of file FlatFileParser.h.
Referenced by FlatFileParser::scanRow().
00362 { 00363 uint realIndex = 0; 00364 if (!bounded) { 00365 return MAX_COLUMN_LENGTH; 00366 } else if (isMapped()) { 00367 realIndex = getMap(i); 00368 } else { 00369 realIndex = i; 00370 } 00371 if (realIndex < 0 || realIndex >= size()) { 00372 return MAX_COLUMN_LENGTH; 00373 } else { 00374 return (*this)[realIndex].maxLength; 00375 } 00376 }
bool FlatFileRowDescriptor::bounded [private] |
Definition at line 264 of file FlatFileParser.h.
Referenced by FlatFileRowDescriptor(), isBounded(), and setUnbounded().
bool FlatFileRowDescriptor::lenient [private] |
Definition at line 265 of file FlatFileParser.h.
VectorOfUint FlatFileRowDescriptor::columnMap [private] |
Definition at line 267 of file FlatFileParser.h.
const int FlatFileRowDescriptor::MAX_COLUMNS = 1024 [static] |
const int FlatFileRowDescriptor::MAX_COLUMN_LENGTH = 65535 [static] |
Maximum length of a column in an unbounded scan.
This is based on the default farrago maximum length.
Definition at line 279 of file FlatFileParser.h.