Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

ProtoBase Class Reference

Abstract ancestor of class prototypes. More...

#include <cProtoBase.h>

Inheritance diagram for ProtoBase:

Inheritance graph
[legend]
Collaboration diagram for ProtoBase:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual char * _Where () const
virtual char * _OrderBy () const
virtual class ResultBase * ExecuteQuery (const QueRefProto &Q, class Connection *DbCon, const int i, class ResultBase *QR)
bool operator== (class ProtoBase &_p)
bool operator!= (class ProtoBase &_p)
bool operator< (class ProtoBase &_p)
bool operator> (class ProtoBase &_p)
bool operator<= (class ProtoBase &_p)
bool operator>= (class ProtoBase &_p)
 ProtoBase ()
virtual ~ProtoBase ()
virtual bool IsObject ()
virtual bool IsImmutableObject ()
virtual bool IsDatabaseObject ()
virtual bool IsPersistentObject ()
virtual bool IsIopcPersistentObject ()
virtual const char * ClassName ()=0
virtual const char * BaseClassName ()
virtual const char * RootClassName ()=0
virtual const char * ParentClassNames ()=0
virtual const char * Select ()
virtual const char * Into ()
virtual const char * From ()=0
virtual const char * Where ()
virtual const char * GroupBy ()
virtual const char * Having ()
virtual const char * OrderBy () const=0
virtual const char * FullSelect ()
virtual const char * FullFrom ()
virtual char * FullFrom (int k)
virtual const char * FullWhere ()
virtual char * FullWhere (int k)
virtual const char * KeySelect ()
virtual const char * KeyWhere ()
virtual const char * KeyFrom ()
virtual class ProtoBase * RootPrototype () const
virtual int ParentPrototypeCount ()
virtual class ProtoBase * ParentPrototype (const int i)
virtual int FullParentPrototypeCount ()
virtual class ProtoBase * FullParentPrototype (const int i)
virtual class Object * New () const=0
virtual class RefBase * NewRef ()=0
const char * ColumnTable (const char *const col)
bool LockTable (class Connection *aDbCon, enum LockingStrategy aLockingStrategy=LS_Default, enum WaitingStrategy aWaitingStrategy=WS_Default)
bool WriteDDL (std::ofstream &S, class Database &Db)
char * ColumnTypeDDL (int i, class Database &Db)

Static Public Member Functions

void Register (class ProtoBase *_p, const char *_n)
ProtoBase * Find (const char *_n)

Protected Member Functions

virtual bool _KeyValues (char *&s)
virtual char * _KeyValues (const class Object &o)
virtual bool _ExportAttributes (const class Object &o)
virtual bool _ExportKeyAttributes (const class Object &o)
virtual bool _ExportKeyAttributes (const class RefBase &x)
virtual bool _ImportAttributes (class Object &o)
virtual bool _ImportKeyAttributes (class RefBase &x)
virtual void _Initialise ()
void _InitialiseParentPrototype ()
void _InitialiseFullParentPrototype (class ProtoBase *_p)
void _InitialiseSqlVar ()
void _InitialiseSelect ()
void _InitialiseFullSelect ()
void _InitialiseKeySelect ()
void _InitialisePtrSelect ()
void _InitialiseInto ()
void _InitialiseFullFrom ()
void _InitialiseWhere ()
void _InitialiseFullWhere ()
void _InitialiseKeyWhere ()
void _InitialiseGroupBy ()
void _InitialiseHaving ()
void _InitialiseStmtSelect ()
void _InitialiseStmtInsert ()
void _InitialiseStmtDelete ()
void _InitialiseStmtUpdate ()
char * _StmtSelectPtr (const QueRefProto &Q, const int i)
char * _StmtSelectPtr (const char *const _where_clause, const char *const _order_by_clause, const char *const _select_clause, const char *const _from_clause, const int i)
bool _BindPtr (class Cursor *C)
virtual ProtoBase * _PtrPrototype ()
virtual char * _RealiasT (char *&fragment, const char *table, const int i, const int j)
virtual char * _RealiasT (char *&fragment, const int i)
virtual void _MapKey (int i, const char *&attr, unsigned char Object::*&mem, const char *&col, char &type, unsigned int &len, bool &rw)=0
virtual void _Map (int i, const char *&attr, unsigned char Object::*&mem, const char *&col, char &type, unsigned int &len, bool &rw)=0
virtual const char * _ProtoTWhere ()=0
virtual const char * _ProtoTGroupBy ()=0
virtual const char * _ProtoTHaving ()=0
bool _InsertAll (class Object *target)
bool _Insert (class Connection *aDbConn)
bool _UpdateAll (class Object *target)
bool _Update (class Connection *aDbConn)
bool _DeleteAll (class Object *target)
bool _Delete (class Connection *aDbConn)
virtual bool _Load (class Object *o)
virtual bool _DeleteAll (class RefBase *target)
char * _TranslateToSql (char *(&dst), const char *const src)
char * _TranslateToSql (char *(&src))
Query & _TranslateToSql (class Query &Q)
virtual char * _TranslateAttributesToColumns (char *src)
virtual bool _BindKeysAndClassIdentificatingAttributes (Cursor *cursor)
ProtoBase * _gcs (ProtoBase &X)

