class dbHV

Class that controls the dbHV access

Public Methods

inline const ooHandle ( ooDBObj )()
Returns the ooHandle to the database
int abortTr()
Aborts a transation - dbHV becomes unusable after that (see above).
int commitAndHoldTr()
Commits and holds a transaction
int commitTr()
Commits a transation - should never be called by the user (see above).
static dbHV* createDB( const char* name, const uint32 maxpages = 500 )
Creates the database
dbHV( const char* name, const ooHandle( ooFDObj ) fdbh, const ooHandle( ooDBObj ) dbh, ooTrans *ooTr )
Constructor which has as arguments the valid ooHandles of the FDB and DB
inline const char* getName()
Returns the name of the database
static dbHV* openDB( const char* name, const char mode = 'r', const uint32 maxpages = 500)
Opens an existing database
static int openFDB( ooHandle( ooFDObj )& fdb )
Opens the federated database
static int removeDB( const char* pcName )
Removes the database (i
int startTr()
Starts a transation - should never be called by the user (see above).
~dbHV()
Destructor. Commits the transaction and closes the database.

Private Fields

ooTrans* myTr
Pointer to the current transaction
static int ooInitCalled
To avoid calling ooInit more than once. True if ooInit was called.
char* pcName
Name of the database

Private Methods

ooHandle(ooDBObj)
ooHandle of the database
ooHandle(ooFDObj)
ooHandle of the FDB

Documentation

Class that controls the dbHV access. Purpose: Hide all details of the database from the user. Current implementation of the database: objectivity 5.0

The static member functions createDB and openDB are used to create/open the HV database. These member functions in turn instantiate the dbHV object.

Note on the transaction model: objectivity closes the federated database once the transaction is committed. We therefore tie one (and only one) transaction to the database and do not commit the transaction as long as the object dbHV is supposed to be in use. Once the transation is committed, this object becomes useless and has to be reinstantiated. [This of course does not apply to commitAndHold.] Note: This behaviour could easily be changed if desired by checking whether a transation is going on and reopening the FDB and DB if this is not the case [to be implemented].

MODIFICATIONS:

dbHV( const char* name, const ooHandle( ooFDObj ) fdbh, const ooHandle( ooDBObj ) dbh, ooTrans *ooTr )
Constructor which has as arguments the valid ooHandles of the FDB and DB. Checks whether the DB already exists and has all the default objects in it. If not creates the various containers and default objects (such as the default setpoints).
Parameters:
name - : name of the database (a string)
fdbh - : handle of the federated database
dbh - : handle of the HV database
ooTr - : pointer to the transaction (see above).

~dbHV()
Destructor. Commits the transaction and closes the database.

static dbHV* createDB( const char* name, const uint32 maxpages = 500 )
Creates the database. If the database already exists, it will be opened in oocUpdate mode. Does all the necessary things to initialise Objectivity/DB and starts the transation before it instatiates the object dbHV.
Returns:
: Pointer to the dbHV object or NULL
Parameters:
maxpages - : Maximum number of Logical pages the program many allocate (default 500)

static dbHV* openDB( const char* name, const char mode = 'r', const uint32 maxpages = 500)
Opens an existing database. If the database does not exist, returns NULL pointer.
Parameters:
name - : name of the database
mode - : r for read only access, w for write access
maxpages - : Maximum number of Logical pages the program many allocate (default 500)

static int removeDB( const char* pcName )
Removes the database (i.e. deletes it and removes it from the FDB).
Returns:
hvcSuccess or hvcError;
Parameters:
pcName - : name of the database

static int openFDB( ooHandle( ooFDObj )& fdb )
Opens the federated database
Returns:
hvcSuccess or hvcError
Parameters:
fdb - : reference to the handle of the fdb (in case of success)

int startTr()
Starts a transation - should never be called by the user (see above).

int abortTr()
Aborts a transation - dbHV becomes unusable after that (see above).

int commitTr()
Commits a transation - should never be called by the user (see above).

int commitAndHoldTr()
Commits and holds a transaction
Returns:
hvcSuccess or hvcError

inline const char* getName()
Returns the name of the database

inline const ooHandle ( ooDBObj )()
Returns the ooHandle to the database. Is of use if one wants to access the database directly.

static int ooInitCalled
To avoid calling ooInit more than once. True if ooInit was called.

char* pcName
Name of the database

ooHandle(ooFDObj)
ooHandle of the FDB

ooHandle(ooDBObj)
ooHandle of the database

ooTrans* myTr
Pointer to the current transaction


This class has no child classes.
Author:
C.Witzig
Date: Aug 17, 98
Version:
Last update Aug 25, 98

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de