Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

CdbBdbNTupleSimpleImplP_ooVString Class Reference

A persistent n-tuple for variable length strings. More...

Inheritance diagram for CdbBdbNTupleSimpleImplP_ooVString:

CdbBdbNTupleP< ooVString > CdbBdbNTupleBaseP List of all members.

Public Member Functions

 CdbBdbNTupleSimpleImplP_ooVString (d_ULong theNumberOfColumns, const std::string &theName, const std::string &theDescription, const std::vector< std::string > &theColumnNames)
 Constructor.

virtual ~CdbBdbNTupleSimpleImplP_ooVString ()
 Destructor.

virtual d_ULong rows () const
 Get the number of rows in the tuple.

virtual CdbStatus get_row (std::vector< ooVString > &theRow, const d_ULong theNumber) const
 Get a row at a specified position.

virtual CdbStatus append_row (const std::vector< ooVString > &theRow)
 Append a row by the end of an existing list.

virtual CdbStatus repack ()
 Repack the internal storage of the tuple.


Detailed Description

A persistent n-tuple for variable length strings.

Q: WHY NOT TO GO FOR TEMPLATE SPECIALIZATION INSTEAD OF PROVIDING A SEPARATE CLASS FOR STRINGS?

A: BECAUSE IT"S NOT POSSIBLE TO MAKE IT WORKING ON BOTH LINUX AND SOLARIS PLATFORM UNDER OBJY 7.1.

Unlike the generic n-tuple template this particular implementation uses a regular "v-array" to store "address"-es of strings in teh internal storage, and it uses a regular "v-array" of characters (ooChar) as a storage for the actual contents of strings.

Similarily to the generic n-tuple the rows in the current implementation are unwrapped into a sigle dimension array in the following order:

DESIGN NOTES:

This class has been designed for the performance of the insertion operations versus persistent space utilization efficiency. That's why the capacity of a v-array used to store the elements may be greater than the actual number of elements stored at a given instance of time.

The current resizing policy for the storage is "x2" meaning that every time a new row is to be inserted and if there is no free space in the storage the storage size gets increased by a factor of 2.

Since this policy would result with the 25 average in-efficiency in the use of the storage then there is a special "repack" method meant to truncate the storage to match the actual number of rows stored in the array. Normally the "repack" operation should be called when the construction of the tuple is finished.

Strings get stored as null ('') terminated sequences of characters (ooChar). A regular v-array represents the structure of the n-tuple. Each element of this structure provides an index of the first character of the string in the second array where the actual contents of the string gets stored.

The string storage is a plain ooVArray of ooChar. The use of this storage is also optimized in the same way as in case of the metadata array.

See also:
CdbBdbNTupleBaseP

CdbBdbNTupleP

Definition at line 61 of file CdbBdbNTupleSimpleImplP_ooVString.ddl.


Constructor & Destructor Documentation

CdbBdbNTupleSimpleImplP_ooVString::CdbBdbNTupleSimpleImplP_ooVString d_ULong    theNumberOfColumns,
const std::string &    theName,
const std::string &    theDescription,
const std::vector< std::string > &    theColumnNames
 

Constructor.

See also:
CdbBdbNTupleBaseP::CdbBdbNTupleBaseP

CdbBdbNTupleP::CdbBdbNTupleP

Definition at line 20 of file CdbBdbNTupleSimpleImplP_ooVString.cc.

CdbBdbNTupleSimpleImplP_ooVString::~CdbBdbNTupleSimpleImplP_ooVString   [virtual]
 

Destructor.

Definition at line 34 of file CdbBdbNTupleSimpleImplP_ooVString.cc.


Member Function Documentation

CdbStatus CdbBdbNTupleSimpleImplP_ooVString::append_row const std::vector< ooVString > &    theRow [virtual]
 

Append a row by the end of an existing list.

Implements a virtual method defined in the base class.

See also:
CdbBdbNTupleP::append_row

Definition at line 95 of file CdbBdbNTupleSimpleImplP_ooVString.cc.

References CdbBdbNTupleBaseP::columns(), CdbStatus::Error, CdbStatus::IllegalParameters, and CdbStatus::Success.

CdbStatus CdbBdbNTupleSimpleImplP_ooVString::get_row std::vector< ooVString > &    theRow,
const d_ULong    theNumber
const [virtual]
 

Get a row at a specified position.

Implements a virtual method defined in the base class.

See also:
CdbBdbNTupleP::get_row

Definition at line 44 of file CdbBdbNTupleSimpleImplP_ooVString.cc.

References CdbBdbNTupleBaseP::columns(), CdbStatus::Error, CdbStatus::NotFound, and CdbStatus::Success.

CdbStatus CdbBdbNTupleSimpleImplP_ooVString::repack   [virtual]
 

Repack the internal storage of the tuple.

Implements a virtual method defined in the base class.

See also:
CdbBdbNTupleP::repack

Implements CdbBdbNTupleP< ooVString >.

Definition at line 189 of file CdbBdbNTupleSimpleImplP_ooVString.cc.

References CdbBdbNTupleBaseP::columns(), CdbStatus::Error, and CdbStatus::Success.

d_ULong CdbBdbNTupleSimpleImplP_ooVString::rows   const [virtual]
 

Get the number of rows in the tuple.

Implements a virtual method defined in the base class.

See also:
CdbBdbNTupleP::rows

Implements CdbBdbNTupleP< ooVString >.

Definition at line 38 of file CdbBdbNTupleSimpleImplP_ooVString.cc.


The documentation for this class was generated from the following files:
Generated on Mon Dec 5 18:22:18 2005 for CDB by doxygen1.3-rc3