Static Protected Member Functions

void _ResetProcessed (ProtoBase *const _p)

Protected Attributes

ProtoBase * _left
ProtoBase * _right
ProtoBase * _next
bool _initialised
bool _processed
bool _isObject
bool _isImmutableObject
bool _isDatabaseObject
bool _isPersistentObject
bool _isRootClass
char * _condition
struct {
   int   KeyCount
   int   Count
   int   SpecCount
   void *   Arr
} _sqlVars
ProtoBase * _rootPrototype
int _parentPrototypeCount
ProtoBase ** _parentPrototype
int _fullParentPrototypeCount
ProtoBase ** _fullParentPrototype
char * _select
char * _fullSelect
char * _keySelect
char * _ptrSelect
char * _into
char * _fullFrom
char * _where
char * _fullWhere
char * _keyWhere
char * _groupBy
char * _having
char * _stmtSelect
char * _stmtInsert
char * _stmtDelete
char * _stmtUpdate

Static Protected Attributes

ProtoBase * _root = NULL
ProtoBase * _first = NULL

Detailed Description

Abstract ancestor of class prototypes.

POLiTe library introduced concept of prototypes. Prototypes are ancestors of this class. For each user persistent capable class there is one instance of a prototype in POLiTe system. This instance contains data and methods needed to support persistence of the user class.

Most classes coming from POLiTe use prototypes, so it would be very difficult to eliminate prototypes from IOPC. But because this class was designed only for use in POLiTe library, that is based on macro processing and supports only one way of storing objects in database, most functions of this class does not make any sence in IOPC. So I (Josef Troch) developed class IopcProtoBaseAdaptor that implements all methods declared in this class, that needed to be overriden - most of them are fake methods. All important actions IopcProtoBaseAdaptor delegates to appropriate IopcClassObjectImpl.

So, for each class that is descendant of IopcPersistentObject there is one instance of IopcProtoBaseAdaptor in IOPC system. For POLiTe-style persistent classes original template Proto<T> is used.

This class was slightly documented in POLiTe, these old comments can be found in class's header, not in doxygen. I (Josef Troch) have added only this introductory comment and I have also commented all functions, that I had added or significantly modified. To find out, what should other methods of this class do, it may be usefull to view documentation of IopcProtoBaseAdaptor.

Most functions of this class returns true if OK, false in case of error.


Constructor & Destructor Documentation

ProtoBase::ProtoBase (   )  [inline]
 

ProtoBase::~ProtoBase (   )  [virtual]
 


Member Function Documentation

void ProtoBase::_ResetProcessed (  ProtoBase *const  _p  )  [static, protected]
 

