Frobby  0.9.5
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
SliceStrategyCommon Class Referenceabstract

This class adds code to the SliceStrategy base class that is useful for derived classes. More...

#include <SliceStrategyCommon.h>

Inheritance diagram for SliceStrategyCommon:
SliceStrategy HilbertStrategy MsmStrategy OptimizeStrategy

Public Member Functions

 SliceStrategyCommon (const SplitStrategy *splitStrategy)
 
virtual ~SliceStrategyCommon ()
 
virtual void freeSlice (auto_ptr< Slice > slice)
 It is allowed to delete returned slices directly, but it is better to use freeSlice. More...
 
virtual void setUseIndependence (bool use)
 This method should only be called before calling run(). More...
 
virtual void setUseSimplification (bool use)
 This method should only be called before calling run(). More...
 
- Public Member Functions inherited from SliceStrategy
virtual ~SliceStrategy ()
 
virtual void run (const Ideal &ideal)=0
 Run the Slice algorithm. More...
 
virtual bool processSlice (TaskEngine &tasks, auto_ptr< Slice > slice)=0
 Process the parameter slice. More...
 

Protected Member Functions

virtual bool simplify (Slice &slice)
 Simplifies slice and returns true if it changed. More...
 
virtual auto_ptr< SliceallocateSlice ()=0
 Directly allocate a slice of the correct type using new. More...
 
virtual bool debugIsValidSlice (Slice *slice)=0
 Check that this slice is valid for use with this strategy. More...
 
auto_ptr< SlicenewSlice ()
 Returns a slice from the cache that freeSlice adds to, or allocate a new one using allocateSlice. More...
 
virtual void pivotSplit (auto_ptr< Slice > slice)
 Takes over ownership of slice. More...
 
virtual void getPivot (Term &pivot, Slice &slice)=0
 Used by pivotSplit to obtain a pivot. More...
 
bool getUseIndependence () const
 Returns true if independence splits should be performed when possible. More...
 
bool getUseSimplification () const
 Returns true if slices should be simplified. More...
 

Protected Attributes

const SplitStrategy_split
 
TaskEngine _tasks
 This keeps track of pending tasks to process. More...
 

Private Attributes

bool _useIndependence
 
bool _useSimplification
 
vector< Slice * > _sliceCache
 This is the cache maintained through newSlice and freeSlice. More...
 
Term _pivotTmp
 

Detailed Description

This class adds code to the SliceStrategy base class that is useful for derived classes.

The public interface is unchanged.

Definition at line 34 of file SliceStrategyCommon.h.

Constructor & Destructor Documentation

◆ SliceStrategyCommon()

SliceStrategyCommon::SliceStrategyCommon ( const SplitStrategy splitStrategy)

Definition at line 24 of file SliceStrategyCommon.cpp.

◆ ~SliceStrategyCommon()

SliceStrategyCommon::~SliceStrategyCommon ( )
virtual

Definition at line 31 of file SliceStrategyCommon.cpp.

Member Function Documentation

◆ allocateSlice()

virtual auto_ptr<Slice> SliceStrategyCommon::allocateSlice ( )
protectedpure virtual

Directly allocate a slice of the correct type using new.

Implemented in MsmStrategy, and HilbertStrategy.

◆ debugIsValidSlice()

virtual bool SliceStrategyCommon::debugIsValidSlice ( Slice slice)
protectedpure virtual

Check that this slice is valid for use with this strategy.

No check need be performed unless DEBUG is defined, making it acceptable to check things using ASSERT. This method should not be called if DEBUG is not defined.

Implemented in MsmStrategy, and HilbertStrategy.

◆ freeSlice()

void SliceStrategyCommon::freeSlice ( auto_ptr< Slice slice)
virtual

It is allowed to delete returned slices directly, but it is better to use freeSlice.

freeSlice can only be called on slices obtained from a method of the same strategy. This allows caching of slices to avoid frequent allocation and deallocation.

Implements SliceStrategy.

Definition at line 39 of file SliceStrategyCommon.cpp.

◆ getPivot()

virtual void SliceStrategyCommon::getPivot ( Term pivot,
Slice slice 
)
protectedpure virtual

Used by pivotSplit to obtain a pivot.

Implemented in HilbertStrategy, OptimizeStrategy, and MsmStrategy.

◆ getUseIndependence()

bool SliceStrategyCommon::getUseIndependence ( ) const
protected

Returns true if independence splits should be performed when possible.

Definition at line 113 of file SliceStrategyCommon.cpp.

◆ getUseSimplification()

bool SliceStrategyCommon::getUseSimplification ( ) const
protectedvirtual

Returns true if slices should be simplified.

Implements SliceStrategy.

Definition at line 117 of file SliceStrategyCommon.cpp.

◆ newSlice()

auto_ptr< Slice > SliceStrategyCommon::newSlice ( )
protected

Returns a slice from the cache that freeSlice adds to, or allocate a new one using allocateSlice.

This method should be used in place of allocating new slices directly.

Definition at line 65 of file SliceStrategyCommon.cpp.

◆ pivotSplit()

void SliceStrategyCommon::pivotSplit ( auto_ptr< Slice slice)
protectedvirtual

Takes over ownership of slice.

Uses the pivot gotten through getPivot.

Definition at line 77 of file SliceStrategyCommon.cpp.

◆ setUseIndependence()

void SliceStrategyCommon::setUseIndependence ( bool  use)
virtual

This method should only be called before calling run().

Implements SliceStrategy.

Reimplemented in OptimizeStrategy.

Definition at line 47 of file SliceStrategyCommon.cpp.

◆ setUseSimplification()

void SliceStrategyCommon::setUseSimplification ( bool  use)
virtual

This method should only be called before calling run().

Implements SliceStrategy.

Definition at line 51 of file SliceStrategyCommon.cpp.

◆ simplify()

bool SliceStrategyCommon::simplify ( Slice slice)
protectedvirtual

Simplifies slice and returns true if it changed.

Reimplemented in OptimizeStrategy.

Definition at line 55 of file SliceStrategyCommon.cpp.

Member Data Documentation

◆ _pivotTmp

Term SliceStrategyCommon::_pivotTmp
private

Definition at line 97 of file SliceStrategyCommon.h.

◆ _sliceCache

vector<Slice*> SliceStrategyCommon::_sliceCache
private

This is the cache maintained through newSlice and freeSlice.

It would make more sense with a stack, but that class has (surprisingly!) proven to have too high overhead, even when it seems to be implemented in terms of vector.

Definition at line 95 of file SliceStrategyCommon.h.

◆ _split

const SplitStrategy* SliceStrategyCommon::_split
protected

Definition at line 80 of file SliceStrategyCommon.h.

◆ _tasks

TaskEngine SliceStrategyCommon::_tasks
protected

This keeps track of pending tasks to process.

These are slices and other events.

Definition at line 84 of file SliceStrategyCommon.h.

◆ _useIndependence

bool SliceStrategyCommon::_useIndependence
private

Definition at line 87 of file SliceStrategyCommon.h.

◆ _useSimplification

bool SliceStrategyCommon::_useSimplification
private

Definition at line 88 of file SliceStrategyCommon.h.


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