rdbxx  1.0.7_02
RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 > Class Template Reference

Parameterizes RDBColumn interface for many data types. More...

#include <RDBColumnTmplt.h>

Inheritance diagram for RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >:
Collaboration diagram for RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >:

Public Member Functions

Constructing, destructing, and initializing RDB columns.
 RDBColumnTmplt (const string &name="", const string &def="")
 Assigns name and definition. More...
 
 RDBColumnTmplt (const RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 > &rdbcolumntmplt)
 Copies RDBColumnTmplt object. More...
 
 ~RDBColumnTmplt (void)
 Deletes resources allocated by RDBColumnTmplt object. More...
 
RDBColumnoperator= (const RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 > &rdbcolumntmplt)
 Copies RDBColumnTmplt object. More...
 
virtual RDBColumnoperator= (const Tmplt0 &data)
 Assigns data to RDBColumn object's _data member, converting as necessary. More...
 
virtual RDBColumnoperator= (const Tmplt1 &data)
 Assigns data to RDBColumn object's _data member, converting as necessary. More...
 
virtual RDBColumnoperator= (const Tmplt2 &data)
 Assigns data to RDBColumn object's _data member, converting as necessary. More...
 
Auto-indexing control methods.
virtual void advanceIdx (void)
 Increments index to the RDBColumn's data elements. More...
 
virtual void rewind (void)
 Rewinds index to the RDBColumn's data elements. More...
 
Group information ("break" column) methods.
virtual void setGroup (bool group)
 
virtual void setGroupValue (void)
 Sets the group value to the current data value. More...
 
virtual int newGroup (void)
 Returns the group status of this column object. More...
 
Data member initializers.
virtual bool setData (const Tmplt0 &data)
 Sets the data value, converting as necessary. More...
 
virtual bool setData (const Tmplt1 &data)
 Sets the data value, converting as necessary. More...
 
virtual bool setData (const Tmplt2 &data)
 Sets the data value, converting as necessary. More...
 
Methods to map RDBColumn's data to user-supplied memory.
virtual void mapData (Tmplt0 data[], const size_t nelems)
 Maps data to user-supplied memory. More...
 
Data member accessors.
void * getData (void)
 Returns a pointer to the current data element. More...
 
virtual bool getData (Tmplt0 &data)
 Returns the value of the current data element, converting if necessary. More...
 
virtual bool getData (Tmplt1 &data)
 Returns the value of the current data element, converting if necessary. More...
 
virtual bool getData (Tmplt2 &data)
 Returns the value of the current data element, converting if necessary. More...
 
virtual double getDataDouble (void)
 Returns the value of the current data element, converting if necessary. More...
 
virtual long getDataLong (void)
 Returns the value of the current data element, converting if necessary. More...
 
virtual string getDataString (void)
 Returns the value of the current data element, converting if necessary. More...
 
- Public Member Functions inherited from RDBColumn
 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...
 
RDBColumnoperator= (const RDBColumn &col)
 Copies RDBColumn object. More...
 
virtual RDBColumnoperator= (const double &data)=0
 Assigns data to RDBColumn object's _data member, converting as necessary. More...
 
virtual RDBColumnoperator= (const long &data)=0
 Assigns data to RDBColumn object's _data member, converting as necessary. More...
 
virtual RDBColumnoperator= (const string &data)=0
 Assigns data to RDBColumn object's _data member, converting as necessary. 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...
 
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...
 
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...
 
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 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...
 

Protected Member Functions

virtual istream & read (istream &is)
 Called by the stream insertion operator. More...
 
virtual ostream & write (ostream &os) const
 Called by the stream extraction operator. More...
 
void cleanup (void)
 Deletes resources allocated by RDBColumnTmplt object. More...
 
- Protected Member Functions inherited from RDBColumn
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 & 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 & 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

Tmplt0 * _data
 Pointer to the data managed by object. More...
 
size_t _idx
 Index into the data. More...
 
size_t _nelems
 Number of elements of data. More...
 
bool _mine
 Indicates that RDBColumnTmplt is responsible for deallocating the data. More...
 
Tmplt0 _groupvalue
 Current group value. More...
 
- Protected Attributes inherited from RDBColumn
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...
 

Additional Inherited Members