bool ProtoBase::_KeyValues (  char *&  s  )  [protected, virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

char * ProtoBase::_KeyValues (  const class Object &  o  )  [protected, virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

bool ProtoBase::_ExportAttributes (  const class Object &  o  )  [protected, virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

bool ProtoBase::_ExportKeyAttributes (  const class Object &  o  )  [protected, virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

bool ProtoBase::_ExportKeyAttributes (  const class RefBase &  x  )  [protected, virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

bool ProtoBase::_ImportAttributes (  class Object &  o  )  [protected, virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

bool ProtoBase::_ImportKeyAttributes (  class RefBase &  x  )  [protected, virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

void ProtoBase::_Initialise (   )  [protected, virtual]
 

Initializes the prototype.

Note:
I (Josef Troch) have made it virtual - IopcProtoBaseAdaptor doesn't need do to anything in this function.

Reimplemented in IopcProtoBaseAdaptor.

void ProtoBase::_InitialiseParentPrototype (   )  [protected]
 

void ProtoBase::_InitialiseFullParentPrototype (  class ProtoBase *  _p  )  [protected]
 

void ProtoBase::_InitialiseSqlVar (   )  [protected]
 

void ProtoBase::_InitialiseSelect (   )  [protected]
 

void ProtoBase::_InitialiseFullSelect (   )  [protected]
 

void ProtoBase::_InitialiseKeySelect (   )  [protected]
 

void ProtoBase::_InitialisePtrSelect (   )  [protected]
 

void ProtoBase::_InitialiseInto (   )  [protected]
 

void ProtoBase::_InitialiseFullFrom (   )  [protected]
 

void ProtoBase::_InitialiseWhere (   )  [protected]
 

void ProtoBase::_InitialiseFullWhere (   )  [protected]
 

void ProtoBase::_InitialiseKeyWhere (   )  [protected]
 

void ProtoBase::_InitialiseGroupBy (   )  [protected]
 

void ProtoBase::_InitialiseHaving (   )  [protected]
 

void ProtoBase::_InitialiseStmtSelect (   )  [protected]
 

void ProtoBase::_InitialiseStmtInsert (   )  [protected]
 

void ProtoBase::_InitialiseStmtDelete (   )  [protected]
 

void ProtoBase::_InitialiseStmtUpdate (   )  [protected]
 

char * ProtoBase::_StmtSelectPtr (  const QueRefProto &  Q,
const int  i
)  [protected]
 

char * ProtoBase::_StmtSelectPtr (  const char *const  _where_clause,
const char *const  _order_by_clause,
const char *const  _select_clause,
const char *const  _from_clause,
const int  i
)  [protected]
 

bool ProtoBase::_BindPtr (  class Cursor *  C  )  [protected]
 

ProtoBase * ProtoBase::_PtrPrototype (   )  [protected, virtual]
 

Returns prototype of object that was the result of last query executed using this prototype (see ExecuteQuery() / _BindKeysAndClassIdentificatingAttributes() ). This function is there to provide polymorphism of queries and references.

Note:
I (Josef Troch) have made this method virtual because I need to redefine it in IopcProtoBaseAdaptor.
Returns:
The prototype.

Reimplemented in IopcProtoBaseAdaptor.

virtual char* ProtoBase::_Where (   )  const [inline, virtual]
 

Implements QueRefProto.

Reimplemented in IopcProtoBaseAdaptor.

virtual char* ProtoBase::_OrderBy (   )  const [inline, virtual]
 

Implements QueRefProto.

Reimplemented in IopcProtoBaseAdaptor.

void ProtoBase::Register (  class ProtoBase *  _p,
const char *  _n
)  [static]
 

ProtoBase * ProtoBase::Find (  const char *  _n  )  [static]
 

class ResultBase * ProtoBase::ExecuteQuery (  const QueRefProto &  Q,
class Connection *  DbCon,
const int  i,
class ResultBase *  QR
)  [virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

bool ProtoBase::operator== (  class ProtoBase &  _p  )  [inline]
 

bool ProtoBase::operator!= (  class ProtoBase &  _p  )  [inline]
 

bool ProtoBase::operator< (  class ProtoBase &  _p  ) 
 

bool ProtoBase::operator> (  class ProtoBase &  _p  )  [inline]
 

bool ProtoBase::operator<= (  class ProtoBase &  _p  )  [inline]
 

bool ProtoBase::operator>= (  class ProtoBase &  _p  )  [inline]
 

virtual bool ProtoBase::IsObject (   )  [inline, virtual]
 

virtual bool ProtoBase::IsImmutableObject (   )  [inline, virtual]
 

virtual bool ProtoBase::IsDatabaseObject (   )  [inline, virtual]
 

virtual bool ProtoBase::IsPersistentObject (   )  [inline, virtual]
 

virtual bool ProtoBase::IsIopcPersistentObject (   )  [inline, virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

virtual const char* ProtoBase::ClassName (   )  [pure virtual]
 

Implemented in IopcProtoBaseAdaptor, and Proto< T >.

virtual const char* ProtoBase::BaseClassName (   )  [inline, virtual]
 

Reimplemented in IopcProtoBaseAdaptor, and Proto< T >.

virtual const char* ProtoBase::RootClassName (   )  [pure virtual]
 

Implemented in IopcProtoBaseAdaptor, and Proto< T >.

virtual const char* ProtoBase::ParentClassNames (   )  [pure virtual]
 

Implemented in IopcProtoBaseAdaptor, and Proto< T >.

virtual const char* ProtoBase::Select (   )  [inline, virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

virtual const char* ProtoBase::Into (   )  [inline, virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

virtual const char* ProtoBase::From (   )  [pure virtual]
 

Implemented in IopcProtoBaseAdaptor, and Proto< T >.

virtual const char* ProtoBase::Where (   )  [inline, virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

virtual const char* ProtoBase::GroupBy (   )  [inline, virtual]
 

Reimplemented in IopcProtoBaseAdaptor, and Proto< T >.

virtual const char* ProtoBase::Having (   )  [inline, virtual]
 

Reimplemented in IopcProtoBaseAdaptor, and Proto< T >.

virtual const char* ProtoBase::OrderBy (   )  const [pure virtual]
 

Implemented in IopcProtoBaseAdaptor, and Proto< T >.

virtual const char* ProtoBase::FullSelect (   )  [inline, virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

virtual const char* ProtoBase::FullFrom (   )  [inline, virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

char * ProtoBase::FullFrom (  int  k  )  [virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

virtual const char* ProtoBase::FullWhere (   )  [inline, virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

char * ProtoBase::FullWhere (  int  k  )  [virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

virtual const char* ProtoBase::KeySelect (   )  [inline, virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

virtual const char* ProtoBase::KeyWhere (   )  [inline, virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

virtual const char* ProtoBase::KeyFrom (   )  [inline, virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

virtual class ProtoBase* ProtoBase::RootPrototype (   )  const [inline, virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

virtual int ProtoBase::ParentPrototypeCount (   )  [inline, virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

class ProtoBase * ProtoBase::ParentPrototype (  const int  i  )  [virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

virtual int ProtoBase::FullParentPrototypeCount (   )  [inline, virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

class ProtoBase * ProtoBase::FullParentPrototype (  const int  i  )  [virtual]
 

Reimplemented in IopcProtoBaseAdaptor.

virtual class Object* ProtoBase::New (   )  const [pure virtual]
 

Implemented in IopcProtoBaseAdaptor, and Proto< T >.

virtual class RefBase* ProtoBase::NewRef (   )  [pure virtual]
 

Implemented in IopcProtoBaseAdaptor, and Proto< T >.

const char * ProtoBase::ColumnTable (  const char *const  col  ) 
 

Reimplemented in IopcProtoBaseAdaptor.

char * ProtoBase::_RealiasT (  char *&  fragment,
const char *  table,
const int  i,
const int  j
)  [protected, virtual]
 

char * ProtoBase::_RealiasT (  char *&  fragment,
const int  i
)  [protected, virtual]
 

virtual void ProtoBase::_MapKey (  int  i,
const char *&  attr,
unsigned char Object::*&  mem,
const char *&  col,
char &  type,
unsigned int &  len,
bool &  rw
)  [protected, pure virtual]
 

Implemented in IopcProtoBaseAdaptor, and Proto< T >.

virtual void ProtoBase::_Map (  int  i,
const char *&  attr,
unsigned char Object::*&  mem,
const char *&  col,
char &  type,
unsigned int &  len,
bool &  rw
)  [protected, pure virtual]
 

Implemented in IopcProtoBaseAdaptor, and Proto< T >.

virtual const char* ProtoBase::_ProtoTWhere (   )  [protected, pure virtual]
 

Implemented in IopcProtoBaseAdaptor, and Proto< T >.

virtual const char* ProtoBase::_ProtoTGroupBy (   )  [protected, pure virtual]
 

Implemented in IopcProtoBaseAdaptor, and Proto< T >.

virtual const char* ProtoBase::_ProtoTHaving (   )  [protected, pure virtual]
 

Implemented in IopcProtoBaseAdaptor, and Proto< T >.

bool ProtoBase::_InsertAll (  class Object *  target  )  [protected]
 

bool ProtoBase::_Insert (  class Connection *  aDbConn  )  [protected]
 

bool ProtoBase::_UpdateAll (  class Object *  target  )  [protected]
 

bool ProtoBase::_Update (  class Connection *  aDbConn  )  [protected]
 

bool ProtoBase::_DeleteAll (  class Object *  target  )  [protected]
 

bool ProtoBase::_Delete (  class Connection *  aDbConn  )  [protected]
 

bool ProtoBase::_Load (  class Object *  o  )  [protected, virtual]
 

Loads object's data into memory.

Note:
I (Josef Troch) have made this method virtual because I need to redefine it in IopcProtoBaseAdaptor.
Returns:
true if OK, false in case of error.

Reimplemented in IopcProtoBaseAdaptor.

bool ProtoBase::_DeleteAll (  class RefBase *  target  )  [protected, virtual]
 

Deletes pointed object from database.

Note:
I (Josef Troch) have made this method virtual because I need to redefine it in IopcProtoBaseAdaptor.
Returns:
true if OK, false in case of error.

Reimplemented in IopcProtoBaseAdaptor.

bool ProtoBase::LockTable (  class Connection *  aDbCon,
enum LockingStrategy  aLockingStrategy = LS_Default,
enum WaitingStrategy  aWaitingStrategy = WS_Default
) 
 

bool ProtoBase::WriteDDL (  std::ofstream &  S,
class Database &  Db
) 
 

Reimplemented in IopcProtoBaseAdaptor.

char * ProtoBase::ColumnTypeDDL (  int  i,
class Database &  Db
) 
 

char * ProtoBase::_TranslateToSql (  char *&  dst,
const char *const  src
)  [protected]
 

char * ProtoBase::_TranslateToSql (  char *&  src  )  [protected]
 

class Query & ProtoBase::_TranslateToSql (  class Query &  Q  )  [protected]
 

char * ProtoBase::_TranslateAttributesToColumns (  char *  src  )  [protected, virtual]
 

Translates attribute names to column names and class names to appropriate table/view names in given string

Called from _TranslateToSql(char * &, const char * const). This implementation comes from body of original _TranslateToSql(char * &, const char * const).

Note:
This method was added by Josef Troch.
Parameters:
src Input string.
Returns:
Resulting string.

Reimplemented in IopcProtoBaseAdaptor.

bool ProtoBase::_BindKeysAndClassIdentificatingAttributes (  Cursor *  cursor  )  [protected, virtual]
 

Binds key attribute(s) and attribute(s) that identify type (class) of object that will be later fetched (as a result of ExecuteQuery() call).

This function is there only to make it possible to redefine "standard" behaviour in IopcProtoBaseAdaptor. This implementation only calls _BindPtr().

Note:
This method was added by Josef Troch.
Parameters:
cursor Cursor to be used for binding
Returns:
true if OK, false otherwise.

Reimplemented in IopcProtoBaseAdaptor.

ProtoBase * ProtoBase::_gcs (  ProtoBase &  X  )  [protected]
 


Member Data Documentation

ProtoBase * ProtoBase::_root = NULL [static, protected]
 

ProtoBase * ProtoBase::_first = NULL [static, protected]
 

class ProtoBase* ProtoBase::_left [protected]
 

class ProtoBase * ProtoBase::_right [protected]
 

class ProtoBase * ProtoBase::_next [protected]
 

bool ProtoBase::_initialised [protected]
 

bool ProtoBase::_processed [protected]
 

bool ProtoBase::_isObject [protected]
 

bool ProtoBase::_isImmutableObject [protected]
 

bool ProtoBase::_isDatabaseObject [protected]
 

bool ProtoBase::_isPersistentObject [protected]
 

bool ProtoBase::_isRootClass [protected]
 

char* ProtoBase::_condition [protected]
 

int ProtoBase::KeyCount [protected]
 

int ProtoBase::Count [protected]
 

int ProtoBase::SpecCount [protected]
 

void* ProtoBase::Arr [protected]
 

struct { ... } ProtoBase::_sqlVars [protected]
 

class ProtoBase* ProtoBase::_rootPrototype [protected]
 

int ProtoBase::_parentPrototypeCount [protected]
 

class ProtoBase** ProtoBase::_parentPrototype [protected]
 

int ProtoBase::_fullParentPrototypeCount [protected]
 

class ProtoBase** ProtoBase::_fullParentPrototype [protected]
 

char* ProtoBase::_select [protected]
 

char* ProtoBase::_fullSelect [protected]
 

char* ProtoBase::_keySelect [protected]
 

char* ProtoBase::_ptrSelect [protected]
 

char* ProtoBase::_into [protected]
 

char* ProtoBase::_fullFrom [protected]
 

char* ProtoBase::_where [protected]
 

char* ProtoBase::_fullWhere [protected]
 

char* ProtoBase::_keyWhere [protected]
 

char* ProtoBase::_groupBy [protected]
 

char* ProtoBase::_having [protected]
 

char* ProtoBase::_stmtSelect [protected]
 

char* ProtoBase::_stmtInsert [protected]
 

char* ProtoBase::_stmtDelete [protected]
 

char* ProtoBase::_stmtUpdate [protected]
 


The documentation for this class was generated from the following files:
Generated on Wed Aug 11 22:36:19 2004 for IOPC by Doxygen 1.3.6