RDB Class Reference

Provides interface for manipulating RDB tables. More...

#include <RDB.h>

Inheritance diagram for RDB:

Inheritance graph
[legend]
Collaboration diagram for RDB:

Collaboration graph
[legend]

List of all members.

Public Types

Enumerations for read/write/group return status.
enum  Status { REOF = 0x00, REOL = 0x01, REOG = 0x02, RBOG = 0x04 }
 Acceptable column justifications. More...

Public Member Functions

Constructing and destructing and initializing RDB objects.
 RDB (const string &name="", ios::openmode mode=ios::in) throw ( RDBErr )
 Attaches RDB object to a file.
 RDB (istream *isptr) throw ( RDBErr )
 Attaches RDB object to an istream.
 RDB (ostream *osptr) throw ( RDBErr )
 Attaches RDB object to an ostream.
 RDB (const RDB &rdb) throw ( RDBErr )
 Copies RDB object.
 ~RDB (void)
 Deletes resources allocated by the RDB object.
I/O related operations.
void open (const string &name, ios::openmode mode=ios::in) throw ( RDBErr )
 Attaches RDB object to a file.
void open (istream *isptr) throw ( RDBErr )
 Attaches RDB object to an istream.
void open (ostream *osptr) throw ( RDBErr )
 Attaches RDB object to an ostream.
void open (const RDB &rdb) throw ( RDBErr )
 Copies RDB object.
void close (void)
 Closes the stream attached to RDB object.
int read (void) throw ( RDBErr )
 Read a line of data from the istream.
bool write (void) throw ( RDBErr )
 Write a line of data to the ostream.
bool rewind (void) throw ( RDBErr )
 Rewind the stream to the beginning of the first row of data.
Auto-indexing related methods.
bool autoIdx (void) const
 Indicates if auto-indexing is activated.
void autoIdx (const bool on)
 Activates/deactivates auto-indexing.
void advanceIdx (void)
 Increments the indices in the RDBColumn data elements.
Column group manipulation (break columns)
void setGroup (const string &name, bool group=true) throw ( RDBErr )
 Turn on/off group status for the named column.
void setGroup (const int idx, bool group=true) throw ( RDBErr )
 Turn on/off group status for the indexed column.
bool getGroup (const string &name) throw ( RDBErr )
 Returns group status, true if its a new group, for the named column.
bool getGroup (const int idx) throw ( RDBErr )
 Returns group status, true if its a new group, for the indexed column.
bool newGroup (void)
 Checks if any column indicates a new group.
Comment accessors.
void setComment (const string &comm, const int idx=-1)
 Add RDBComment in header of RDB object.
void setComment (RDBComment &comm, const int idx=-1)
 Add or replace RDBComment in header of RDB object.
void setComment (RDBComment &comm, const string &name, const size_t idx=0)
 Add or replace RDBComment in header of RDB object.
void setComment (const RDB &rdb)
 Copy all comments from an existing RDB object.
RDBCommentgetComment (const size_t idx) throw ( RDBErr )
 Return RDBComment at given index.
RDBCommentgetComment (const string &name, const size_t idx=0) throw ( RDBErr )
 Return RDBComment with given keyword.
Column accessors.
void setColumn (const string &name, const string &def, const int idx=-1)
 Add an RDBColumn in RDB object.
void setColumn (RDBColumn *col, const int idx=-1)
 Add or replace RDBColumn in RDB object.
void setColumn (RDBColumn *col, const string &name, const size_t idx=0)
 Add of replace RDBColumn in RDB object.
void setColumn (const RDB &rdb)
 Copy all columns from an existing RDB object.
RDBColumngetColumn (const size_t idx) throw ( RDBErr )
 Return pointer to RDBColumn at given index.
RDBColumngetColumn (const string &name, const size_t idx=0) throw ( RDBErr )
 Return pointer to RDBColumn with given name.
Column index based accessors.
void setName (const size_t idx, const string &name) throw ( RDBErr )
 Modify the name of the RDBColumn at idx.
void setDef (const size_t idx, const string &def) throw ( RDBErr )
 Modify the definition of the RDBColumn at idx.
void setWidth (const size_t idx, const long width) throw ( RDBErr )
 Modify the width of the RDBColumn at idx.
void setType (const size_t idx, const RDBColumn::Type type) throw ( RDBErr )
 Modify the type of the RDBColumn at idx.
void setJust (const size_t idx, const RDBColumn::Just just) throw ( RDBErr )
 Modify the justification of the RDBColumn at idx.
void setDesc (const size_t idx, const string &desc) throw ( RDBErr )
 Modify the description of the RDBColumn at idx.
void mapData (const size_t idx, double data[], const size_t nelems=1) throw ( RDBErr )
 Map RDBColumn data to user-supplied memory.
void mapData (const size_t idx, long data[], const size_t nelems=1) throw ( RDBErr )
 Map RDBColumn data to user-supplied memory.
void mapData (const size_t idx, string data[], const size_t nelems=1) throw ( RDBErr )
 Map RDBColumn data to user-supplied memory.
void setData (const size_t idx, const double data) throw ( RDBErr )
 Sets the data value of RDBColumn, converting as necessary.
void setData (const size_t idx, const long data) throw ( RDBErr )
 Sets the data value of RDBColumn, converting as necessary.
void setData (const size_t idx, const string &data) throw ( RDBErr )
 Sets the data value of RDBColumn, converting as necessary.
void getName (const size_t idx, string &name) const throw ( RDBErr )
 Return the name of the RDBColumn at idx.
void getDef (const size_t idx, string &def) throw ( RDBErr )
 Return the definition of the RDBColumn at idx.
void getWidth (const size_t idx, long &width) const throw ( RDBErr )
 Return the width of the RDBColumn at idx.
void getType (const size_t idx, RDBColumn::Type &type) const throw ( RDBErr )
 Return the type of the RDBColumn at idx.
void getJust (const size_t idx, RDBColumn::Just &just) const throw ( RDBErr )
 Return the just of the RDBColumn at idx.
void getDesc (const size_t idx, string &desc) const throw ( RDBErr )
 Return the description of the RDBColumn at idx.
void getData (const size_t idx, double &data) throw ( RDBErr )
 Return the data of the RDBColumn at idx, converting if necessary.
void getData (const size_t idx, long &data) throw ( RDBErr )
 Return the data of the RDBColumn at idx, converting if necessary.
void getData (const size_t idx, string &data) throw ( RDBErr )
 Return the data of the RDBColumn at idx, converting if necessary.
string getName (const size_t idx) const throw ( RDBErr )
 Return the name of the RDBColumn at idx.
string getDef (const size_t idx) throw ( RDBErr )
 Return the definition of the RDBColumn at idx.
long getWidth (const size_t idx) const throw ( RDBErr )
 Return the width of the RDBColumn at idx.
RDBColumn::Type getType (const size_t idx) const throw ( RDBErr )
 Return the type of the RDBColumn at idx.
RDBColumn::Just getJust (const size_t idx) const throw ( RDBErr )
 Return the justification of the RDBColumn at idx.
string getDesc (const size_t idx) const throw ( RDBErr )
 Return the description of the RDBColumn at idx.
