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

OOF_recordSelection Class Reference
[OOFILE Implementation Classes]

#include <oofrecs.h>

Inheritance diagram for OOF_recordSelection:

Inheritance graph
[legend]
Collaboration diagram for OOF_recordSelection:

Collaboration graph
[legend]
List of all members.

Detailed Description

Selection of records in context of a single dbTable instance.

Top level in 3-layer abstraction of selection. Implements physical sorting of the set of oidT's pointing to records. Also implements combinatorial operations as a set. Handle class for OOF_recordSelectionRep which implements the actual operations.


combinatorial operators

virtual void difference_with (const OOF_Selection *)
virtual void intersection_with (const OOF_Selection *)
virtual void intersection_with (oidT)
virtual void union_with (const OOF_Selection *)
virtual void union_with_no_overlap (const OOF_Selection *)
virtual void union_with (oidT)
 Implement optimal union_with when combining just one OID on rhs.

virtual void invert ()

local combinatorial implementations

void difference_with (const OOF_recordSelection &)
void intersection_with (const OOF_recordSelection &)
void union_with (const OOF_recordSelection &)
 Implement union_with set operation on current selection with state changes.

void union_with_no_overlap (const OOF_recordSelection &)
 Dangerous implementation with no checking.


reflective operators

EselectionState state () const
unsigned long oneRecOffset () const
virtual bool isEmpty () const
virtual bool isAllRecs () const
virtual bool contains (oidT) const
virtual bool find (oidT item, unsigned long &foundAt) const
virtual const dbTableprototypicalTable () const

change state

void selectNone ()
void selectOneRec (unsigned long)
void selectSome ()
void selectAll ()

access operators

unsigned long & operator[] (unsigned long)
unsigned long & operator[] (long)
unsigned long & operator() ()
unsigned long value (unsigned long) const
void append (oidT)
unsigned long appendNewRecord (bool appendIt)
 returns new synthetic record number

void deleteCurrent ()
void deleteItem (unsigned long index)
void updateCurrent (unsigned long)
unsigned long iter () const
 current position in selection

unsigned long current () const
 value of current item


iterator protocol

void start ()
bool more () const
void prev ()
void next ()
virtual unsigned long count () const
void gotoRecord (unsigned long)

Public Types

enum  EselectionState { empty, oneRec, someRecs, allRecs }

Public Member Functions

 OOF_recordSelection (dbTable *prototypicalTable)
 OOF_recordSelection (unsigned long numSlots, dbTable *prototypicalTable)
 OOF_recordSelection (const EselectionState, unsigned long numSlots, dbTable *prototypicalTable)
 OOF_recordSelection (unsigned long numSlots, unsigned int expansionChunk, dbTable *prototypicalTable)
 OOF_recordSelection (const OOF_recordSelection &)
virtual ~OOF_recordSelection ()
virtual OOF_Selectionclone () const
void describeState (std::ostream &os) const
void describeRecsRep (std::ostream &) const
void resetFakeNewRecordOffSet ()
OOF_recordSelectionoperator= (const OOF_recordSelection &)
void copyFrom (const OOF_recordSelection &, dbTable::selSharingT)
virtual void setSortOrder (dbSorter *adoptSorter)
virtual dbSortersorter () const
unsigned long * allocSelection (unsigned long numSlots)
unsigned long * allocConsumedSelection (unsigned long numSlots)
void expandToInclude (unsigned long numSlots)
void adopt (OOF_recordSelection &)
void copyContents (const OOF_recordSelection &)
void aboutToDirtySelection ()


Member Enumeration Documentation

enum OOF_SelectionStateDefiner::EselectionState [inherited]
 

Enumeration values:
empty 
oneRec 
someRecs 
allRecs 


Constructor & Destructor Documentation

OOF_recordSelection::OOF_recordSelection dbTable prototypicalTable  ) 
 

OOF_recordSelection::OOF_recordSelection unsigned long  numSlots,
dbTable prototypicalTable
 

OOF_recordSelection::OOF_recordSelection const  EselectionState,
unsigned long  numSlots,
dbTable prototypicalTable
 

OOF_recordSelection::OOF_recordSelection unsigned long  numSlots,
unsigned int  expansionChunk,
dbTable prototypicalTable
 

OOF_recordSelection::OOF_recordSelection const OOF_recordSelection  ) 
 

OOF_recordSelection::~OOF_recordSelection  )  [virtual]
 


Member Function Documentation

void OOF_recordSelection::aboutToDirtySelection  )  [inline]
 

void OOF_recordSelection::adopt OOF_recordSelection  ) 
 

unsigned long * OOF_recordSelection::allocConsumedSelection unsigned long  numSlots  )  [inline]
 

unsigned long * OOF_recordSelection::allocSelection unsigned long  numSlots  )  [inline]
 

void OOF_recordSelection::append oidT   )  [inline]
 

unsigned long OOF_recordSelection::appendNewRecord bool  appendIt  ) 
 

returns new synthetic record number

Returns:
mNextFakeNewRecOffset
Parameters:
appendIt indicates we should append mNextFakeNewRecOffset and increment it.
Only append new records to the selection if we expect to iterate the selection and keep new records around. This only applies if the save mode is requireExplicitAndBuffer otherwise it is impossible to move off the new record without either saving, unloading or an error. someBackend::SaveContext() will call OOF_recordSelection::append in those cases or OOF_recordSelection::updateCurrent if we've already appended a (synthetic) new record No.

