gridType_c Class Reference

This class encapsulates all information required to handle the different grid types. More...

#include <gridtype.h>

Collaboration diagram for gridType_c:

Collaboration graph
[legend]

List of all members.

Public Types

enum  gridType {
  GT_BRICKS, GT_TRIANGULAR_PRISM, GT_SPHERES, GT_RHOMBIC,
  GT_TETRA_OCTA, GT_NUM_GRIDS
}
 the available grid types More...
enum  capabilities { CAP_ASSEMBLE = 1, CAP_DISASSEMBLE = 2, CAP_STLEXPORT = 4 }
 capabilities of a given grid space More...

Public Member Functions

 gridType_c (xmlParser_c &pars)
 load from xml node
 gridType_c (const gridType_c &)
 copy constructor
void save (xmlWriter_c &xml) const
 used to save to XML
 gridType_c (void)
 create a cube grid
 gridType_c (gridType gt)
 create a grid of the given type with its standard parameters
 ~gridType_c (void)
gridType getType (void) const
 get the grid type
unsigned int getCapabilities (void) const
movementCache_cgetMovementCache (const problem_c *puz) const
 return a movement cache instance for this grid type
voxel_cgetVoxel (unsigned int x, unsigned int y, unsigned int z, voxel_type init) const
 create a new voxel space of this grid type with the given dimensions
voxel_cgetVoxel (xmlParser_c &pars) const
 create a new voxel space of this grid type, which is loaded from the XML node
voxel_cgetVoxel (const voxel_c &orig) const
 create a new voxel space of this grid type, which is a copy of the given space
voxel_cgetVoxel (const voxel_c *orig) const
 create a new voxel space of this grid type, which is a copy of the given space
const symmetries_cgetSymmetries (void) const
 Return a pointer to the symmetry class for this grid.
stlExporter_cgetStlExporter (void) const
 return an STL exporter for this grid

Static Public Member Functions

static assembler_cfindAssembler (const problem_c *p)
 Find a suitable assembler for the given problem.

Protected Attributes

gridType type
 the grid type of this instance
symmetries_csym
 The symmetry object for this grid type.

Private Member Functions

void operator= (const gridType_c &)


Detailed Description

This class encapsulates all information required to handle the different grid types.

That means this class knows about the capabilities of the different grids. It know how to create assembler disassembler, STL-exporter, or voxelspaces for the different grid, ...

This is a factory (see http://en.wikipedia.org/wiki/Factory_method_pattern)


Member Enumeration Documentation

capabilities of a given grid space

Enumerator:
CAP_ASSEMBLE  the grid has an assembler
CAP_DISASSEMBLE  the grid has a disassembler
CAP_STLEXPORT  the grid can export to SDL

the available grid types

Enumerator:
GT_BRICKS  cubes
GT_TRIANGULAR_PRISM  triangles stacked in Z-direction
GT_SPHERES  tightly packed spheres
GT_RHOMBIC  complicated cut cube to build rhombic dodecahrdra
GT_TETRA_OCTA  spacegrid for with tetraedra and octrahera, also a cut cube
GT_NUM_GRIDS  always the last entry, the number of different grids


Constructor & Destructor Documentation

gridType_c::gridType_c ( xmlParser_c pars  ) 

gridType_c::gridType_c ( const gridType_c orig  ) 

copy constructor

gridType_c::gridType_c ( void   ) 

create a cube grid

References GT_BRICKS, sym, and type.

gridType_c::gridType_c ( gridType  gt  ) 

create a grid of the given type with its standard parameters

References bt_assert, GT_BRICKS, GT_RHOMBIC, GT_SPHERES, GT_TETRA_OCTA, GT_TRIANGULAR_PRISM, sym, and type.

gridType_c::~gridType_c ( void   ) 

References sym.


Member Function Documentation

assembler_c * gridType_c::findAssembler ( const problem_c p  )  [static]

Find a suitable assembler for the given problem.

This function is different from the above, it is not dependend on the gridtype of the puzzle but on some of the parameters of the puzzle, e.g has the puzzle multipieces, has the puzzle piece count ranges, ... the function tries to find the fastest assembler that can handle the puzzle. because we are not dependend on the gridtype this function is static but it needs to know the puzzle

References assembler_1_c::canHandle(), and assembler_0_c::canHandle().

Referenced by solveThread_c::run().

unsigned int gridType_c::getCapabilities ( void   )  const

movementCache_c * gridType_c::getMovementCache ( const problem_c puz  )  const

return a movement cache instance for this grid type

References GT_BRICKS, GT_TRIANGULAR_PRISM, and type.

Referenced by movementAnalysator_c::movementAnalysator_c().

stlExporter_c * gridType_c::getStlExporter ( void   )  const

return an STL exporter for this grid

References GT_BRICKS, GT_RHOMBIC, GT_SPHERES, GT_TETRA_OCTA, GT_TRIANGULAR_PRISM, and type.

const symmetries_c * gridType_c::getSymmetries ( void   )  const

gridType gridType_c::getType ( void   )  const [inline]

get the grid type

References type.

Referenced by puzzle_c::addShape(), and doConvert().

voxel_c * gridType_c::getVoxel ( const voxel_c orig  )  const

create a new voxel space of this grid type, which is a copy of the given space

References GT_BRICKS, GT_RHOMBIC, GT_SPHERES, GT_TETRA_OCTA, GT_TRIANGULAR_PRISM, and type.

voxel_c * gridType_c::getVoxel ( const voxel_c orig  )  const

create a new voxel space of this grid type, which is a copy of the given space

References GT_BRICKS, GT_RHOMBIC, GT_SPHERES, GT_TETRA_OCTA, GT_TRIANGULAR_PRISM, and type.

voxel_c * gridType_c::getVoxel ( xmlParser_c pars  )  const

create a new voxel space of this grid type, which is loaded from the XML node

References GT_BRICKS, GT_RHOMBIC, GT_SPHERES, GT_TETRA_OCTA, GT_TRIANGULAR_PRISM, and type.

voxel_c * gridType_c::getVoxel ( unsigned int  x,
unsigned int  y,
unsigned int  z,
voxel_type  init 
) const

void gridType_c::operator= ( const gridType_c  )  [private]

void gridType_c::save ( xmlWriter_c xml  )  const

used to save to XML

References xmlWriter_c::endTag(), xmlWriter_c::newAttrib(), xmlWriter_c::newTag(), and type.

Referenced by puzzle_c::save().


Member Data Documentation

symmetries_c* gridType_c::sym [mutable, protected]

The symmetry object for this grid type.

As we only need one symmetry object for a grid type we create a local instance here and just return a pointer to it for the application to use

Referenced by getSymmetries(), gridType_c(), and ~gridType_c().


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

Generated on Sun Oct 10 10:02:54 2010 for BurrTools by  doxygen 1.5.8