double getDataDouble (const size_t idx) throw ( RDBErr )
 Return the data of the RDBColumn at idx, converting if necessary.
long getDataLong (const size_t idx) throw ( RDBErr )
 Return the data of the RDBColumn at idx, converting if necessary.
string getDataString (const size_t idx) throw ( RDBErr )
 Return the data of the RDBColumn at idx, converting if necessary.
Column name based accessors.
void setName (const string &name, const string &newname) throw ( RDBErr )
 Modify the RDBColumn name.
void setDef (const string &name, const string &def) throw ( RDBErr )
 Modify the RDBColumn definition.
void setWidth (const string &name, const long width) throw ( RDBErr )
 Modify the RDBColumn width.
void setType (const string &name, const RDBColumn::Type type) throw ( RDBErr )
 Modify the RDBColumn type.
void setJust (const string &name, const RDBColumn::Just just) throw ( RDBErr )
 Modify the RDBColumn justification.
void setDesc (const string &name, const string &desc) throw ( RDBErr )
 Modify the RDBColumn description.
void mapData (const string &name, double data[], const size_t nelems=1) throw ( RDBErr )
 Map RDBColum data to user-supplied memory.
void mapData (const string &name, long data[], const size_t nelems=1) throw ( RDBErr )
 Map RDBColum data to user-supplied memory.
void mapData (const string &name, string data[], const size_t nelems=1) throw ( RDBErr )
 Map RDBColum data to user-supplied memory.
void setData (const string &name, const double data) throw ( RDBErr )
 Modify the RDBColumn data, converting if necessary.
void setData (const string &name, const long data) throw ( RDBErr )
 Modify the RDBColumn data, converting if necessary.
void setData (const string &name, const string &data) throw ( RDBErr )
 Modify the RDBColumn data, converting if necessary.
void getName (const string &name, string &namefound) const throw ( RDBErr )
 Return the name of the RDBColumn.
void getDef (const string &name, string &def) throw ( RDBErr )
 Return the definition of the RDBColumn.
void getWidth (const string &name, long &width) const throw ( RDBErr )
 Return the width of the RDBColumn.
void getType (const string &name, RDBColumn::Type &type) const throw ( RDBErr )
 Return the type of the RDBColumn.
void getJust (const string &name, RDBColumn::Just &just) const throw ( RDBErr )
 Return the justification of the RDBColumn.
void getDesc (const string &name, string &desc) const throw ( RDBErr )
 Return the description of the RDBColumn.
void getData (const string &name, double &data) throw ( RDBErr )
 Return the data of the RDBColumn, converting if necessary.
void getData (const string &name, long &data) throw ( RDBErr )
 Return the data of the RDBColumn, converting if necessary.
void getData (const string &name, string &data) throw ( RDBErr )
 Return the data of the RDBColumn, converting if necessary.
string getName (const string &name) const throw ( RDBErr )
 Return the name of the RDBColumn.
string getDef (const string &name) throw ( RDBErr )
 Return the definition of the RDBColumn.
long getWidth (const string &name) const throw ( RDBErr )
 Return the width of the RDBColumn.
RDBColumn::Type getType (const string &name) const throw ( RDBErr )
 Return the type of the RDBColumn.
RDBColumn::Just getJust (const string &name) const throw ( RDBErr )
 Return the justification of the RDBColumn.
string getDesc (const string &name) const throw ( RDBErr )
 Return the description of the RDBColumn.
double getDataDouble (const string &name) throw ( RDBErr )
 Return the data of the RDBColumn, converting if necessary.
long getDataLong (const string &name) throw ( RDBErr )
 Return the data of the RDBColumn, converting if necessary.
string getDataString (const string &name) throw ( RDBErr )
 Return the data of the RDBColumn, converting if necessary.
Table and header statistics.
size_t nComments (void) const
 Return number of comments in RDB object.
size_t nColumns (void) const
 Return number of columns in RDB object.
size_t nRows (void)
 Return number of rows in RDB object.

Protected Member Functions

void parseHeader (void) throw ( RDBErr )
 Parse header, i.e. comments and column names and definitions.
vector< string > parseLine (const string &line) const
 Parse fields in a row.
size_t parseLine (bool &newgroup) throw ( RDBErr )
 Parse fields in a row.

Protected Attributes

string _filename
 Name of RDB file.
ios::openmode _mode
 Open mode of the associated stream.
istream * _isptr
 Istream attached to data file.
ostream * _osptr
 Ostream attached to data file.
bool _myisptr
 Indicates if RDB object is responsible for deallocating the istream.
bool _myosptr
 Indicates if RDB object is responsible for deallocating the ostream.
size_t _rewindto
 Position of beginning of first row of data.
size_t _ncomms
 Number of comments.
size_t _ncols
 Number of columns.
size_t _nrows
 Number of rows.
bool _knowrows
 Indicates if associated file must be scanned to determine number of rows.
long _rownum
 Current *table* row number.
long _frownum
 Current *file* row number.
bool _autoidx
 Indicates if RDBColumn data elements should be advanced.
bool _firstread
 Indicates if this is the first call to RDB::read.
bool _lastread
 Indicates if this is the last call to RDB::read.
bool _writehdr
 Indicates if the header has been output.
RDBComment_comms
 Array of RDBComments.
RDBColumn ** _cols
 Array of RDBColumns.
RDBLongColumn _nrcol
 Hidden column, containing row number.
bool * _mycols
 Indicates if RDB object is responsible for deallocating given RDBColumn.
string _line
 Line from RDB table.

Friends

Stream insertion and extraction operators.
istream & operator>> (istream &is, RDB &rdb) throw ( RDBErr )
 Read table from input stream.
ostream & operator<< (ostream &os, RDB &rdb) throw ( RDBErr )
 Write table to output stream.


Detailed Description

Provides interface for manipulating RDB tables.

Definition at line 43 of file RDB.h.


Member Enumeration Documentation

Acceptable column justifications.

Definition at line 56 of file RDB.h.


Constructor & Destructor Documentation

RDB::RDB ( const string &  name = "",
ios::openmode  mode = ios::in 
) throw ( RDBErr )

Attaches RDB object to a file.

Parameters:
name the name of the RDB file.
mode the ios::openmode of the file.
Exceptions:
RDBErr error opening RDB file.
RDBErr error parsing RDB comment or column name and definition.
RDBErr error parsing RDB column definition.
Attaches RDB object's I/O stream to the file. If mode is set to ios::in, it calls RDB::parseHeader(void) to read comments, column names, and column definitions.

If no filename is specified, then the RDB::open() method may be used later to attach a file to the object.

Definition at line 118 of file RDB.cc.

RDB::RDB ( istream *  isptr  )  throw ( RDBErr )

Attaches RDB object to an istream.

Parameters:
isptr input stream to attach to the RDB object.
Exceptions:
RDBErr error parsing RDB comment or column name and definition.
RDBErr error parsing RDB column definition.
Attaches the istream to the RDB object. RDB::parseHeader(void) is called to read comments, column names, and column definitions.

Definition at line 164 of file RDB.cc.

RDB::RDB ( ostream *  osptr  )  throw ( RDBErr )

