ShapeFuns.h File Reference
#include <vector>
#include "Shared/ProjectInterface.h"
#include "ShapeTypes.h"
#include "ShapeRoot.h"
Include dependency graph for ShapeFuns.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
|
Namespaces |
| namespace | DualCoding |
Classes |
| class | UnaryShapeRootPred |
| | Unary predicates over ShapeRoot objects. More...
|
| class | BinaryShapeRootPred |
| | Binary predicates over ShapeRoot objects. More...
|
| class | UnaryShapePred |
| | Unary predicates over Shape<T> objects. More...
|
| class | BinaryShapePred |
| | Binary predicates over Shape<T> objects. More...
|
| class | shortcircuit_and |
| | Classes for implementing shortcircuit And and Or predicates. Don't call directly; use andPred and orPred; use not1 for negation. More...
|
| class | shortcircuit_or |
| class | isType |
| class | isColor |
| class | isName |
| template<typename PredType1, typename PredType2> |
shortcircuit_and< PredType1,
PredType2 > | DualCoding::andPred (PredType1 p1, PredType2 p2) |
| | Conjunction of two predicates; p2 is called only if p1 returns true.
|
| template<typename PredType1, typename PredType2> |
shortcircuit_or< PredType1,
PredType2 > | DualCoding::orPred (PredType1 p1, PredType2 p2) |
| | Disjunction of two predicates; p2 is called only if p1 returns false.
|
Defines |
| #define | NEW_SHAPE(_name, _type, _value) |
| | Create a new shape and make it visible in the SketchGUI.
|
| #define | NEW_SHAPE_N(_name, _type, _value) |
| | Create a new shape but hide it from the SketchGUI.
|
| #define | GET_SHAPE(_name, _type, _shapevec) Shape<_type> _name(find_shape<_type>(_shapevec,#_name)); |
| | Retrieve a shape based on its name.
|
| #define | NEW_SHAPEVEC(_name, _type, _value) vector<Shape<_type> > _name((_value)); |
| | Create a new vector of shapes of the specified type.
|
| #define | NEW_SHAPEROOTVEC(_name, _value) vector<ShapeRoot> _name((_value)); |
| | Create a new vector of shapes of mixed type.
|
| #define | SHAPEVEC_ITERATE(_shapesvec, _type, _var) |
| | Iterate over the shapes in a vector; _var is the iterator.
|
| #define | SHAPENEXT_ITERATE(_shapesvec, _type, _var1, _var2) |
| | Nested iteration over the shapes in a vector; _var2 begins one past _var1.
|
| #define | SHAPEROOTVEC_ITERATE(_shapesvec, _var) |
| | Iterate over a vector for shapes of mixed type.
|
| #define | END_ITERATE } |
| #define | DO_SHAPEVEC(_shapesvec, _type, _var, _body) |
| | Obsolete: Iterate over the shapes in a vector; _var is the iterator.
|
| #define | DO_SHAPENEXT(_shapesvec, _type, _var1, _var2, _body) |
| | Obsolete: nested iteration over the shapes in a vector; _var2 begins one past _var1.
|
| #define | DO_SHAPEROOTVEC(_shapesvec, _var, _body) |
| | Obsolete: Iterate over a vector for shapes of mixed type.
|
| #define | DIRECTION_PAIR(dir, oppdir) |
Functions |
| template<class T, typename PredType> |
| Shape< T > | DualCoding::find_if (const vector< Shape< T > > &vec, PredType pred) |
| template<class T> |
| Shape< T > | DualCoding::find_shape (const vector< ShapeRoot > &vec, const std::string &name) |
| | Return the first ShapeRoot with the specified name, else return an invalid ShapeRoot.
|
| template<class T> |
| std::vector< Shape< T > > | DualCoding::select_type (std::vector< ShapeRoot > &vec) |
| | Select the Shape<T> elements from a vector of ShapeRoots.
|
| template<class T, typename PredType> |
| std::vector< Shape< T > > | DualCoding::subset (const std::vector< Shape< T > > &vec, PredType pred) |
| template<class T, typename ComparisonType> |
| Shape< T > | DualCoding::max_element (const vector< Shape< T > > &vec, ComparisonType comp) |
| template<class T, typename ComparisonType> |
| Shape< T > | DualCoding::min_element (const vector< Shape< T > > &vec, ComparisonType comp) |
| template<class T, typename PredType> |
| std::vector< Shape< T > > | DualCoding::stable_sort (const std::vector< Shape< T > > &vec, PredType pred) |
| | DualCoding::DIRECTION_PAIR (LeftOf, RightOf) DIRECTION_PAIR(Above |
Define Documentation
| #define DIRECTION_PAIR |
( |
dir, |
|
|
oppdir |
|
) |
|
| #define DO_SHAPENEXT |
( |
_shapesvec, |
|
|
_type, |
|
|
_var1, |
|
|
_var2, |
|
|
_body |
|
) |
|
Value: for ( std::vector<Shape<_type> >::iterator _var2##_it = ++std::vector<Shape<_type> >::iterator(_var1##_it); \
_var2##_it != _shapesvec.end(); _var2##_it++ ) { \
Shape<_type> &_var2 = *_var2##_it; \
_body }
Obsolete: nested iteration over the shapes in a vector; _var2 begins one past _var1.
Definition at line 70 of file ShapeFuns.h.
Referenced by BrickData::findBricks().
| #define DO_SHAPEROOTVEC |
( |
_shapesvec, |
|
|
_var, |
|
|
_body |
|
) |
|
Value: for ( std::vector<ShapeRoot>::iterator _var##_it = _shapesvec.begin(); \
_var##_it != _shapesvec.end(); _var##_it++ ) { \
ShapeRoot &_var = *_var##_it; \
_body }
Obsolete: Iterate over a vector for shapes of mixed type.
Definition at line 77 of file ShapeFuns.h.
Referenced by DualCoding::select_type().
| #define DO_SHAPEVEC |
( |
_shapesvec, |
|
|
_type, |
|
|
_var, |
|
|
_body |
|
) |
|
Value: for ( std::vector<Shape<_type> >::iterator _var##_it = _shapesvec.begin(); \
_var##_it != _shapesvec.end(); _var##_it++ ) { \
Shape<_type> &_var = *_var##_it; \
_body } \
Obsolete: Iterate over the shapes in a vector; _var is the iterator.
Definition at line 63 of file ShapeFuns.h.
Referenced by BrickData::findBricks().
| #define GET_SHAPE |
( |
_name, |
|
|
_type, |
|
|
_shapevec |
|
) |
Shape<_type> _name(find_shape<_type>(_shapevec,#_name)); |
Retrieve a shape based on its name.
Definition at line 31 of file ShapeFuns.h.
| #define NEW_SHAPE |
( |
_name, |
|
|
_type, |
|
|
_value |
|
) |
|
| #define NEW_SHAPE_N |
( |
_name, |
|
|
_type, |
|
|
_value |
|
) |
|
| #define NEW_SHAPEROOTVEC |
( |
_name, |
|
|
_value |
|
) |
vector<ShapeRoot> _name((_value)); |
Create a new vector of shapes of mixed type.
Definition at line 39 of file ShapeFuns.h.
| #define NEW_SHAPEVEC |
( |
_name, |
|
|
_type, |
|
|
_value |
|
) |
vector<Shape<_type> > _name((_value)); |
Create a new vector of shapes of the specified type.
Definition at line 35 of file ShapeFuns.h.
| #define SHAPENEXT_ITERATE |
( |
_shapesvec, |
|
|
_type, |
|
|
_var1, |
|
|
_var2 |
|
) |
|
Value: for ( std::vector<Shape<_type> >::iterator _var2##_it = ++std::vector<Shape<_type> >::iterator(_var1##_it); \
_var2##_it != _shapesvec.end(); _var2##_it++ ) { \
Shape<_type> &_var2 = *_var2##_it;
Nested iteration over the shapes in a vector; _var2 begins one past _var1.
Definition at line 49 of file ShapeFuns.h.
| #define SHAPEROOTVEC_ITERATE |
( |
_shapesvec, |
|
|
_var |
|
) |
|
Value: for ( std::vector<ShapeRoot>::iterator _var##_it = _shapesvec.begin(); \
_var##_it != _shapesvec.end(); _var##_it++ ) { \
ShapeRoot &_var = *_var##_it;
Iterate over a vector for shapes of mixed type.
Definition at line 55 of file ShapeFuns.h.
| #define SHAPEVEC_ITERATE |
( |
_shapesvec, |
|
|
_type, |
|
|
_var |
|
) |
|
Value: for ( std::vector<Shape<_type> >::iterator _var##_it = _shapesvec.begin(); \
_var##_it != _shapesvec.end(); _var##_it++ ) { \
Shape<_type> &_var = *_var##_it;
Iterate over the shapes in a vector; _var is the iterator.
Definition at line 43 of file ShapeFuns.h.
|