- Public Types inherited from RDBColumn
enum  Just
 Acceptable column justifications. More...
 
enum  Type
 Acceptable column types. More...
 
enum  Err
 Possible error conditions. More...
 
enum  Status
 

Detailed Description

template<class Tmplt0, class Tmplt1, class Tmplt2>
class RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >

Parameterizes RDBColumn interface for many data types.

Definition at line 38 of file RDBColumnTmplt.h.

Constructor & Destructor Documentation

◆ RDBColumnTmplt() [1/2]

template<class Tmplt0 , class Tmplt1 , class Tmplt2 >
RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::RDBColumnTmplt ( const string &  name = "",
const string &  def = "" 
)

Assigns name and definition.

Parameters
namethe column name.
defthe column definition.

Allocates space for a single data element of type Tmplt1.

Definition at line 37 of file RDBColumnTmplt.cc.

◆ RDBColumnTmplt() [2/2]

template<class Tmplt0, class Tmplt1, class Tmplt2>
RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::RDBColumnTmplt ( const RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 > &  rdbcolumntmplt)

Copies RDBColumnTmplt object.

Parameters
rdbcolumntmpltcol the RDBColumn object to copy.

Makes a shallow copy of the argument. The two RDBColumn objects share data elements.

Definition at line 58 of file RDBColumnTmplt.cc.

◆ ~RDBColumnTmplt()

template<class Tmplt0 , class Tmplt1 , class Tmplt2 >
RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::~RDBColumnTmplt ( void  )

Deletes resources allocated by RDBColumnTmplt object.

Responsible for freeing data element memory allocated by the RDBColumn object.

Definition at line 76 of file RDBColumnTmplt.cc.

Member Function Documentation

◆ advanceIdx()

template<class Tmplt0 , class Tmplt1 , class Tmplt2 >
void RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::advanceIdx ( void  )
virtual

Increments index to the RDBColumn's data elements.

Advances the automatic index for the data elements by one.

Implements RDBColumn.

Definition at line 212 of file RDBColumnTmplt.cc.

◆ cleanup()

template<class Tmplt0 , class Tmplt1 , class Tmplt2 >
void RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::cleanup ( void  )
protected

Deletes resources allocated by RDBColumnTmplt object.

Frees memory allocated by this object.

Definition at line 710 of file RDBColumnTmplt.cc.

◆ getData() [1/4]

template<class Tmplt0 , class Tmplt1 , class Tmplt2 >
void * RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::getData ( void  )
virtual

Returns a pointer to the current data element.

Returns
Pointer to the current data element.

This method returns a pointer to the current data element. Modifications to the data returned are evident within this object.

Implements RDBColumn.

Definition at line 466 of file RDBColumnTmplt.cc.

◆ getData() [2/4]

template<class Tmplt0, class Tmplt1 , class Tmplt2 >
bool RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::getData ( Tmplt0 &  data)
virtual

Returns the value of the current data element, converting if necessary.

Parameters
dataassigned the value of the current data element in this object.
Returns
True if the conversion was successful, false otherwise.

Assigns the value of the current RDBColumn data element to the arguement.

Definition at line 484 of file RDBColumnTmplt.cc.

◆ getData() [3/4]

template<class Tmplt0, class Tmplt1, class Tmplt2 >
bool RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::getData ( Tmplt1 &  data)
virtual

Returns the value of the current data element, converting if necessary.

Parameters
dataassigned the value of the current data element in this object.
Exceptions
RDBErrerror if the user attempts to convert a string column with non-numeric data to a numeric arguemnt.
RDBErrerror if the user attempts to convert a string column representing a floating point number to an integer argument.
Returns
True if the conversion was successful, false otherwise.

Assigns the value of the current RDBColumn data element to the arguement.

Definition at line 517 of file RDBColumnTmplt.cc.

◆ getData() [4/4]

template<class Tmplt0, class Tmplt1, class Tmplt2>
bool RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::getData ( Tmplt2 &  data)
virtual

Returns the value of the current data element, converting if necessary.

Parameters
dataassigned the value of the current data element in this object.
Exceptions
RDBErrerror if the user attempts to convert a string column with non-numeric data to a numeric arguemnt.
RDBErrerror if the user attempts to convert a string column representing a floating point number to an integer argument.
Returns
True if the conversion was successful, false otherwise.

