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:

## Public Member Functions

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

## Protected Member Functions

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

## Protected Attributes

const SplitStrategy * | _split
TaskEngine | _tasks
| This keeps track of pending tasks to process.

## Private Attributes

bool | _useIndependence
bool | _useSimplification
vector< Slice * > | _sliceCache
| This is the cache maintained through newSlice and freeSlice.
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 unique_ptr< Slice > SliceStrategyCommon::allocateSlice | ( |  | ) |

protected pure virtual

Directly allocate a slice of the correct type using new.

Implemented in HilbertStrategy, and MsmStrategy.

## debugIsValidSlice()

virtual bool SliceStrategyCommon::debugIsValidSlice | ( | Slice * | slice | ) |

protected pure 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 HilbertStrategy, and MsmStrategy.

## freeSlice()

void SliceStrategyCommon::freeSlice | ( | unique_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 )

protected pure virtual

Used by pivotSplit to obtain a pivot.

Implemented in HilbertStrategy, MsmStrategy, and OptimizeStrategy.

## 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

protected virtual

Returns true if slices should be simplified.

Implements SliceStrategy.

Definition at line 117 of file SliceStrategyCommon.cpp.

## newSlice()

unique_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 | ( | unique_ptr< Slice > | slice | ) |

protected virtual

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 | ) |

protected virtual

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:

- src/SliceStrategyCommon.h
- src/SliceStrategyCommon.cpp