Attaches RDB object to an ostream.

Parameters:
osptr output stream to attach to the RDB object.
Attaches the ostream to the RDB object.

Definition at line 199 of file RDB.cc.

RDB::RDB ( const RDB rdb  )  throw ( RDBErr )

Copies RDB object.

Parameters:
rdb copy RDB object.
Makes a copy of the argument.

Definition at line 234 of file RDB.cc.

RDB::~RDB ( void   ) 

Deletes resources allocated by the RDB object.

Deletes RDBComments and RDBColumns. Closes only the streams the object opened. User is responsible for closing streams they supply to the object.

Warning:
If the user supplies an RDBColumn object via the RDB::setColumn() method, the user is responsible for deleting that object.

Definition at line 271 of file RDB.cc.

References _cols, _comms, _isptr, _mycols, _ncols, _osptr, and close().


Member Function Documentation

void RDB::open ( const string &  name,
ios::openmode  mode = ios::in 
) throw ( RDBErr )

Attaches RDB object to a file.

Parameters:
name the name of the RDB file.
mode the ios::openmode of the file.
Exceptions:
RDBErr error opening RDB file.
RDBErr error parsing RDB comment or column name and definition.
RDBErr error parsing RDB column definition.
Attaches RDB object's I/O stream to the file. If mode is set to ios::in, it calls RDB::parseHeader(void) to read comments, column names, and column definitions.

Warning:
This method closes any previously opened streams.

Definition at line 316 of file RDB.cc.

References _filename, _isptr, _mode, _myisptr, _myosptr, _osptr, close(), and parseHeader().

void RDB::open ( istream *  isptr  )  throw ( RDBErr )

Attaches RDB object to an istream.

Parameters:
isptr input stream to attach to the RDB object.
Exceptions:
RDBErr error parsing RDB comments or column names and definitions
RDBErr error parsing RDB column definition.
Attaches the istream to the RDB object. RDB::parseHeader(void) is called to read comments, column names, and column definitions.

Warning:
This method closes any previously opened streams.

Definition at line 400 of file RDB.cc.

References _filename, _isptr, _mode, close(), and parseHeader().

void RDB::open ( ostream *  osptr  )  throw ( RDBErr )

Attaches RDB object to an ostream.

Parameters:
osptr output stream to attach to the RDB object.
Attaches the ostream to the RDB object.

Warning:
This method closes any previously opened streams.

Definition at line 432 of file RDB.cc.

References _filename, _mode, _osptr, and close().

void RDB::open ( const RDB rdb  )  throw ( RDBErr )

Copies RDB object.

Parameters:
rdb copy RDB object.
Warning:
This method is currently not implemented.

Definition at line 451 of file RDB.cc.

References _filename, _isptr, _mode, _myisptr, _myosptr, _osptr, close(), and parseHeader().

void RDB::close ( void   ) 

Closes the stream attached to RDB object.

Closes any streams that the RDB object created.

Definition at line 526 of file RDB.cc.

References _autoidx, _cols, _comms, _filename, _isptr, _knowrows, _myisptr, _myosptr, _ncols, _ncomms, _nrows, _osptr, _rewindto, _rownum, _writehdr, RDBColumn::getDef(), getDef(), RDBColumn::getName(), and getName().

Referenced by open(), and ~RDB().

int RDB::read ( void   )  throw ( RDBErr )

Read a line of data from the istream.

Exceptions:
RDBErr error if the number of tokens found does not match the number of tokens expected.
RDBErr error if non-numeric data is found in a numeric column.
RDBErr error if a floating point number is being assigned to an integer column.
S *
Returns:
RDB::Status indicating if end of file, end of line, or end of group was reached.
Reads, parses, and stores data from the next line in the RDB file is an input stream has been provided. If RDB::_autoidx is set, this method will advance the indices in each RDBColumn's data pointer before reading and will increment the row number, RDB::_rownum, for the default `_NR' column.

Definition at line 589 of file RDB.cc.

References _autoidx, _cols, _filename, _firstread, _isptr, _lastread, _line, _mode, _ncols, _rownum, advanceIdx(), RDBColumn::advanceIdx(), RDBColumn::newGroup(), and RDBColumn::setData().

Referenced by simpleRDBTable< Type >::readRow().

bool RDB::write ( void   )  throw ( RDBErr )

Write a line of data to the ostream.

Returns:
false if EOF or if the ostream is bad.
Writes the next line of data to the RDB file, if an output stream has been provided. If the RDB header has not been written yet, it outputs the comments, column names and column definitions. If RDB::_autoidx is set, it will advance the indices in the RDBColumn's data pointer before reading and will increment the row number, RDB::_rownum, for the default `_NR' column.

After a successful write, the RDB::_autoidx flag is set to true.

Definition at line 712 of file RDB.cc.

References _autoidx, _cols, _comms, _mode, _ncols, _ncomms, _osptr, _rewindto, _rownum, _writehdr, advanceIdx(), RDBColumn::getDef(), getDef(), RDBColumn::getName(), and getName().

bool RDB::rewind ( void   )  throw ( RDBErr )

Rewind the stream to the beginning of the first row of data.

Returns:
false if the stream associated with this RDB object cannot be rewound, i.e seekg() or seekp() is not defined.
Rewinds the stream associate with this object to the beginning of the first row of data. It also calls RDBColumn::rewind(void) for each RDBColumn. If the user supplied data storage to a particular column, the auto-incrementing index is rewound to point at the first element of the user supplied array.

Warning:
If an istream or ostream, like cin or cout, was provided to the object, you only get one chance to read it. You can't rewind, you can't close and reopen.

Definition at line 772 of file RDB.cc.

References _cols, _isptr, _mode, _ncols, _osptr, _rewindto, _rownum, and RDBColumn::rewind().

bool RDB::autoIdx ( void   )  const

Indicates if auto-indexing is activated.

Returns:
State of the auto-indexing flag for this object.

Definition at line 843 of file RDB.cc.

References _autoidx.

void RDB::autoIdx ( const bool  on  ) 

Activates/deactivates auto-indexing.

Parameters:
on sets the auto-indexing behavior for the RDB object and its columns.
Sets RDBTable::_autoidx. This effectly turns off the auto-incrementing behavior for a single call to RDB::read(void) or RDB::write(void). For arrays of mapped memory, this will cause one line's data to overwrite the previous line's data.

Warning:
RDB::_autoidx is set to true after each call to RDB::read(void) or RDB::write(void).

Definition at line 830 of file RDB.cc.

References _autoidx.

void RDB::advanceIdx ( void   ) 

Increments the indices in the RDBColumn data elements.

This method advances the auto-indices for all RDBColumns associated with this object.

Definition at line 857 of file RDB.cc.

References _cols, _ncols, _nrcol, RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::advanceIdx(), and RDBColumn::advanceIdx().

Referenced by read(), and write().

void RDB::setGroup ( const string &  name,
bool  group = true 
) throw ( RDBErr )

Turn on/off group status for the named column.

Parameters:
group a bool indicating whether group is on or off.
name the name of the column in this RDB object.
Exceptions:
RDBEr error if there is no column with matching name.