Assigns the value of the current RDBColumn data element to the arguement.

Definition at line 550 of file RDBColumnTmplt.cc.

◆ getDataDouble()

template<class Tmplt0 , class Tmplt1 , class Tmplt2 >
double RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::getDataDouble ( void  )
virtual

Returns the value of the current data element, converting if necessary.

Exceptions
RDBErrerror if the user attempts to convert a string column with non-numeric data to a numeric arguemnt.
Returns
The data element as a double.

Implements RDBColumn.

Definition at line 578 of file RDBColumnTmplt.cc.

◆ getDataLong()

template<class Tmplt0 , class Tmplt1 , class Tmplt2 >
long RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::getDataLong ( void  )
virtual

Returns the value of the current data element, converting if necessary.

Exceptions
RDBErrerror if the user attempts to convert a string column with non-numeric data to a numeric arguemnt.
RDBErrerror if the user attempts to convert a string column representing a floating point number to an integer argument.
Returns
The data element as a long.

Implements RDBColumn.

Definition at line 608 of file RDBColumnTmplt.cc.

◆ getDataString()

template<class Tmplt0 , class Tmplt1 , class Tmplt2 >
string RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::getDataString ( void  )
virtual

Returns the value of the current data element, converting if necessary.

Returns
The data element as a string.

Implements RDBColumn.

Definition at line 635 of file RDBColumnTmplt.cc.

◆ mapData()

template<class Tmplt0, class Tmplt1 , class Tmplt2 >
void RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::mapData ( Tmplt0  data[],
const size_t  nelems 
)
virtual

Maps data to user-supplied memory.

Parameters
datapointer to a data element of type Tmplt0.
nelemsnumber of data elements in the array pointed by data.

This method associates user allocated memory pointed to by data with this RDBColumn object. The used is responsible for freeing the memory pointed to by data after the RDBColumn is destroyed.

Definition at line 440 of file RDBColumnTmplt.cc.

◆ newGroup()

template<class Tmplt0 , class Tmplt1 , class Tmplt2 >
int RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::newGroup ( void  )
virtual

Returns the group status of this column object.

Returns
True if the data element is in a new group.

Implements RDBColumn.

Definition at line 285 of file RDBColumnTmplt.cc.

◆ operator=() [1/4]

template<class Tmplt0, class Tmplt1, class Tmplt2>
RDBColumn & RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::operator= ( const RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 > &  col)

Copies RDBColumnTmplt object.

Parameters
colthe RDBColumn object to copy.

Makes a shallow copy of the argument. The two RDBColumn objects share data elements.

Definition at line 93 of file RDBColumnTmplt.cc.

◆ operator=() [2/4]

template<class Tmplt0, class Tmplt1, class Tmplt2>
RDBColumn & RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::operator= ( const Tmplt0 &  data)
virtual

Assigns data to RDBColumn object's _data member, converting as necessary.

Parameters
dataAssigns the value to the current RDBColumn data element.

Definition at line 124 of file RDBColumnTmplt.cc.

◆ operator=() [3/4]

template<class Tmplt0, class Tmplt1, class Tmplt2>
RDBColumn & RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::operator= ( const Tmplt1 &  data)
virtual

Assigns data to RDBColumn object's _data member, converting as necessary.

Parameters
data
Exceptions
RDBErrerror if the user attempts to convert non-numeric string data to a numeric column.
RDBErrerror if the user attempts to convert string data representing a floating point number to an integer column.

Assigns the value to the current RDBColumn data element.

Definition at line 155 of file RDBColumnTmplt.cc.

◆ operator=() [4/4]

template<class Tmplt0, class Tmplt1, class Tmplt2>
RDBColumn & RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::operator= ( const Tmplt2 &  data)
virtual

Assigns data to RDBColumn object's _data member, converting as necessary.

Parameters
data
Exceptions
RDBErrerror if the user attempts to convert non-numeric string data to a numeric column.
RDBErrerror if the user attempts to convert string data representing a floating point number to an integer column.

Assigns the value to the current RDBColumn data element.

Definition at line 186 of file RDBColumnTmplt.cc.

◆ read()

template<class Tmplt0 , class Tmplt1 , class Tmplt2 >
istream & RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::read ( istream &  is)
protectedvirtual

