Stream Class Reference
[Public API]

Stream class is base class for Object Output Stream (OStream) and Object Input Stream (IStream) classes. More...

#include <stream.h>

Inheritance diagram for Stream:

Inheritance graph
[legend]
List of all members.

Public Member Functions

void bind (const char *pTable, const char *pField, StoreableFilterBase *pFilter, Database::StoreType pType=Database::STRING)
 Bind custom variable to stream.
BindedInt bindInt (const char *pTable, const char *pField, StoreableFilterBase *pFilter=NULL)
 Binds int value to database column.
BindedStid bindStid (const char *pTable, const char *pField, StoreableFilterBase *pFilter=NULL)
 Bind id value to database column.
BindedString bindString (const char *pTable, const char *pField, StoreableFilterBase *pFilter=NULL)
 Binds string value to database column.
virtual void close ()=0
 Close stream.
virtual void destroy ()=0
 Destroy stream.
virtual bool isOpen () const
 Check if stream is open.
virtual void open (Storeable &pObject, const char *pRootTable=NULL)
 Prepare stream by creating member tree from pObject.
void setRootTable (const char *pRootTable)
 Change main table name.
 Stream ()
 Constructor.
void unbind (const char *pTableName, const char *pField)
 Unbind one variable.
void unbindAll (const char *pTableName)
 Unbind all variables related to sql table.
void unbindAll ()
 Unbind all variables from stream.
virtual ~Stream ()
 Desctructor.

Protected Types

typedef std::list< _bind_dataVarMap
 Type of list variables binded to stream.

Protected Member Functions

void alterId (Storeable *pObject, int pNewId)
 alter object id.
int countTables (Storeable *pObject)
 Get total number of store tables for object.
void createTree (const StoreTable *pRootTable)
 Create member tree from store tables and binded variables.
const ColTable * getColTable (Storeable &pObject)
 Get root collection table for object.
int getStoredTables (Storeable *pObject)
 Get number of tables from bottom of class hierarchy that are already stored in database.
const StoreTable * getTable (Storeable &pObject)
 Get root store table for object.
virtual bool isCollectionFilterSupported () const
 True if stream can use BIND_COL capability of Storeable object to load and store referenced objects.
void makeOk (Storeable *pObject)
 Make object ok.
void setStoredTables (Storeable *pObject, int pTables)
 Set number of tables that were stored in database.

Static Protected Member Functions

static void setFilterPtr (StoreableFilterBase &pFilter, void *pMember)
 Update filter pointer to actual pointer to member of Storeable object Used by applyFilter functions to set pointer to member before using filter.

Protected Attributes

VarMap mBindings
 List of variables binded to stream.
bool mIsOpen
 true if stream is open
shared_ptr< mt_mlist > mMemberList
 List of members from store table.
const char * mRootTable
 Name of overriden root table.

Classes

class  _bind_data
 Data for binded variables. More...
class  bindMatch
 Relation between binded variable pointer and store table member identification. More...

Detailed Description

Stream class is base class for Object Output Stream (OStream) and Object Input Stream (IStream) classes.


Member Function Documentation

void alterId Storeable pObject,
int  pNewId
[protected]
 

alter object id.

Parameters:
pObject object that should be set to OK state
pNewId new id for object

void bind const char *  pTable,
const char *  pField,
StoreableFilterBase pFilter,
Database::StoreType  pType = Database::STRING
 

Bind custom variable to stream.

pFilter should be constructed using reference to variable that holds value that should be stored in database. Lifetime of variable have to be greater than stream where it is binded to. pType is a conversion hint.

Parameters:
pTable name relation that owns pField
pField name of field
pFilter conversion filter that holds binded variable
pType conversion hint for database and filter

BindedInt bindInt const char *  pTable,
const char *  pField,
StoreableFilterBase pFilter = NULL
 

Binds int value to database column.

Parameters:
pTable database relation that we want to bind to
pField column that variable will be binded to
pFilter filter that converts database internal representation to int value.
Deprecated:
use bind instead

BindedStid bindStid const char *  pTable,
const char *  pField,
StoreableFilterBase pFilter = NULL
 

Bind id value to database column.

Parameters:
pTable database relation that we want to bind to
pField column that variable will be binded to
pFilter filter that converts database internal representation to int value.
Deprecated:
use bind instead
Warning:
this method has no effect after stream is opened using open().
Returns:
id variable that is binded to field pMember in relation pClass

BindedString bindString const char *  pTable,
const char *  pField,
StoreableFilterBase pFilter = NULL
 

Binds string value to database column.

Parameters:
pTable database relation that we want to bind to
pField column that variable will be binded to
pFilter filter that converts database internal representation to int value.
Deprecated:
use bind instead

int countTables Storeable pObject  )  [protected]
 

Get total number of store tables for object.

Parameters:
pObject object to examine
Returns:
number of store tables

virtual void destroy  )  [pure virtual]
 

Destroy stream.

After call to this function stream is destroyed and cannot be opened any more. It usually means that connection to database that this stream represents is closed after this method was called

Implemented in CSVIStream, CSVOStream, SQLIStream, and SQLOStream.

const ColTable* getColTable Storeable pObject  )  [protected]
 

Get root collection table for object.

Parameters:
pObject object to examine

int getStoredTables Storeable pObject  )  [protected]
 

Get number of tables from bottom of class hierarchy that are already stored in database.

Parameters:
pObject object to examine
Returns:
number of store tables

const StoreTable* getTable Storeable pObject  )  [protected]
 

Get root store table for object.

Parameters:
pObject object to examine

virtual bool isOpen  )  const [virtual]
 

Check if stream is open.

Returns:
true if stream is open, false otherwise.

Reimplemented in SQLOStream.

void makeOk Storeable pObject  )  [protected]
 

Make object ok.

Parameters:
pObject object that should be set to OK state

virtual void open Storeable pObject,
const char *  pRootTable = NULL
[virtual]
 

Prepare stream by creating member tree from pObject.

Parameters:
pObject object to examine
pRootTable custom root table name

Reimplemented in CSVIStream, and SQLIStream.

static void setFilterPtr StoreableFilterBase pFilter,
void *  pMember
[static, protected]
 

Update filter pointer to actual pointer to member of Storeable object Used by applyFilter functions to set pointer to member before using filter.

Parameters:
pFilter filter instance
pMember pointer to member for filter

void setRootTable const char *  pRootTable  ) 
 

Change main table name.

For input stream this must be called before open, for output stream if called before put for object with NULL root table, it changes table name where object is stored

Parameters:
pRootTable name of root table or NULL if name from store table should be used

void setStoredTables Storeable pObject,
int  pTables
[protected]
 

Set number of tables that were stored in database.

Parameters:
pObject object to update
pTables new number of tables

void unbind const char *  pTableName,
const char *  pField
 

Unbind one variable.

Parameters:
pTableName name of table
pField name of field

void unbindAll const char *  pTableName  ) 
 

Unbind all variables related to sql table.

Parameters:
pTableName name of table for variables to unbind

void unbindAll  ) 
 

Unbind all variables from stream.

They will not be updated when getting next objects from stream


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

Documentation
Quick start
Examples
Search

API Documentation
Class hierarchy
Member index
API Reference
Store filters
Store table macros
Back

Generated by doxygen at Sun Nov 9 02:08:32 2008