Definition at line 878 of file RDB.cc.

References _autoidx, _cols, _filename, _ncols, _nrcol, getName(), RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::setGroup(), and RDBColumn::setGroup().

void RDB::setGroup ( const int  idx,
bool  group = true 
) throw ( RDBErr )

Turn on/off group status for the indexed column.

Parameters:
group a bool indicating whether group is on or off.
idx the position of the column on which to operate.
Exceptions:
RDBErr error if there is no column with matching name.

Definition at line 911 of file RDB.cc.

References _autoidx, _cols, _filename, _ncols, and RDBColumn::setGroup().

bool RDB::getGroup ( const string &  name  )  throw ( RDBErr )

Returns group status, true if its a new group, for the named column.

Parameters:
name the name of the column.
Exceptions:
RDBErrNotFnd error if there is no column with matching name.
Returns:
Status of the column's group flag.

Definition at line 938 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, RDBColumn::getGroup(), and getName().

bool RDB::getGroup ( const int  idx  )  throw ( RDBErr )

Returns group status, true if its a new group, for the indexed column.

Parameters:
idx the column index.
Exceptions:
RDBErr error if the index is out of range.
Returns:
Status of the column's group flag.

Definition at line 967 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::getGroup().

bool RDB::newGroup ( void   ) 

Checks if any column indicates a new group.

Returns:
True if any column indicates a new group, false otherwise.
A new group occurs when the data values between consecutive rows change.

Definition at line 989 of file RDB.cc.

References _cols, and _ncols.

Referenced by parseLine().

void RDB::setComment ( const string &  comm,
const int  idx = -1 
)

Add RDBComment in header of RDB object.

Parameters:
comm a comment string.
idx the position of the comment on which to operate.
Comments are numbered as they appear in the RDB file from top to bottom. If the index is not specified or does not fall within the range of existing comments, the RDBComment is appended to the list of comments.

Definition at line 1015 of file RDB.cc.

References _comms, and _ncomms.

Referenced by parseHeader(), and setComment().

void RDB::setComment ( RDBComment comm,
const int  idx = -1 
)

Add or replace RDBComment in header of RDB object.

Parameters:
comm a reference to the RDBComment object
idx the position of the comment on which to operate.
Comments are numbered as they appear in the RDB file from top to bottom. If the index is not specified or does not fall within the range of existing comments, the RDBComment is appended to the list of comments.

Definition at line 1053 of file RDB.cc.

References _comms, and _ncomms.

void RDB::setComment ( RDBComment comm,
const string &  name,
const size_t  idx = 0 
)

Add or replace RDBComment in header of RDB object.

Parameters:
comm a reference to the RDBComment object
name the name of the comment keyword.
idx currently not defined.
If no matching comment keyword is found, the comment is appended to the list of comments. Otherwise, comm replaces the existing comment.

Definition at line 1090 of file RDB.cc.

References _comms, _ncomms, and setComment().

void RDB::setComment ( const RDB rdb  ) 

Copy all comments from an existing RDB object.

Parameters:
rdb a reference to an RDB object
Copies all comments from the argument to this RDB object. Any comments previously associated with this object are removed.

Definition at line 1116 of file RDB.cc.

References _comms, and _ncomms.

RDBComment & RDB::getComment ( const size_t  idx  )  throw ( RDBErr )

Return RDBComment at given index.

Parameters:
idx the index of the RDBComment.
Exceptions:
RDBErrNot error if the index is out of range.
Returns:
RDBComment with index equal to idx.
RDBComments are indexed in the order in which they appear in the RDB file starting with 0. Parameter idx must be between 0 and RDB::nComments(void) less one.

Definition at line 1148 of file RDB.cc.

References _comms, _filename, and _ncomms.

RDBComment & RDB::getComment ( const string &  name,
const size_t  idx = 0 
) throw ( RDBErr )

Return RDBComment with given keyword.

Parameters:
name the name of the comment keyword.
idx currently not defined.
Exceptions:
RDBErr error if there is no comment with matching keyword.
Returns:
RDBComment with matching keyword.

Definition at line 1173 of file RDB.cc.

References _comms, _filename, and _ncomms.

void RDB::setColumn ( const string &  name,
const string &  def,
const int  idx = -1 
)

Add an RDBColumn in RDB object.

Parameters:
name of the RDBColumn object
def definition of the RDBColumn object
idx the position of the column on which to operate.
Columns are numbered as they appear in the RDB file from left to right starting with 0. If the index is not specified or does not fall within the range of existing columns, an RDBColumn is created and is appended to the list of columns. The RDB object handles memory allocation and deletion.

Upon completion, the RDB object contains a pointer to the RDBColumn created. Any modifications to the RDBColumn outside of the RDB object will be reflected within the RDB object and vice versa.

Definition at line 1208 of file RDB.cc.

References _cols, _mycols, _ncols, RDBColumn::setDef(), and RDBColumn::setName().

Referenced by setColumn().

void RDB::setColumn ( RDBColumn col,
const int  idx = -1 
)

Add or replace RDBColumn in RDB object.

Parameters:
col a reference to the RDBColumn object
idx the position of the column on which to operate.
Columns are numbered as they appear in the RDB file from left to right starting with 0. If the index is not specified or does not fall within the range of existing columns, the RDBColumn is appended to the list of columns.

Upon completion, the RDB object contains a pointer to the RDBColumn provided. Any modifications to the RDBColumn outside of the RDB object will be reflected within the RDB object and vice versa.

Warning:
The user is responsible for freeing the RDBColumn.

Definition at line 1274 of file RDB.cc.

References _cols, _mycols, and _ncols.

void RDB::setColumn ( RDBColumn col,
const string &  name,
const size_t  idx = 0 
)

Add of replace RDBColumn in RDB object.

Parameters:
col a reference to the RDBColumn object
name the name of the column in this RDB object.
idx currently not defined.
If no matching column is found, the column is appended to the list of columns after assigning it a name of 'name'. Otherwise, col replaces the existing column.

Upon completion, the RDB object contains a pointer to the RDBColumn provided. Any modifications to the RDBColumn outside of the RDB object will be reflected within the RDB object and vice versa.

Warning:
The user is responsible for freeing the RDBColumn.

Definition at line 1331 of file RDB.cc.

References _cols, _mycols, _ncols, getName(), setColumn(), and RDBColumn::setName().

void RDB::setColumn ( const RDB rdb  ) 

Copy all columns from an existing RDB object.

Parameters:
rdb a reference to an RDB object
Copies all columns from the argument to this RDB object. Any columns previously associated with this object are removed.

Warning:
The user is responsible for free any RDBColumns previously allocated and assigned to this RDB object via the RDB::setColumn methods.

Definition at line 1368 of file RDB.cc.

References _cols, _mycols, and _ncols.

RDBColumn * RDB::getColumn ( const size_t  idx  )  throw ( RDBErr )

Return pointer to RDBColumn at given index.

Parameters:
idx the index of the RDBColumn.
Exceptions:
RDBErr error if the index is out of range.
Returns:
RDBColumn with index equal to idx.
RDBColumns are indexed in the order in which they appear in the RDB file starting with 0. Parameter idx must be between 0 and RDB::nColumns(void) less one.

