ByteArray Class Reference

#include <ByteArray.h>

Collaboration diagram for ByteArray:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ByteArray (int aRecLength)
 ByteArray (int aRecLength, int aNumRecords)
 ~ByteArray ()
 Destructor deletes the byte array.
int gobble (const std::string &aFileName)
 Gobble into memory, the entire contents of the named binary file.
void dump (const std::string &aFileName)
void markColumn (int aByte0)
void getNextWord (int aWordSize, char *aWordAry)
void putNextWord (int aWordSize, char *aWordAry)
int getNumRecords ()
 Return the number of records in the byte array.

Private Attributes

char * mBufferAry
int mNumRecords
 The number of records in the file.
int mRecLength
 The (user supplied) record length.
int mTotalSize
 The total size is in bytes.
int mNextByte
 Pointer to first byte on the current record for predetermined column.

Detailed Description

Class to encapsulate the basic properties of the byte content in a binary file. The term "word" is used a lot here. This is just a set of bytes corresponding to some data type (int, real, etc).


Constructor & Destructor Documentation

ByteArray::ByteArray ( int  aRecLength  ) 

Constructor - for gobbling

Parameters:
aRecLength length, in bytes, of an individual record
ByteArray::ByteArray ( int  aRecLength,
int  aNumRecords 
)

Constructor - for dumping

Parameters:
aRecLength length, in bytes, of an individual record
aNumRecords total number of records to be dumped into binary file

References mBufferAry, and mTotalSize.

ByteArray::~ByteArray (  ) 

Destructor deletes the byte array.

References mBufferAry.


Member Function Documentation

void ByteArray::dump ( const std::string &  aFileName  ) 

Dump the entire contents to the given file. If the filename already exists, the data will be appended.

References Logger::addMessage(), mBufferAry, mTotalSize, and StringOps::NumToString().

Referenced by SourceTable::writeAsBinary().

void ByteArray::getNextWord ( int  aWordSize,
char *  aWordAry 
)

Extract the word of the given size on the current record at the current position. After calling this, the object will point to the next record for the same column. This function is used like an iterator.

References mBufferAry, mNextByte, and mRecLength.

Referenced by DataChannel_SQL_float< DataType >::input(), DataChannel_SQL_real< DataType >::input(), DataChannel_SQL_bigint< DataType >::input(), DataChannel_SQL_int< DataType >::input(), DataChannel_SQL_smallint< DataType >::input(), and DataChannel_SQL_tinyint< DataType >::input().

int ByteArray::getNumRecords (  )  [inline]
int ByteArray::gobble ( const std::string &  aFileName  ) 

Gobble into memory, the entire contents of the named binary file.

References Logger::addMessage(), mBufferAry, mNumRecords, mRecLength, mTotalSize, and StringOps::NumToString().

Referenced by CameoSet::readCameoData().

void ByteArray::markColumn ( int  aByte0  )  [inline]

Set the byte number of the first byte on the record of a word (quantity) of interest. Note bytes are counted from 0.

References mNextByte.

Referenced by CameoSet::readCameoData(), and SourceTable::writeAsBinary().

void ByteArray::putNextWord ( int  aWordSize,
char *  aWordAry 
)

Member Data Documentation

char* ByteArray::mBufferAry [private]

The contents of given binary file will be stuffed in this array of bytes

Referenced by ByteArray(), dump(), getNextWord(), gobble(), putNextWord(), and ~ByteArray().

int ByteArray::mNextByte [private]

Pointer to first byte on the current record for predetermined column.

Referenced by getNextWord(), markColumn(), and putNextWord().

int ByteArray::mNumRecords [private]

The number of records in the file.

Referenced by getNumRecords(), and gobble().

int ByteArray::mRecLength [private]

The (user supplied) record length.

Referenced by getNextWord(), gobble(), and putNextWord().

int ByteArray::mTotalSize [private]

The total size is in bytes.

Referenced by ByteArray(), dump(), and gobble().


The documentation for this class was generated from the following files:
Generated on Mon Oct 4 10:39:20 2010 for WfcamSrc by  doxygen 1.6.3