OOFILE  1.9
Public Types | Public Member Functions | List of all members
OOF_recordSelection Class Reference

Selection of records in context of a single dbTable instance. More...

#include <oofrecs.h>

Inheritance diagram for OOF_recordSelection:
Inheritance graph
[legend]
Collaboration diagram for OOF_recordSelection:
Collaboration graph
[legend]

Public Types

enum  EselectionState { empty, oneRec, someRecs, allRecs }
 

Public Member Functions

void aboutToDirtySelection ()
 
void adopt (OOF_recordSelection &)
 
unsigned long * allocConsumedSelection (unsigned long numSlots)
 
unsigned long * allocSelection (unsigned long numSlots)
 
virtual OOF_Selectionclone () const
 
void copyContents (const OOF_recordSelection &)
 
void copyFrom (const OOF_recordSelection &, dbTable::selSharingT)
 
void describeRecsRep (std::ostream &) const
 
void describeState (std::ostream &os) const
 
void expandToInclude (unsigned long numSlots)
 
 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 &)
 
OOF_recordSelectionoperator= (const OOF_recordSelection &)
 
void resetFakeNewRecordOffSet ()
 
virtual void setSortOrder (dbSorter *adoptSorter)
 
virtual dbSortersorter () const
 
virtual ~OOF_recordSelection ()
 
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. More...
 
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. More...
 
void union_with_no_overlap (const OOF_recordSelection &)
 Dangerous implementation with no checking. More...
 
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 More...
 
void deleteCurrent ()
 
void deleteItem (unsigned long index)
 
void updateCurrent (unsigned long)
 
unsigned long iter () const
 current position in selection More...
 
unsigned long current () const
 value of current item More...
 
iterator protocol
void start ()
 
bool more () const
 
void prev ()
 
void next ()
 
virtual unsigned long count () const
 
void gotoRecord (unsigned long)
 

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.

Definition at line 173 of file oofrecs.h.

Constructor & Destructor Documentation

OOF_recordSelection::OOF_recordSelection ( dbTable prototypicalTable)

Definition at line 653 of file oofrec4.cpp.

Referenced by clone().

OOF_recordSelection::OOF_recordSelection ( unsigned long  numSlots,
dbTable prototypicalTable 
)

Definition at line 679 of file oofrec4.cpp.

OOF_recordSelection::OOF_recordSelection ( const EselectionState  selState,
unsigned long  numSlots,
dbTable prototypicalTable 
)

Definition at line 666 of file oofrec4.cpp.

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

Definition at line 692 of file oofrec4.cpp.

OOF_recordSelection::OOF_recordSelection ( const OOF_recordSelection rhs)

Definition at line 705 of file oofrec4.cpp.

OOF_recordSelection::~OOF_recordSelection ( )
virtual

Definition at line 780 of file oofrec4.cpp.

References OOF_mixRefCount::mReferences.

Member Function Documentation

void OOF_recordSelection::aboutToDirtySelection ( )
inline
void OOF_recordSelection::adopt ( OOF_recordSelection rhs)

Definition at line 836 of file oofrec4.cpp.

Referenced by OOF_simpleRecordBackend::SearchCombineSubclauses().

unsigned long * OOF_recordSelection::allocConsumedSelection ( unsigned long  numSlots)
inline

Definition at line 1049 of file oofrecs.h.

unsigned long * OOF_recordSelection::allocSelection ( unsigned long  numSlots)
inline

Definition at line 1028 of file oofrecs.h.

void OOF_recordSelection::append ( oidT  oid)
inline
unsigned long OOF_recordSelection::appendNewRecord ( bool  appendIt)

returns new synthetic record number

State transition and iterator update when dbTable::newRecord() called.

Returns
mNextFakeNewRecOffset
Parameters
appendItindicates 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.

Definition at line 914 of file oofrec4.cpp.

References OOF_SelectionStateDefiner::allRecs, append(), count(), OOF_SelectionStateDefiner::empty, and state().

Referenced by OOF_simpleRecordBackend::newRecord().

OOF_Selection * OOF_recordSelection::clone ( ) const
virtual

Implements OOF_Selection.

Definition at line 788 of file oofrec4.cpp.

References OOF_recordSelection().

bool OOF_recordSelection::contains ( oidT  item) const
inlinevirtual
void OOF_recordSelection::copyContents ( const OOF_recordSelection rhs)
inline

Definition at line 1057 of file oofrecs.h.

void OOF_recordSelection::copyFrom ( const OOF_recordSelection rhs,
dbTable::selSharingT  selSharing 
)
unsigned long OOF_recordSelection::count ( ) const
inlinevirtual
unsigned long OOF_recordSelection::current ( ) const
inline

value of current item

Definition at line 931 of file oofrecs.h.

References count().

Referenced by OOF_simpleRecordBackend::AdoptBuffer(), and OOF_simpleRecordBackend::CommonSimpleDelete().

void OOF_recordSelection::deleteCurrent ( )
void OOF_recordSelection::deleteItem ( unsigned long  index)
void OOF_recordSelection::describeRecsRep ( std::ostream &  ) const

Definition at line 813 of file oofrec4.cpp.

References OOF_ExpandableLongArray::describe().