Definition at line 1433 of file RDB.cc.

References _cols, _filename, and _ncols.

RDBColumn * RDB::getColumn ( const string &  name,
const size_t  idx = 0 
) throw ( RDBErr )

Return pointer to RDBColumn with given name.

Parameters:
name the name of the column.
idx currently not defined.
Exceptions:
RDBErrNotFnd error if there is no column with matching name.
Returns:
RDBColumn with matching name.

Definition at line 1458 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, and getName().

void RDB::setName ( const size_t  idx,
const string &  name 
) throw ( RDBErr )

Modify the name of the RDBColumn at idx.

Parameters:
idx index of RDBColumn.
name to assign to RDBColumn at idx.
Exceptions:
RDBErr if index is out of range.

Definition at line 1488 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::setName().

void RDB::setDef ( const size_t  idx,
const string &  def 
) throw ( RDBErr )

Modify the definition of the RDBColumn at idx.

Parameters:
idx index of RDBColumn.
def RDBColumn definition.
Exceptions:
RDBErr if index is out of range.
RDBErr if def is invalid RDBColumn definition.

Definition at line 1509 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::setDef().

void RDB::setWidth ( const size_t  idx,
const long  width 
) throw ( RDBErr )

Modify the width of the RDBColumn at idx.

Parameters:
idx index of RDBColumn.
width RDBColumn width.
Exceptions:
RDBErr if index is out of range.
RDBErr if width is invalid RDBColumn width.

Definition at line 1537 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::setWidth().

void RDB::setType ( const size_t  idx,
const RDBColumn::Type  type 
) throw ( RDBErr )

Modify the type of the RDBColumn at idx.

Parameters:
idx index of RDBColumn.
type RDBColumn type.
Exceptions:
RDBErr if index is out of range.
RDBErr if type is invalid RDBColumn type.

Definition at line 1565 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::setType().

void RDB::setJust ( const size_t  idx,
const RDBColumn::Just  just 
) throw ( RDBErr )

Modify the justification of the RDBColumn at idx.

Parameters:
idx index of RDBColumn.
just RDBColumn justification.
Exceptions:
RDBErr if index is out of range.
RDBErr if just is invalid RDBColumn justification.

Definition at line 1593 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::setJust().

void RDB::setDesc ( const size_t  idx,
const string &  desc 
) throw ( RDBErr )

Modify the description of the RDBColumn at idx.

Parameters:
idx index of RDBColumn.
desc RDBColumn description.
Exceptions:
RDBErr if index is out of range.
RDBErr if desc is invalid RDBColumn description.

Definition at line 1621 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::setDesc().

void RDB::mapData ( const size_t  idx,
double  data[],
const size_t  nelems = 1 
) throw ( RDBErr )

Map RDBColumn data to user-supplied memory.

Parameters:
idx index of RDBColumn.
data user-supplied memory for storing data.
nelems number of elements in user-supplied data.
Exceptions:
RDBErr if index is out of range.
RDBErr if data is invalid datatype for RDBColumn.

Definition at line 1650 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::mapData().

void RDB::mapData ( const size_t  idx,
long  data[],
const size_t  nelems = 1 
) throw ( RDBErr )

Map RDBColumn data to user-supplied memory.

Parameters:
idx index of RDBColumn.
data user-supplied memorgy to stored data.
nelems number of elems in user-supplied memory.
Exceptions:
RDBErr if index is out of range.
RDBErr if data is invalid datatype for RDBColumn.

Definition at line 1678 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::mapData().

void RDB::mapData ( const size_t  idx,
string  data[],
const size_t  nelems = 1 
) throw ( RDBErr )

Map RDBColumn data to user-supplied memory.

Parameters:
idx index of RDBColumn.
data user-supplied memory to store data.
nelems number of elements in user-supplied data.
Exceptions:
RDBErr if index is out of range.
RDBErr if data is invalid datatype for RDBColumn.

Definition at line 1707 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::mapData().

void RDB::setData ( const size_t  idx,
const double  data 
) throw ( RDBErr )

Sets the data value of RDBColumn, converting as necessary.

Parameters:
idx index of RDBColumn.
data value to assign to RDBColumn data.
Exceptions:
RDBErr if index is out of range.
RDBErr if data is invalid for RDBColumn.

Definition at line 1735 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::setData().

void RDB::setData ( const size_t  idx,
const long  data 
) throw ( RDBErr )

Sets the data value of RDBColumn, converting as necessary.

Parameters:
idx index of RDBColumn.
data value to assign to RDBColumn data.
Exceptions:
RDBErr if index is out of range.
RDBErr if data is invalid for RDBColumn.

Definition at line 1763 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::setData().

void RDB::setData ( const size_t  idx,
const string &  data 
) throw ( RDBErr )

Sets the data value of RDBColumn, converting as necessary.

Parameters:
idx index of RDBColumn/
data value to assign RDBColumn data.
Exceptions:
RDBErr if index is out of range.
RDBErr if data is invalid for RDBColumn.

Definition at line 1791 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::setData().

void RDB::getName ( const size_t  idx,
string &  name 
) const throw ( RDBErr )

Return the name of the RDBColumn at idx.

Parameters:
idx index of RDBColumn.
name retrieve name of RDBColumn.
Exceptions:
RDBErr if index is out of range.

Definition at line 1818 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::getName().

Referenced by close(), getColumn(), getData(), getDataDouble(), getDataLong(), getDataString(), getDef(), getDesc(), getGroup(), getJust(), getName(), getType(), getWidth(), mapData(), setColumn(), setData(), setDef(), setDesc(), setGroup(), setJust(), setName(), setType(), setWidth(), and write().

void RDB::getDef ( const size_t  idx,
string &  def 
) throw ( RDBErr )

Return the definition of the RDBColumn at idx.

Parameters:
idx index of RDBColumn.
def retrieve definition of RDBColumn.
Exceptions:
RDBErr if index is out of range.

Definition at line 1837 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::getDef().

Referenced by close(), and write().

void RDB::getWidth ( const size_t  idx,
long &  width 
) const throw ( RDBErr )

Return the width of the RDBColumn at idx.

Parameters:
idx index of RDBColumn.
width retrieve width of RDBColumn.
Exceptions:
RDBErr if index is out of range.

Definition at line 1856 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::getWidth().

void RDB::getType ( const size_t  idx,
RDBColumn::Type type 
) const throw ( RDBErr )

Return the type of the RDBColumn at idx.

Parameters:
idx index of RDBColumn.
type retrieve type of RDBColumn.
Exceptions:
RDBErr if index is out of range.

Definition at line 1875 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::getType().

void RDB::getJust ( const size_t  idx,
RDBColumn::Just just 
) const throw ( RDBErr )

Return the just of the RDBColumn at idx.

Parameters:
idx index of RDBColumn
just retrieve just of RDBColumn.
Exceptions:
RDBErr if index is out of range.

Definition at line 1894 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::getJust().

void RDB::getDesc ( const size_t  idx,
string &  desc 
) const throw ( RDBErr )

Return the description of the RDBColumn at idx.

