sx360::sxRecord Class Reference

#include <sxrecord.h>

Collaboration diagram for sx360::sxRecord:

Collaboration graph
[legend]
List of all members.


Public Member Functions

  sxRecord (int cardCount, int columnsPerCard, ByteMap *bmap)
virtual  ~sxRecord ()
bool  punched (int card, int col, char punch) const
int  columns (int card, int col, int size) const
string  columnValue (int card, int col) const
bool  punch (int card, int col, char punch) const
bool  punch (int card, int col, const char *punches) const
bool  punch (int card, int col, int size, int values) const
bool  fillPunch (int card, int col, char punch) const
char *  getRawData ()

sxRecord is a collection of cards that are grouped together as a stack of punch cards would be in the old days.  This is where all of the modification of data takes place.  Cards, columns, and punches are manipulated through the interface below.



Constructor & Destructor Documentation

sxRecord::sxRecord ( int  cardCount,


int  columnsPerCard,


ByteMap bmap  

)


Constructs an sxRecord with the specfied number of cards, the number of columns per card, and the ByteMap describing how the punches in the card are laid out.

sxRecord::~sxRecord (
 )  [virtual]

Destructor


Member Function Documentation

bool sxRecord::punched ( int  card,


int  col,


char  punch  

)

const

Returns true if the value at the specified card, column, punch is punched, else false is returned.

assuming that r is an sxRecord that is initialized

sxRecord* r;
return r->punched(5, 20, '3');

checks to see if punch 3 is punched on card 5 in column 20

int sxRecord::columns ( int  card,


int  col,


int  size  

)

const

Returns an integer value that combines multiple columns together to form a numeric value. All of the columns must be single punched and can only use the punches from 0-9 in order to guarantee accuracy.

Assuming that r is an sxRecord that is initialized

sxRecord* r;
int x = r->columns(4, 1, 5);

will return a 5 digit number with one punch in each column starting at 1 and ending at column 5.  However, if any columns between 1 and 5 have more than one punch per column or a nonnumeric punch, a 0 will be returned.

string sxRecord::columnValue ( int  card,


int  col  

)

const

Returns a string consisting of all punches in a column. 

Assuming that r is an initialized sxRecord;

sxRecord* r;
string s = r->columnValue(24, 6);

will return a string of every punched value on card 24 in column 6.

bool sxRecord::punch ( int  card,


int  col,


char  punch  

)

const

Punches the record at the card, column, and punch specified.  Returns true if successfully punched, or false if not successful.  A false will be returned if you specify a punch that is not in the ByteMap used to create the file. 

bool sxRecord::punch ( int  card,


int  col,


const char *  punches  

)

const

Punches all the punches specified by the punches parameter in the column for the card.  Returns true if all punches were punched, or false if not all punches could be punched.  It is important to note that if a bad punch is included with the good punches, that the good punches will be punched and false will still be returned.

sxRecord* r;
r->punch( 5, 50, "345Z");

will punch 3,4,5 on card 5, column 50, but it will return false because there is no punch Z.


bool sxRecord::punch ( int  card,


int  col,


int  size,


int  value  

)

const

Punches numeric punches across columns.  The integer specified in value is converted to a series of punches that match the number of columns specified in size.  Returns true if the value could be encoded as punches across the columns.

sxRecord* r;
r->punch( 4, 1, 3, 230);

will
punch 2 on card 4, column 1
punch 3 on card 4, column 2
punch 0 on card 4, column 3

bool sxRecord::fillPunch ( int  card,


int  col,


char  punch  

)

const

Fills in an existing punch.  If a punch is already not punched, this will have no effect.  Returns true if the punch to fill in was valid and able to be filled in.

char * sxRecord::getRawData (
 ) 

Returns the raw data that represents the record. Use this function with extreme caution, or not at all.


Generated on Fri Jul 27 14:54:02 2007 for sx360 by  doxygen 1.5.2