rdbxx
1.0.7_02
|
Provides interface for general column related methods. More...
#include <RDBColumn.h>
Public Types | |
Enumerations for column definitions and error conditions. | |
enum | Just |
Acceptable column justifications. More... | |
enum | Type |
Acceptable column types. More... | |
enum | Err |
Possible error conditions. More... | |
enum | Status |
Public Member Functions | |
Constructing, destructing, and initializing RDBColumn objects. | |
RDBColumn (const string &name="", const string &def="") | |
Assigns name and definition to RDBColumn object. More... | |
RDBColumn (const RDBColumn &col) | |
Copies RDBColumn object. More... | |
virtual | ~RDBColumn (void) |
Deletes resources allocated by RDBColumn object. More... | |
RDBColumn & | operator= (const RDBColumn &col) |
Copies RDBColumn object. More... | |
virtual RDBColumn & | operator= (const double &data)=0 |
Assigns data to RDBColumn object's _data member, converting as necessary. More... | |
virtual RDBColumn & | operator= (const long &data)=0 |
Assigns data to RDBColumn object's _data member, converting as necessary. More... | |
virtual RDBColumn & | operator= (const string &data)=0 |
Assigns data to RDBColumn object's _data member, converting as necessary. More... | |
Auto-indexing control methods. | |
virtual void | advanceIdx (void)=0 |
Increments index to the RDBColumn's data elements. More... | |
virtual void | rewind (void)=0 |
Rewinds index to the RDBColumn's data elements. More... | |
Group information ("break" column) methods. | |
virtual void | setGroup (bool group) |
Turn on/off group tracking for this column object. More... | |
bool | getGroup (void) const |
Returns group status, RBOG if at beginning of a group, REOG if at ned of a group, or REOL if in the middle of a group. More... | |
virtual void | setGroupValue (void)=0 |
Sets the group value to the current data value. More... | |
virtual int | newGroup (void)=0 |
Returns the group status of this column object. More... | |
Data member initializers. | |
void | setName (const string &name) |
Sets the name. More... | |
void | setDef (const string &def) |
Sets the definition. More... | |
void | setWidth (const long width) |
Sets the width. More... | |
void | setType (const RDBColumn::Type type) |
Sets the type. More... | |
void | setJust (const RDBColumn::Just just) |
Sets the justification. More... | |
void | setDesc (const string &desc) |
Sets the description. More... | |
void | setPrecision (const int precision) |
Sets the precision for numeric output and numeric to string conversion. More... | |
void | setThrow (const bool t=true) |
Sets the excpeption throwing behavior. More... | |
void | setErrNo (const int no=0) |
Sets the error status. More... | |
virtual bool | setData (const double &data)=0 |
Sets the data value, converting as necessary. More... | |
virtual bool | setData (const long &data)=0 |
Sets the data value, converting as necessary. More... | |
virtual bool | setData (const string &data)=0 |
Sets the data value, converting as necessary. More... | |
Methods to map RDBColumn's data to user-supplied memory. | |
virtual void | mapData (double data[], const size_t nelems=1) |
Maps data to user-supplied memory, if possible. More... | |
virtual void | mapData (long data[], const size_t nelems=1) |
Maps data to user-supplied memory, if possible. More... | |
virtual void | mapData (string data[], const size_t nelems=1) |
Maps data to user-supplied memory, if possible. More... | |
Data member accessors. | |
string | getName (void) const |
Returns the name. More... | |
string | getDef (void) |
Returns the definition. More... | |
long | getWidth (void) const |
Returns the width. More... | |
RDBColumn::Type | getType (void) const |
Returns the type. More... | |
RDBColumn::Just | getJust (void) const |
Returns the justification. More... | |
string | getDesc (void) const |
Returns the description. More... | |
int | getPrecision (void) const |
Returns the precision. More... | |
bool | getThrow (void) const |
Returns the state of the exception throwing behavior. More... | |
char * | getErr (void) const |
Returns a brief description of the error condition. More... | |
int | getErrNo (void) const |
Returns the error status. More... | |
virtual void * | getData (void)=0 |
Returns a pointer to the current data element. More... | |
virtual bool | getData (double &data)=0 |
Returns the value of the current data element, converting if necessary. More... | |
virtual bool | getData (long &data)=0 |
Returns the value of the current data element, converting if necessary. More... | |
virtual bool | getData (string &data)=0 |
Returns the value of the current data element, converting if necessary. More... | |
virtual double | getDataDouble (void)=0 |
Returns the value of the current data element, converting if necessary. More... | |
virtual long | getDataLong (void)=0 |
Returns the value of the current data element, converting if necessary. More... | |
virtual string | getDataString (void)=0 |
Returns the value of the current data element, converting if necessary. More... | |
Protected Member Functions | |
void | convert (const double &idata, double &odata) |
Used to converted data based on user requests. More... | |
void | convert (const double &idata, long &odata) |
Used to converted data based on user requests. More... | |
void | convert (const double &idata, string &odata) |
Used to converted data based on user requests. More... | |
void | convert (const long &idata, double &odata) |
Used to converted data based on user requests. More... | |
void | convert (const long &idata, long &odata) |
Used to converted data based on user requests. More... | |
void | convert (const long &idata, string &odata) |
Used to converted data based on user requests. More... | |
void | convert (const string &idata, double &odata) |
Used to converted data based on user requests. More... | |
void | convert (const string &idata, long &odata) |
Used to converted data based on user requests. More... | |
void | convert (const string &idata, string &odata) |
Used to converted data based on user requests. More... | |
virtual istream & | read (istream &is)=0 |
Called by the stream insertion operator. More... | |
virtual istream & | extract (istream &is, double &data) |
Overridden in the subclass of this datatype. More... | |
virtual istream & | extract (istream &is, long &data) |
Overridden in the subclass of this datatype. More... | |
virtual istream & | extract (istream &is, string &data) |
Overridden in the subclass of this datatype. More... | |
virtual ostream & | write (ostream &os) const =0 |
Called by the stream extraction operator. More... | |
virtual ostream & | insert (ostream &os, double &data) const |
Overridden in the subclass of this datatype. More... | |
virtual ostream & | insert (ostream &os, long &data) const |
Overridden in the subclass of this datatype. More... | |
virtual ostream & | insert (ostream &os, string &data) const |
Overridden in the subclass of this datatype. More... | |
Protected Attributes | |
string | _name |
Name. More... | |
string | _def |
Definition. More... | |
long | _width |
Width. More... | |
RDBColumn::Type | _type |
Data type. More... | |
RDBColumn::Just | _just |
Justification. More... | |
string | _desc |
Description. More... | |
bool | _changed |
Indicates state for the definition field. More... | |
bool | _throw |
State of the exception throwing behavior. More... | |
int | _errno |
Error state. More... | |
int | _precision |
Precision used for stream output or numeric to string conversion. More... | |
stringstream | _strstrm |
Used for numeric to string conversion. More... | |
bool | _group |
This is a group column. More... | |
bool | _initgroup |
Group been initialized. More... | |
Friends | |
Stream insertion and extraction operators. | |
istream & | operator>> (istream &is, RDBColumn &col) |
Read column from input stream. More... | |
istream & | operator>> (istream &is, RDBColumn *col) |
Read column from input stream. More... | |
ostream & | operator<< (ostream &os, const RDBColumn &col) |
Write column to output stream. More... | |
ostream & | operator<< (ostream &os, const RDBColumn *col) |
Write column to output stream. More... | |
Provides interface for general column related methods.
Definition at line 43 of file RDBColumn.h.
enum RDBColumn::Err |
Possible error conditions.
Definition at line 64 of file RDBColumn.h.
enum RDBColumn::Just |
Acceptable column justifications.
Definition at line 60 of file RDBColumn.h.
enum RDBColumn::Type |
Acceptable column types.
Definition at line 62 of file RDBColumn.h.
RDBColumn::RDBColumn | ( | const string & | name = "" , |
const string & | def = "" |
||
) |
Assigns name and definition to RDBColumn object.
name | the column name. |
def | the column definition. |
Initializes the RDBColumn name and definition. Sets the exception throwing behavior to true.
Definition at line 136 of file RDBColumn.cc.
RDBColumn::RDBColumn | ( | const RDBColumn & | col | ) |
Copies RDBColumn object.
col | the RDBColumn object to copy. |
Copies the argument.
Definition at line 165 of file RDBColumn.cc.
|
virtual |
Deletes resources allocated by RDBColumn object.
Nothing to do.
Definition at line 180 of file RDBColumn.cc.
|
pure virtual |
Increments index to the RDBColumn's data elements.
Implemented in RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >, and RDBColumnTmplt< long, string, double >.
|
protected |
Used to converted data based on user requests.
idata | input data. |
odata | output data. |
Handles the trivial conversion for double to double for child classes.
Definition at line 647 of file RDBColumn.cc.
|
protected |
Used to converted data based on user requests.
idata | input data. |
odata | output data. |
Handles the trivial conversion for double to long for child classes.
Definition at line 664 of file RDBColumn.cc.
|
protected |
Used to converted data based on user requests.
idata | input data. |
odata | output data. |
Handles the non-trivial conversion for double to string for child classes.
Definition at line 684 of file RDBColumn.cc.
|
protected |
Used to converted data based on user requests.
idata | input data. |
odata | output data. |
Handles the trivial conversion for long to double for child classes.
Definition at line 705 of file RDBColumn.cc.
|
protected |
Used to converted data based on user requests.
idata | input data. |
odata | output data. |
Handles the trivial conversion for long to long for child classes.
Definition at line 722 of file RDBColumn.cc.
|
protected |
Used to converted data based on user requests.
idata | input data. |
odata | output data. |
Handles the non-trivial conversion for long to string for child classes.
Definition at line 741 of file RDBColumn.cc.
|
protected |
Used to converted data based on user requests.
idata | input data. |
odata | output data. |
RDBErr | error if idata is non-numeric. |
Handles the non-trivial conversion for string to double for child classes.
Definition at line 764 of file RDBColumn.cc.
|
protected |
Used to converted data based on user requests.
idata | input data. |
odata | output data. |
RDBErr | error if idata is non-numeric. |
RDBErr | error if idata represents a floating point number and precision is lost converting to integer number. |
Handles the non-trivial conversion for string to long for child classes.
Definition at line 796 of file RDBColumn.cc.
|
protected |
Used to converted data based on user requests.
idata | input data. |
odata | output data. |
Handles the trivial conversion for string to string for child classes.
Definition at line 848 of file RDBColumn.cc.
|
protectedvirtual |
Overridden in the subclass of this datatype.
is | input string. |
data | double data. |
Extracts a double from the input stream.
Definition at line 867 of file RDBColumn.cc.
|
protectedvirtual |
Overridden in the subclass of this datatype.
is | input string. |
data | long data. |
Extracts a long from the input stream.
Definition at line 891 of file RDBColumn.cc.
|
protectedvirtual |
Overridden in the subclass of this datatype.
is | input string. |
data | string data. |
Extracts a string from the input stream. Extraction stops at the first tab or newline character.
Definition at line 917 of file RDBColumn.cc.
|
pure virtual |
Returns a pointer to the current data element.
Implemented in RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >, and RDBColumnTmplt< long, string, double >.
|
pure virtual |
Returns the value of the current data element, converting if necessary.
Implemented in RDBColumnTmplt< long, string, double >.
|
pure virtual |
Returns the value of the current data element, converting if necessary.
Implemented in RDBColumnTmplt< long, string, double >.
|
pure virtual |
Returns the value of the current data element, converting if necessary.
Implemented in RDBColumnTmplt< long, string, double >.
|
pure virtual |
Returns the value of the current data element, converting if necessary.
Implemented in RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >, and RDBColumnTmplt< long, string, double >.
|
pure virtual |
Returns the value of the current data element, converting if necessary.
Implemented in RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >, and RDBColumnTmplt< long, string, double >.
|
pure virtual |
Returns the value of the current data element, converting if necessary.
Implemented in RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >, and RDBColumnTmplt< long, string, double >.
string RDBColumn::getDef | ( | void | ) |
Returns the definition.
Returns the RDBColumn definition, reconstructing it from its constituent parts if any of them have changed.
Definition at line 498 of file RDBColumn.cc.
string RDBColumn::getDesc | ( | void | ) | const |
Returns the description.
Returns the RDBColumn description.
Definition at line 579 of file RDBColumn.cc.
char * RDBColumn::getErr | ( | void | ) | const |
Returns a brief description of the error condition.
Returns a string describing the RDBColumn error flag.
Definition at line 618 of file RDBColumn.cc.
int RDBColumn::getErrNo | ( | void | ) | const |
Returns the error status.
Returns the RDBColumn error flag.
Definition at line 631 of file RDBColumn.cc.
bool RDBColumn::getGroup | ( | void | ) | const |
Returns group status, RBOG if at beginning of a group, REOG if at ned of a group, or REOL if in the middle of a group.
Definition at line 232 of file RDBColumn.cc.
RDBColumn::Just RDBColumn::getJust | ( | void | ) | const |
Returns the justification.
Returns the RDBColumn justification.
Definition at line 566 of file RDBColumn.cc.
string RDBColumn::getName | ( | void | ) | const |
int RDBColumn::getPrecision | ( | void | ) | const |
Returns the precision.
Returns the RDBColumn precision used for stream output.
Definition at line 592 of file RDBColumn.cc.
bool RDBColumn::getThrow | ( | void | ) | const |
Returns the state of the exception throwing behavior.
Returns the RDBColumn exception throwing flag.
Definition at line 605 of file RDBColumn.cc.
RDBColumn::Type RDBColumn::getType | ( | void | ) | const |
long RDBColumn::getWidth | ( | void | ) | const |
|
protectedvirtual |
Overridden in the subclass of this datatype.
os | output string. |
data | double data. |
Inserts a double into the output stream.
Definition at line 953 of file RDBColumn.cc.
|
protectedvirtual |
Overridden in the subclass of this datatype.
os | output string. |
data | double data. |
Inserts a long into the output stream.
Definition at line 972 of file RDBColumn.cc.
|
protectedvirtual |
Overridden in the subclass of this datatype.
os | output string. |
data | double data. |
Inserts a string into the output stream.
Definition at line 991 of file RDBColumn.cc.
|
virtual |
Maps data to user-supplied memory, if possible.
Definition at line 448 of file RDBColumn.cc.
|
virtual |
Maps data to user-supplied memory, if possible.
Reimplemented in RDBColumnTmplt< long, string, double >.
Definition at line 459 of file RDBColumn.cc.
|
virtual |
Maps data to user-supplied memory, if possible.
Definition at line 470 of file RDBColumn.cc.
|
pure virtual |
Returns the group status of this column object.
Implemented in RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >, and RDBColumnTmplt< long, string, double >.
Copies RDBColumn object.
col | the RDBColumn object to copy. |
Definition at line 191 of file RDBColumn.cc.
|
pure virtual |
Assigns data to RDBColumn object's _data member, converting as necessary.
Implemented in RDBColumnTmplt< long, string, double >.
|
pure virtual |
Assigns data to RDBColumn object's _data member, converting as necessary.
Implemented in RDBColumnTmplt< long, string, double >.
|
pure virtual |
Assigns data to RDBColumn object's _data member, converting as necessary.
Implemented in RDBColumnTmplt< long, string, double >.
|
protectedpure virtual |
Called by the stream insertion operator.
Implemented in RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >, and RDBColumnTmplt< long, string, double >.
|
pure virtual |
Rewinds index to the RDBColumn's data elements.
Implemented in RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >, and RDBColumnTmplt< long, string, double >.
|
pure virtual |
Sets the data value, converting as necessary.
Implemented in RDBColumnTmplt< long, string, double >.
|
pure virtual |
Sets the data value, converting as necessary.
Implemented in RDBColumnTmplt< long, string, double >.
|
pure virtual |
Sets the data value, converting as necessary.
Implemented in RDBColumnTmplt< long, string, double >.
void RDBColumn::setDef | ( | const string & | def | ) |
Sets the definition.
def | the RDBColumn definition to use. |
RDBErrColFmt | error if the definition is an unrecognized format. |
Sets the RDBColumn definition, as well as the width, type, justification, and description.
Definition at line 266 of file RDBColumn.cc.
void RDBColumn::setDesc | ( | const string & | desc | ) |
Sets the description.
desc | is the column documentation. |
Sets the RDBColumn description.
Definition at line 391 of file RDBColumn.cc.
void RDBColumn::setErrNo | ( | const int | no = 0 | ) |
Sets the error status.
no | Sets the RDBColumn error status. |
Definition at line 438 of file RDBColumn.cc.
|
virtual |
Turn on/off group tracking for this column object.
group | incidcates whether or not this is a group column. |
Reimplemented in RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >, and RDBColumnTmplt< long, string, double >.
Definition at line 219 of file RDBColumn.cc.
|
pure virtual |
Sets the group value to the current data value.
Implemented in RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >, and RDBColumnTmplt< long, string, double >.
void RDBColumn::setJust | ( | const RDBColumn::Just | just | ) |
Sets the justification.
just | the justification of the data when printing. |
Possible values are '<' for left justification and '>' for right justification. Default is for months and strings to be left justified and numeric data to be right justified.
Definition at line 375 of file RDBColumn.cc.
void RDBColumn::setName | ( | const string & | name | ) |
Sets the name.
name | the RDBColumn name to use. |
Sets the RDBColumn name.
Definition at line 247 of file RDBColumn.cc.
void RDBColumn::setPrecision | ( | const int | precision | ) |
Sets the precision for numeric output and numeric to string conversion.
precision | Sets the RDBColumn precision which controls the output precision of floating point data. |
Definition at line 408 of file RDBColumn.cc.
void RDBColumn::setThrow | ( | const bool | t = true | ) |
Sets the excpeption throwing behavior.
t | state of the exception throwing behavior. |
Sets the RDBColumn exception throwing behavior.
Definition at line 423 of file RDBColumn.cc.
void RDBColumn::setType | ( | const RDBColumn::Type | type | ) |
Sets the type.
type | of the RDBColumn. |
Possible values are 'M' for month, 'N' for numeric, 'S' for string. String is the default type.
Definition at line 357 of file RDBColumn.cc.
void RDBColumn::setWidth | ( | const long | width | ) |
Sets the width.
width | the width of the RDBColumn. |
The width has no effect on the storage or printing of the data. The RDB docs indicate that it is used only by the ptbl command.
Definition at line 340 of file RDBColumn.cc.
|
protectedpure virtual |
Called by the stream extraction operator.
Implemented in RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >, and RDBColumnTmplt< long, string, double >.
|
friend |
Write column to output stream.
os | output stream. |
col | RDBColumn to fill. |
Writes one data element from this object.
Definition at line 100 of file RDBColumn.cc.
|
friend |
Write column to output stream.
os | output stream. |
col | RDBColumn to fill. |
Writes one data element from this object.
Definition at line 119 of file RDBColumn.cc.
|
friend |
Read column from input stream.
is | input stream. |
col | RDBColumn to fill. |
Reads one data element into this object.
Definition at line 38 of file RDBColumn.cc.
|
friend |
Read column from input stream.
is | input stream. |
col | RDBColumn to fill. |
Reads one data element into this object.
Definition at line 69 of file RDBColumn.cc.
|
protected |
Indicates state for the definition field.
Definition at line 237 of file RDBColumn.h.
|
protected |
Definition.
Definition at line 227 of file RDBColumn.h.
|
protected |
Description.
Definition at line 235 of file RDBColumn.h.
|
protected |
Error state.
Definition at line 242 of file RDBColumn.h.
|
protected |
This is a group column.
Definition at line 248 of file RDBColumn.h.
|
protected |
Group been initialized.
Definition at line 250 of file RDBColumn.h.
|
protected |
Justification.
Definition at line 233 of file RDBColumn.h.
|
protected |
Name.
Definition at line 225 of file RDBColumn.h.
|
protected |
Precision used for stream output or numeric to string conversion.
Definition at line 244 of file RDBColumn.h.
|
protected |
Used for numeric to string conversion.
Definition at line 246 of file RDBColumn.h.
|
protected |
State of the exception throwing behavior.
Definition at line 240 of file RDBColumn.h.
|
protected |
Data type.
Definition at line 231 of file RDBColumn.h.
|
protected |
Width.
Definition at line 229 of file RDBColumn.h.