Parameters:
idx index of RDBColumn
desc retrieve description of RDBColumn.
Exceptions:
RDBErr if index is out of range.

Definition at line 1913 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::getDesc().

void RDB::getData ( const size_t  idx,
double &  data 
) throw ( RDBErr )

Return the data of the RDBColumn at idx, converting if necessary.

Parameters:
idx index of RDBColumn
data retrieve data of RDBColumn.
Exceptions:
RDBErr if index is out of range.
RDBErr if data is invalid datatype for RDBColumn.

Definition at line 1933 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::getDataDouble().

void RDB::getData ( const size_t  idx,
long &  data 
) throw ( RDBErr )

Return the data of the RDBColumn at idx, converting if necessary.

Parameters:
idx index of RDBColumn
data retrieve data of RDBColumn.
Exceptions:
RDBErr if index is out of range.
RDBErr if data is invalid datatype for RDBColumn.

Definition at line 1961 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::getDataLong().

void RDB::getData ( const size_t  idx,
string &  data 
) throw ( RDBErr )

Return the data of the RDBColumn at idx, converting if necessary.

Parameters:
idx index of RDBColumn
data retrieve data of RDBColumn.
Exceptions:
RDBErr if index is out of range.
RDBErr if data is invalid datatype for RDBColumn.

Definition at line 1989 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::getDataString().

string RDB::getName ( const size_t  idx  )  const throw ( RDBErr )

Return the name of the RDBColumn at idx.

Parameters:
idx index of RDBColumn
Exceptions:
RDBErr if index is out of range.
Returns:
name of RDBColumn.

Definition at line 2017 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::getName().

string RDB::getDef ( const size_t  idx  )  throw ( RDBErr )

Return the definition of the RDBColumn at idx.

Parameters:
idx index of RDBColumn
Exceptions:
RDBErr if index is out of range.
Returns:
definition of RDBColumn.

Definition at line 2037 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::getDef().

long RDB::getWidth ( const size_t  idx  )  const throw ( RDBErr )

Return the width of the RDBColumn at idx.

Parameters:
idx index of RDBColumn
Exceptions:
RDBErr if index is out of range.
Returns:
width of RDBColumn.

Definition at line 2057 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::getWidth().

RDBColumn::Type RDB::getType ( const size_t  idx  )  const throw ( RDBErr )

Return the type of the RDBColumn at idx.

Parameters:
idx index of RDBColumn
Exceptions:
RDBErr if index is out of range.
Returns:
type of RDBColumn.

Definition at line 2077 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::getType().

RDBColumn::Just RDB::getJust ( const size_t  idx  )  const throw ( RDBErr )

Return the justification of the RDBColumn at idx.

Parameters:
idx index of RDBColumn
Exceptions:
RDBErr if index is out of range.
Returns:
justification of RDBColumn.

Definition at line 2097 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::getJust().

string RDB::getDesc ( const size_t  idx  )  const throw ( RDBErr )

Return the description of the RDBColumn at idx.

Parameters:
idx index of RDBColumn
Exceptions:
RDBErr if index is out of range.
Returns:
description of RDBColumn.

Definition at line 2117 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::getDesc().

double RDB::getDataDouble ( const size_t  idx  )  throw ( RDBErr )

Return the data of the RDBColumn at idx, converting if necessary.

Parameters:
idx index of RDBColumn
Exceptions:
RDBErr if index is out of range.
RDBErr if data is invalid datatype for RDBColumn.
Returns:
data of RDBColumn.

Definition at line 2138 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::getDataDouble().

long RDB::getDataLong ( const size_t  idx  )  throw ( RDBErr )

Return the data of the RDBColumn at idx, converting if necessary.

Parameters:
idx index of RDBColumn
Exceptions:
RDBErr if index is out of range.
RDBErr if data is invalid datatype for RDBColumn.
Returns:
Data of RDBColumn.

Definition at line 2167 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::getDataLong().

string RDB::getDataString ( const size_t  idx  )  throw ( RDBErr )

Return the data of the RDBColumn at idx, converting if necessary.

Parameters:
idx index of RDBColumn
Exceptions:
RDBErr if index is out of range.
RDBErr if data is invalid datatype for RDBColumn.
Returns:
data of RDBColumn.

Definition at line 2196 of file RDB.cc.

References _cols, _filename, _ncols, and RDBColumn::getDataString().

void RDB::setName ( const string &  name,
const string &  newname 
) throw ( RDBErr )

Modify the RDBColumn name.

Parameters:
name of RDBColumn
newname new name of RDBColumn.
Exceptions:
RDBErr if no matching column name is found.
RDBErr if newname is invalid name for RDBColumn.

Definition at line 2224 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, getName(), and RDBColumn::setName().

void RDB::setDef ( const string &  name,
const string &  def 
) throw ( RDBErr )

Modify the RDBColumn definition.

Parameters:
name of RDBColumn
def definition of RDBColumn.
Exceptions:
RDBErr if no matching column name is found.
RDBErr if def is invalid definition for RDBColumn.

Definition at line 2250 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, getName(), and RDBColumn::setDef().

void RDB::setWidth ( const string &  name,
const long  width 
) throw ( RDBErr )

Modify the RDBColumn width.

Parameters:
name of RDBColumn
width width of RDBColumn.
Exceptions:
RDBErr if no matching column name is found.
RDBErr if width is invalid width for RDBColumn.

Definition at line 2285 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, getName(), and RDBColumn::setWidth().

void RDB::setType ( const string &  name,
const RDBColumn::Type  type 
) throw ( RDBErr )

Modify the RDBColumn type.

Parameters:
name of RDBColumn
type type of RDBColumn.
Exceptions:
RDBErr if no matching column name is found.
RDBErr if type is invalid type for RDBColumn.

Definition at line 2320 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, getName(), and RDBColumn::setType().

void RDB::setJust ( const string &  name,
const RDBColumn::Just  just 
) throw ( RDBErr )

Modify the RDBColumn justification.

Parameters:
name of RDBColumn
just justification of RDBColumn.
Exceptions:
RDBErr if no matching column name is found.
RDBErr if just is invalid justification for RDBColumn.

Definition at line 2355 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, getName(), and RDBColumn::setJust().

void RDB::setDesc ( const string &  name,
const string &  desc 
) throw ( RDBErr )

Modify the RDBColumn description.

Parameters:
name of RDBColumn
desc description of RDBColumn.
Exceptions:
RDBErr if no matching column name is found.
RDBErr if desc is invalid description for RDBColumn.

Definition at line 2390 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, getName(), and RDBColumn::setDesc().

void RDB::mapData ( const string &  name,
double  data[],
const size_t  nelems = 1 
) throw ( RDBErr )

Map RDBColum data to user-supplied memory.

Parameters:
name of RDBColumn
data user-supplied memory to store RDBColumn data.
nelems number of elems in user-supplied memory.
Exceptions:
RDBErr if no matching column name is found.
RDBErr if data is invalid datatype for RDBColumn.

Definition at line 2426 of file RDB.cc.

References _cols, _filename, _ncols, getName(), and RDBColumn::mapData().

void RDB::mapData ( const string &  name,
long  data[],
const size_t  nelems = 1 
) throw ( RDBErr )