In the normal use of a database, newRecord will occur many times and the fake rec offset is reused over and over. Otherwise we have problems with them hitting a boundary, either colliding with real offsets (if started at 0) or end of numeric range. If we put them into the selection, how does it get updated with the real offset?

Todo:
work out if it is safe to always append the fake offsets to selection and implications such as having to increment mNextFakeNewRecOffset, complicating normal newRecord case etc.

OOF_Selection * OOF_recordSelection::clone  )  const [virtual]
 

Implements OOF_Selection.

bool OOF_recordSelection::contains oidT   )  const [inline, virtual]
 

Implements OOF_Selection.

void OOF_recordSelection::copyContents const OOF_recordSelection  )  [inline]
 

void OOF_recordSelection::copyFrom const OOF_recordSelection ,
dbTable::selSharingT 
 

unsigned long OOF_recordSelection::count  )  const [inline, virtual]
 

Implements OOF_Selection.

unsigned long OOF_recordSelection::current  )  const [inline]
 

value of current item

void OOF_recordSelection::deleteCurrent  ) 
 

void OOF_recordSelection::deleteItem unsigned long  index  ) 
 

void OOF_recordSelection::describeRecsRep std::ostream &   )  const
 

void OOF_recordSelection::describeState std::ostream &  os  )  const
 

void OOF_recordSelection::difference_with const OOF_recordSelection  ) 
 

void OOF_recordSelection::difference_with const OOF_Selection  )  [virtual]
 

Implements OOF_Selection.

void OOF_recordSelection::expandToInclude unsigned long  numSlots  )  [inline]
 

bool OOF_recordSelection::find oidT  item,
unsigned long &  foundAt
const [inline, virtual]
 

Implements OOF_Selection.

void OOF_recordSelection::gotoRecord unsigned  long  )  [inline]
 

void OOF_recordSelection::intersection_with const OOF_recordSelection  ) 
 

void OOF_recordSelection::intersection_with oidT   )  [virtual]
 

Implements OOF_Selection.

void OOF_recordSelection::intersection_with const OOF_Selection  )  [virtual]
 

Implements OOF_Selection.

void OOF_recordSelection::invert  )  [virtual]
 

Implements OOF_Selection.

bool OOF_recordSelection::isAllRecs  )  const [inline, virtual]
 

Implements OOF_Selection.

bool OOF_recordSelection::isEmpty  )  const [inline, virtual]
 

Implements OOF_Selection.

unsigned long OOF_recordSelection::iter  )  const [inline]
 

current position in selection

bool OOF_recordSelection::more  )  const [inline]
 

void OOF_recordSelection::next  )  [inline]
 

unsigned long OOF_recordSelection::oneRecOffset  )  const [inline]
 

unsigned long & OOF_recordSelection::operator()  )  [inline]
 

OOF_recordSelection & OOF_recordSelection::operator= const OOF_recordSelection  ) 
 

unsigned long & OOF_recordSelection::operator[] long   )  [inline]
 

unsigned long & OOF_recordSelection::operator[] unsigned  long  )  [inline]
 

void OOF_recordSelection::prev  )  [inline]
 

const dbTable * OOF_recordSelection::prototypicalTable  )  const [virtual]
 

Implements OOF_Selection.

void OOF_recordSelection::resetFakeNewRecordOffSet  )  [inline]
 

void OOF_recordSelection::selectAll  )  [inline]
 

void OOF_recordSelection::selectNone  )  [inline]
 

void OOF_recordSelection::selectOneRec unsigned  long  )  [inline]
 

void OOF_recordSelection::selectSome  )  [inline]
 

void OOF_recordSelection::setSortOrder dbSorter adoptSorter  )  [virtual]
 

dbSorter * OOF_recordSelection::sorter  )  const [virtual]
 

void OOF_recordSelection::start  )  [inline]
 

OOF_recordSelection::EselectionState OOF_recordSelection::state  )  const [inline]
 

void OOF_recordSelection::union_with const OOF_recordSelection rhs  ) 
 

Implement union_with set operation on current selection with state changes.

Todo:
transitions to selectAll state if combined someRecs with oneRec or someRecs

void OOF_recordSelection::union_with oidT  rhsOffset  )  [virtual]
 

Implement optimal union_with when combining just one OID on rhs.

Implements OOF_Selection.

void OOF_recordSelection::union_with const OOF_Selection  )  [virtual]
 

Implements OOF_Selection.

void OOF_recordSelection::union_with_no_overlap const OOF_recordSelection rhs  ) 
 

Dangerous implementation with no checking.

May allow you to create selections with duplicate record pointers. Use very much at own risk!

Todo:
investigate if can be faster in case where empty combined with someRecs

transitions to selectAll state if combined someRecs with oneRec or someRecs

void OOF_recordSelection::union_with_no_overlap const OOF_Selection  )  [virtual]
 

Implements OOF_Selection.

void OOF_recordSelection::updateCurrent unsigned  long  ) 
 

unsigned long OOF_recordSelection::value unsigned  long  )  const [inline]
 


The documentation for this class was generated from the following files:
Generated on Thu Jan 1 21:45:10 2004 for OOFILE by doxygen 1.3.5