Called by the stream insertion operator.

Parameters
isinput stream.
Returns
The input stream.

Called by the RDBColumn stream extraction operator.

Implements RDBColumn.

Definition at line 666 of file RDBColumnTmplt.cc.

◆ rewind()

template<class Tmplt0 , class Tmplt1 , class Tmplt2 >
void RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::rewind ( void  )
virtual

Rewinds index to the RDBColumn's data elements.

Rewinds the automatic index for the data elements to the first element.

Implements RDBColumn.

Definition at line 228 of file RDBColumnTmplt.cc.

◆ setData() [1/3]

template<class Tmplt0, class Tmplt1 , class Tmplt2 >
bool RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::setData ( const Tmplt0 &  data)
virtual

Sets the data value, converting as necessary.

Parameters
data
Returns
True upon successful conversion, false otherwise.

Assigns the value to the current RDBColumn data element.

Definition at line 343 of file RDBColumnTmplt.cc.

◆ setData() [2/3]

template<class Tmplt0, class Tmplt1, class Tmplt2 >
bool RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::setData ( const Tmplt1 &  data)
virtual

Sets the data value, converting as necessary.

Parameters
data
Exceptions
RDBErrerror if the user attempts to convert non-numeric string data to a numeric column.
RDBErrerror if the user attempts to convert string data representing a floating point number to an integer column.
Returns
True upon successful conversion, false otherwise.

Assigns the value to the current RDBColumn data element.

Definition at line 376 of file RDBColumnTmplt.cc.

◆ setData() [3/3]

template<class Tmplt0, class Tmplt1, class Tmplt2>
bool RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::setData ( const Tmplt2 &  data)
virtual

Sets the data value, converting as necessary.

Parameters
data
Exceptions
RDBErrerror if the user attempts to convert non-numeric string data to a numeric column.
RDBErrerror if the user attempts to convert string data representing a floating point number to an integer column.
Returns
True upon successful conversion, false otherwise.

Assigns the value to the current RDBColumn data element.

Definition at line 409 of file RDBColumnTmplt.cc.

◆ setGroup()

template<class Tmplt0 , class Tmplt1 , class Tmplt2 >
void RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::setGroup ( bool  group)
virtual
Parameters
groupincidcates whether or not this is a group column.

Reimplemented from RDBColumn.

Definition at line 242 of file RDBColumnTmplt.cc.

◆ setGroupValue()

template<class Tmplt0 , class Tmplt1 , class Tmplt2 >
void RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::setGroupValue ( void  )
virtual

Sets the group value to the current data value.

Sets the group for this object to the current data element.

Implements RDBColumn.

Definition at line 268 of file RDBColumnTmplt.cc.

◆ write()

template<class Tmplt0 , class Tmplt1 , class Tmplt2 >
ostream & RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::write ( ostream &  os) const
protectedvirtual

Called by the stream extraction operator.

Parameters
osoutput stream.
Returns
The output stream.

Called by the RDBColumn stream insertion operator.

Implements RDBColumn.

Definition at line 696 of file RDBColumnTmplt.cc.

Member Data Documentation

◆ _data

template<class Tmplt0, class Tmplt1, class Tmplt2>
Tmplt0* RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::_data
protected

Pointer to the data managed by object.

Definition at line 120 of file RDBColumnTmplt.h.

◆ _groupvalue

template<class Tmplt0, class Tmplt1, class Tmplt2>
Tmplt0 RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::_groupvalue
protected

Current group value.

Definition at line 129 of file RDBColumnTmplt.h.

◆ _idx

template<class Tmplt0, class Tmplt1, class Tmplt2>
size_t RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::_idx
protected

Index into the data.

Definition at line 122 of file RDBColumnTmplt.h.

◆ _mine

template<class Tmplt0, class Tmplt1, class Tmplt2>
bool RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::_mine
protected

Indicates that RDBColumnTmplt is responsible for deallocating the data.

Definition at line 126 of file RDBColumnTmplt.h.

◆ _nelems

template<class Tmplt0, class Tmplt1, class Tmplt2>
size_t RDBColumnTmplt< Tmplt0, Tmplt1, Tmplt2 >::_nelems
protected

Number of elements of data.

Definition at line 124 of file RDBColumnTmplt.h.


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