Map RDBColum data to user-supplied memory.

Parameters:
name of RDBColumn
data user-supplied memory to store RDBColumn data.
nelems number of elems in user-supplied memory.
Exceptions:
RDBErr if no matching column name is found.
RDBErr if data is invalid datatype for RDBColumn.

Definition at line 2462 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, getName(), RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::mapData(), and RDBColumn::mapData().

void RDB::mapData ( const string &  name,
string  data[],
const size_t  nelems = 1 
) throw ( RDBErr )

Map RDBColum data to user-supplied memory.

Parameters:
name of RDBColumn
data user-supplied memory to store RDBColumn data.
nelems number of elems in user-supplied memory.
Exceptions:
RDBErr if no matching column name is found.
RDBErr if data is invalid datatype for RDBColumn.

Definition at line 2499 of file RDB.cc.

References _cols, _filename, _ncols, getName(), and RDBColumn::mapData().

void RDB::setData ( const string &  name,
const double  data 
) throw ( RDBErr )

Modify the RDBColumn data, converting if necessary.

Parameters:
name of RDBColumn
data value to assign RDBColumn data.
Exceptions:
RDBErr if no matching column name is found.
RDBErr if data is invalid datatype for RDBColumn.

Definition at line 2534 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, getName(), RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::setData(), and RDBColumn::setData().

void RDB::setData ( const string &  name,
const long  data 
) throw ( RDBErr )

Modify the RDBColumn data, converting if necessary.

Parameters:
name of RDBColumn
data value to assign RDBColumn data.
Exceptions:
RDBErr if no matching column name is found.
RDBErr if data is invalid datatype for RDBColumn.

Definition at line 2567 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, getName(), RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::setData(), and RDBColumn::setData().

void RDB::setData ( const string &  name,
const string &  data 
) throw ( RDBErr )

Modify the RDBColumn data, converting if necessary.

Parameters:
name of RDBColumn
data value to assign RDBColumn data.
Exceptions:
RDBErr if no matching column name is found.
RDBErr if data is invalid datatype for RDBColumn.

Definition at line 2600 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, getName(), RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::setData(), and RDBColumn::setData().

void RDB::getName ( const string &  name,
string &  namefound 
) const throw ( RDBErr )

Return the name of the RDBColumn.

Parameters:
name of RDBColumn
namefound name of RDBColumn if found.
Exceptions:
RDBErr if no matching column name is found.

Definition at line 2633 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, RDBColumn::getName(), and getName().

void RDB::getDef ( const string &  name,
string &  def 
) throw ( RDBErr )

Return the definition of the RDBColumn.

Parameters:
name of RDBColumn
def definition of RDBColumn.
Exceptions:
RDBErr if no matching column name is found.

Definition at line 2657 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, RDBColumn::getDef(), and getName().

void RDB::getWidth ( const string &  name,
long &  width 
) const throw ( RDBErr )

Return the width of the RDBColumn.

Parameters:
name of RDBColumn
width width of RDBColumn.
Exceptions:
RDBErr if no matching column name is found.

Definition at line 2681 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, getName(), and RDBColumn::getWidth().

void RDB::getType ( const string &  name,
RDBColumn::Type type 
) const throw ( RDBErr )

Return the type of the RDBColumn.

Parameters:
name of RDBColumn
type type of RDBColumn.
Exceptions:
RDBErr if no matching column name is found.

Definition at line 2705 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, getName(), and RDBColumn::getType().

void RDB::getJust ( const string &  name,
RDBColumn::Just just 
) const throw ( RDBErr )

Return the justification of the RDBColumn.

Parameters:
name of RDBColumn
just justification of RDBColumn.
Exceptions:
RDBErr if no matching column name is found.

Definition at line 2729 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, RDBColumn::getJust(), and getName().

void RDB::getDesc ( const string &  name,
string &  desc 
) const throw ( RDBErr )

Return the description of the RDBColumn.

Parameters:
name of RDBColumn
desc description of RDBColumn.
Exceptions:
RDBErr if no matching column name is found.

Definition at line 2753 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, RDBColumn::getDesc(), and getName().

void RDB::getData ( const string &  name,
double &  data 
) throw ( RDBErr )

Return the data of the RDBColumn, converting if necessary.

Parameters:
name of RDBColumn
data data of RDBColumn.
Exceptions:
RDBErr if no matching column name is found.
RDBErr if data is invalid datatype for RDBColumn.

Definition at line 2778 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::getDataDouble(), RDBColumn::getDataDouble(), and getName().

void RDB::getData ( const string &  name,
long &  data 
) throw ( RDBErr )

Return the data of the RDBColumn, converting if necessary.

Parameters:
name of RDBColumn
data data of RDBColumn.
Exceptions:
RDBErr if no matching column name is found.
RDBErr if data is invalid datatype for RDBColumn.

Definition at line 2812 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::getDataLong(), RDBColumn::getDataLong(), and getName().

void RDB::getData ( const string &  name,
string &  data 
) throw ( RDBErr )

Return the data of the RDBColumn, converting if necessary.

Parameters:
name of RDBColumn
data data of RDBColumn.
Exceptions:
RDBErr if data is invalid datatype for RDBColumn.
RDBErr if no matching column name is found.

Definition at line 2846 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::getDataString(), RDBColumn::getDataString(), and getName().

string RDB::getName ( const string &  name  )  const throw ( RDBErr )

Return the name of the RDBColumn.

Parameters:
name of RDBColumn
Exceptions:
RDBErr if no matching column name is found.
Returns:
name of RDBColumn.

Definition at line 2880 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, RDBColumn::getName(), and getName().

string RDB::getDef ( const string &  name  )  throw ( RDBErr )

Return the definition of the RDBColumn.

Parameters:
name of RDBColumn
Exceptions:
RDBErr if no matching column name is found.
Returns:
definition of RDBColumn.

Definition at line 2904 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, RDBColumn::getDef(), and getName().

long RDB::getWidth ( const string &  name  )  const throw ( RDBErr )

Return the width of the RDBColumn.

Parameters:
name of RDBColumn
Exceptions:
RDBErr if no matching column name is found.
Returns:
width of RDBColumn.

Definition at line 2928 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, getName(), and RDBColumn::getWidth().

RDBColumn::Type RDB::getType ( const string &  name  )  const throw ( RDBErr )

Return the type of the RDBColumn.

Parameters:
name of RDBColumn
Exceptions:
RDBErr if no matching column name is found.
Returns:
type of RDBColumn.

Definition at line 2952 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, getName(), and RDBColumn::getType().

RDBColumn::Just RDB::getJust ( const string &  name  )  const throw ( RDBErr )

Return the justification of the RDBColumn.

Parameters:
name of RDBColumn
Exceptions:
RDBErr if no matching column name is found.
Returns:
justification of RDBColumn.

Definition at line 2976 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, RDBColumn::getJust(), and getName().

string RDB::getDesc ( const string &  name  )  const throw ( RDBErr )

Return the description of the RDBColumn.

Parameters:
name of RDBColumn
Exceptions:
RDBErr if no matching column name is found.
Returns:
description of RDBColumn.

