rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWDBTPtrMemTable< T, C > Class Template Reference
[Utilities and Diagnostics]

Represents a parameterized memory table. More...

#include <rw/db/tpmemtab.h>

Inheritance diagram for RWDBTPtrMemTable< T, C >:
RWDBTMemTableBase RWDBTable

List of all members.

Public Member Functions

 RWDBTPtrMemTable (size_t maxElements=0)
 RWDBTPtrMemTable (const RWDBTable &table, size_t maxElements=0)
 RWDBTPtrMemTable (const RWDBTable &table, const RWDBConnection &connection, size_t maxElements=0)
 RWDBTPtrMemTable (const RWDBSelectorBase &selector, size_t maxElements=0)
 RWDBTPtrMemTable (const RWDBSelectorBase &selector, const RWDBConnection &connection, size_t maxElements=0)
 RWDBTPtrMemTable (RWDBReader &reader, size_t maxElements=0)
size_t entries ()
T * operator[] (size_t index)

Detailed Description

template<class T, class C>
class RWDBTPtrMemTable< T, C >

This class represents a parameterized memory table. Not only can the type of the object inserted into the memory table be parameterized, but also the implementation.

Parameter T represents the type of the object to be stored in the memory table. It can be a class or a built-in type. The class must have:

Parameter C represents the pointer- based template collection used as the implementation of the memory table. It must have:

Possible choices for C are classes RWTPtrSlist and RWTPtrOrderedVector of the Essential Tools Module.

The constructors for the class dynamically allocate space for the elements of type T that are placed in the collection. It is the application's responsibility to free this memory when the RWDBTPtrMemTable goes out of scope. An effective way to do this is to have the collection class C call operator delete on each of the entries in its destructor.

Synopsis

 #include <rw/db/tpmemtab.h>

 RWDBTPtrMemTable<T, C> mt;

Constructor & Destructor Documentation

template<class T, class C>
RWDBTPtrMemTable< T, C >::RWDBTPtrMemTable ( size_t  maxElements = 0  ) 

Constructor that builds an empty instance with an upper limit of maxElements. If maxElements is zero, no upper limit is imposed on the number of elements in the memory table.

template<class T, class C>
RWDBTPtrMemTable< T, C >::RWDBTPtrMemTable ( const RWDBTable table,
size_t  maxElements = 0 
)

Constructor that builds an instance with an upper limit of maxElements. If maxElements is zero, no upper limit is imposed on the number of elements in the memory table. After building the memory table, an RWDBReader instance is created on the table. From this reader, up to maxElements instances of class T are allocated and inserted into the memory table. It is the application's responsibility to free the memory associated with the table.

template<class T, class C>
RWDBTPtrMemTable< T, C >::RWDBTPtrMemTable ( const RWDBTable table,
const RWDBConnection connection,
size_t  maxElements = 0 
)

Constructor that builds an instance with an upper limit of maxElements. If maxElements is zero, no upper limit is imposed on the number of elements in the memory table. After building the memory table, an RWDBReader instance, using the connection specified by connection, is created on the table. From this reader, up to maxElements instances of class T are allocated and inserted into the memory table. It is the application's responsibility to free the memory associated with the table.

template<class T, class C>
RWDBTPtrMemTable< T, C >::RWDBTPtrMemTable ( const RWDBSelectorBase selector,
size_t  maxElements = 0 
)

Constructor that builds an instance with an upper limit of maxElements. If maxElements is zero, no upper limit is imposed on the number of elements in the memory table. After building the memory table, an RWDBReader instance is created on the selector. From this reader, up to maxElements instances of class T are allocated and inserted into the memory table. It is the application's responsibility to free the memory associated with the table.

template<class T, class C>
RWDBTPtrMemTable< T, C >::RWDBTPtrMemTable ( const RWDBSelectorBase selector,
const RWDBConnection connection,
size_t  maxElements = 0 
)

Constructor that builds an instance with an upper limit of maxElements. If maxElements is zero, no upper limit is imposed on the number of elements in the memory table. After building the memory table, an RWDBReader instance, using the connection specified by connection, is created on the selector. From this reader, up to maxElements instances of class T are allocated and inserted into the memory table. It is the application's responsibility to free the memory associated with the table.

template<class T, class C>
RWDBTPtrMemTable< T, C >::RWDBTPtrMemTable ( RWDBReader reader,
size_t  maxElements = 0 
)

Constructor that builds an instance with an upper limit of maxElements. If maxElements is zero, no upper limit is imposed on the number of elements in the memory table. After building the memory table, the RWDBReader instance reader is used to allocate and insert into the memory table up to maxElements instances of class T. It is the application's responsibility to free the memory associated with the table.


Member Function Documentation

template<class T, class C>
size_t RWDBTPtrMemTable< T, C >::entries (  ) 

Returns number of rows in self. Uses user-defined method C::entries().

template<class T, class C>
T* RWDBTPtrMemTable< T, C >::operator[] ( size_t  index  ) 

Returns a pointer to the T* in self at position index. Uses user-defined operator T* C::operator[](size_t index).

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.