void OOF_recordSelection::describeState ( std::ostream &  os) const
void OOF_recordSelection::difference_with ( const OOF_Selection rhs)
virtual

Implements OOF_Selection.

Definition at line 2045 of file oofrec2.cpp.

void OOF_recordSelection::difference_with ( const OOF_recordSelection rhs)
void OOF_recordSelection::expandToInclude ( unsigned long  numSlots)
inline

Definition at line 1035 of file oofrecs.h.

bool OOF_recordSelection::find ( oidT  item,
unsigned long &  foundAt 
) const
inlinevirtual
void OOF_recordSelection::gotoRecord ( unsigned long  index)
inline
void OOF_recordSelection::intersection_with ( const OOF_Selection rhs)
virtual
void OOF_recordSelection::intersection_with ( oidT  rhsOffset)
virtual

Implements OOF_Selection.

Definition at line 2052 of file oofrec2.cpp.

void OOF_recordSelection::intersection_with ( const OOF_recordSelection rhs)
void OOF_recordSelection::invert ( )
virtual
bool OOF_recordSelection::isAllRecs ( ) const
inlinevirtual

Implements OOF_Selection.

Definition at line 917 of file oofrecs.h.

References OOF_SelectionStateDefiner::allRecs, and state().

Referenced by OOF_simpleRecordBackend::AdoptBuffer().

bool OOF_recordSelection::isEmpty ( ) const
inlinevirtual
unsigned long OOF_recordSelection::iter ( ) const
inline
bool OOF_recordSelection::more ( ) const
inline
void OOF_recordSelection::next ( )
inline

Definition at line 903 of file oofrecs.h.

Referenced by OOF_dbaseBackend::next(), and OOF_ramBackend::next().

unsigned long OOF_recordSelection::oneRecOffset ( ) const
inline
unsigned long & OOF_recordSelection::operator() ( )
inline

Definition at line 941 of file oofrecs.h.

References count().

OOF_recordSelection & OOF_recordSelection::operator= ( const OOF_recordSelection rhs)

Definition at line 720 of file oofrec4.cpp.

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

Definition at line 959 of file oofrecs.h.

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

Definition at line 950 of file oofrecs.h.

void OOF_recordSelection::prev ( )
inline

Definition at line 895 of file oofrecs.h.

Referenced by OOF_dbaseBackend::deleteRecord(), and OOF_ramBackend::deleteRecord().

const dbTable * OOF_recordSelection::prototypicalTable ( ) const
virtual

Implements OOF_Selection.

Definition at line 959 of file oofrec4.cpp.

void OOF_recordSelection::resetFakeNewRecordOffSet ( )
inline

Definition at line 1064 of file oofrecs.h.

References OOF_FIRST_SYNTHETIC_RECORD_OFFSET.

Referenced by OOF_simpleRecordBackend::unloadRecord().

void OOF_recordSelection::selectAll ( )
inline

Definition at line 1005 of file oofrecs.h.

Referenced by OOF_rampBackend::save(), and OOF_simpleRecordBackend::selectAll().

void OOF_recordSelection::selectNone ( )
inline

Definition at line 990 of file oofrecs.h.

Referenced by deleteCurrent(), deleteItem(), and OOF_simpleRecordBackend::selectNone().

void OOF_recordSelection::selectOneRec ( unsigned long  rec)
inline

Definition at line 997 of file oofrecs.h.

Referenced by deleteCurrent(), deleteItem(), and OOF_simpleRecordBackend::selectJustOID().

void OOF_recordSelection::selectSome ( )
inline

Definition at line 1012 of file oofrecs.h.

void OOF_recordSelection::setSortOrder ( dbSorter adoptSorter)
virtual

Definition at line 822 of file oofrec4.cpp.

Referenced by OOF_simpleRecordBackend::setSortOrder().

dbSorter * OOF_recordSelection::sorter ( ) const
virtual

Definition at line 829 of file oofrec4.cpp.

Referenced by OOF_simpleRecordBackend::sorter().

void OOF_recordSelection::start ( )
inline
OOF_recordSelection::EselectionState OOF_recordSelection::state ( ) const
inline
void OOF_recordSelection::union_with ( const OOF_Selection rhs)
virtual
void OOF_recordSelection::union_with ( oidT  rhsOffset)
virtual

Implement optimal union_with when combining just one OID on rhs.

Implements OOF_Selection.

Definition at line 2191 of file oofrec2.cpp.

References append().

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

Definition at line 2226 of file oofrec2.cpp.

References append(), count(), OOF_ListBase::isEmpty(), oneRecOffset(), OOF_List::remove(), OOF_List::sortedInsert(), OOF_List::sortedInsertNoDups(), state(), and value().

void OOF_recordSelection::union_with_no_overlap ( const OOF_Selection rhs)
virtual

Implements OOF_Selection.

Definition at line 2337 of file oofrec2.cpp.

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

Definition at line 2351 of file oofrec2.cpp.

References append(), count(), oneRecOffset(), state(), and value().

void OOF_recordSelection::updateCurrent ( unsigned long  newOffset)

Definition at line 935 of file oofrec4.cpp.

References count(), OOF_SelectionStateDefiner::oneRec, and state().

Referenced by OOF_ramBackend::SaveContext().

unsigned long OOF_recordSelection::value ( unsigned long  index) const
inline

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