Definition at line 3000 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, RDBColumn::getDesc(), and getName().

double RDB::getDataDouble ( const string &  name  )  throw ( RDBErr )

Return the data of the RDBColumn, converting if necessary.

Parameters:
name of RDBColumn
Exceptions:
RDBErr if no matching column name is found.
RDBErr if data is invalid datatype for RDBColumn.
Returns:
data of RDBColumn.

Definition at line 3025 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::getDataDouble(), RDBColumn::getDataDouble(), and getName().

long RDB::getDataLong ( const string &  name  )  throw ( RDBErr )

Return the data of the RDBColumn, converting if necessary.

Parameters:
name of RDBColumn
Exceptions:
RDBErr if no matching column name is found.
RDBErr if data is invalid datatype for RDBColumn.
Returns:
data of RDBColumn.

Definition at line 3058 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::getDataLong(), RDBColumn::getDataLong(), and getName().

string RDB::getDataString ( const string &  name  )  throw ( RDBErr )

Return the data of the RDBColumn, converting if necessary.

Parameters:
name of RDBColumn
Exceptions:
RDBErr if no matching column name is found.
RDBErr if data is invalid datatype for RDBColumn.
Returns:
data of RDBColumn.

Definition at line 3091 of file RDB.cc.

References _cols, _filename, _ncols, _nrcol, RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::getDataString(), RDBColumn::getDataString(), and getName().

size_t RDB::nComments ( void   )  const

Return number of comments in RDB object.

Returns:
Number of comments.

Definition at line 3120 of file RDB.cc.

References _ncomms.

size_t RDB::nColumns ( void   )  const

Return number of columns in RDB object.

Returns:
Number of columns.

Definition at line 3133 of file RDB.cc.

References _ncols.

size_t RDB::nRows ( void   ) 

Return number of rows in RDB object.

Returns:
Number of rows.
Warning:
This method reads through the entire RDB file to count the number of rows and then attempts to rewind the file to the location at which it began . If the stream attached to the RDB object is not seekable, this method will fail.

Definition at line 3151 of file RDB.cc.

References _isptr, _knowrows, _line, _mode, _nrows, and _rewindto.

void RDB::parseHeader ( void   )  throw ( RDBErr ) [protected]

Parse header, i.e. comments and column names and definitions.

Parses out comments and column names and defintions from the RDB file header. This is used by RDB::open().

Definition at line 3185 of file RDB.cc.

References _cols, _isptr, _mycols, _ncols, _ncomms, _nrows, _rewindto, _rownum, and setComment().

Referenced by open().

vector< string > RDB::parseLine ( const string &  line  )  const [protected]

Parse fields in a row.

Parameters:
line the line to be split.
Returns:
Vector of tokens, one for each tab delimited field.
Splits the input line on tabs.

Definition at line 3284 of file RDB.cc.

size_t RDB::parseLine ( bool &  newgroup  )  throw ( RDBErr ) [protected]

Parse fields in a row.

Returns:
number of tokens parsed.
Splits the line on tabs and assigns the tokens to the RDBColumns.

Definition at line 3316 of file RDB.cc.

References _cols, _line, _rownum, newGroup(), and RDBColumn::setData().


Friends And Related Function Documentation

istream& operator>> ( istream &  is,
RDB rdb 
) throw ( RDBErr ) [friend]

Read table from input stream.

Parameters:
is the input stream.
rdb the table to fill.
Returns:
A reference to the input stream.
If the stream contains a valid rdbtable fill it... otherwise set ios::failbit.

Definition at line 38 of file RDB.cc.

ostream& operator<< ( ostream &  os,
RDB rdb 
) throw ( RDBErr ) [friend]

Write table to output stream.

Parameters:
os the output stream.
rdb the table to print.
Returns:
A reference to the output stream
Places the table on the output stream.

Definition at line 76 of file RDB.cc.


Member Data Documentation

string RDB::_filename [protected]

ios::openmode RDB::_mode [protected]

Open mode of the associated stream.

Definition at line 305 of file RDB.h.

Referenced by nRows(), open(), read(), rewind(), and write().

istream* RDB::_isptr [protected]

Istream attached to data file.

Definition at line 308 of file RDB.h.

Referenced by close(), nRows(), open(), parseHeader(), read(), simpleRDBTable< Type >::readRow(), rewind(), and ~RDB().

ostream* RDB::_osptr [protected]

Ostream attached to data file.

Definition at line 310 of file RDB.h.

Referenced by close(), open(), rewind(), write(), and ~RDB().

bool RDB::_myisptr [protected]

Indicates if RDB object is responsible for deallocating the istream.

Definition at line 312 of file RDB.h.

Referenced by close(), and open().

bool RDB::_myosptr [protected]

Indicates if RDB object is responsible for deallocating the ostream.

Definition at line 314 of file RDB.h.

Referenced by close(), and open().

size_t RDB::_rewindto [protected]

Position of beginning of first row of data.

Definition at line 317 of file RDB.h.

Referenced by close(), nRows(), parseHeader(), rewind(), and write().

size_t RDB::_ncomms [protected]

Number of comments.

Definition at line 319 of file RDB.h.

Referenced by close(), getComment(), nComments(), parseHeader(), setComment(), and write().

size_t RDB::_ncols [protected]

size_t RDB::_nrows [protected]

Number of rows.

Definition at line 323 of file RDB.h.

Referenced by close(), nRows(), and parseHeader().

bool RDB::_knowrows [protected]

Indicates if associated file must be scanned to determine number of rows.

Definition at line 325 of file RDB.h.

Referenced by close(), and nRows().

long RDB::_rownum [protected]

Current *table* row number.

Definition at line 327 of file RDB.h.

Referenced by close(), parseHeader(), parseLine(), read(), rewind(), and write().

long RDB::_frownum [protected]

Current *file* row number.

Definition at line 329 of file RDB.h.

bool RDB::_autoidx [protected]

Indicates if RDBColumn data elements should be advanced.

Definition at line 332 of file RDB.h.

Referenced by autoIdx(), close(), read(), setGroup(), and write().

bool RDB::_firstread [protected]

Indicates if this is the first call to RDB::read.

Definition at line 334 of file RDB.h.

Referenced by read().

bool RDB::_lastread [protected]

Indicates if this is the last call to RDB::read.

Definition at line 336 of file RDB.h.

Referenced by read().

bool RDB::_writehdr [protected]

Indicates if the header has been output.

Definition at line 338 of file RDB.h.

Referenced by close(), and write().

RDBComment* RDB::_comms [protected]

Array of RDBComments.

Definition at line 341 of file RDB.h.

Referenced by close(), getComment(), setComment(), write(), and ~RDB().

RDBColumn** RDB::_cols [protected]

bool* RDB::_mycols [protected]

Indicates if RDB object is responsible for deallocating given RDBColumn.

Definition at line 347 of file RDB.h.

Referenced by parseHeader(), setColumn(), and ~RDB().

string RDB::_line [protected]

Line from RDB table.

Definition at line 350 of file RDB.h.

Referenced by nRows(), parseLine(), and read().


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

Generated on Tue Sep 15 11:07:27 2009 for rdbxx by  doxygen 1.5.6