disassembler_a_c Class Reference

this class is a baseclass for disassemblers. More...

#include <disassembler_a.h>

Inheritance diagram for disassembler_a_c:

Inheritance graph
[legend]
Collaboration diagram for disassembler_a_c:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 disassembler_a_c (const problem_c *puz)
 construct the disassembler for this concrete problem.
 ~disassembler_a_c (void)
separation_cdisassemble (const assembly_c *assembly)
 Disassemble an assembly of the puzzle.

Protected Member Functions

void init_find (disassemblerNode_c *nd, const std::vector< unsigned int > &pieces)
 start analysing the position given in the disassemblerNode
disassemblerNode_cfind (void)
 get one possible next position for the currently running analysis
separation_ccheckSubproblems (const disassemblerNode_c *st, const std::vector< unsigned int > &pieces)
 Analyze a sub-problem.
virtual separation_cdisassemble_rec (const std::vector< unsigned int > &pieces, disassemblerNode_c *start)=0
 this function must be implemented by the real disassemblers

Private Member Functions

unsigned short subProbGroup (const disassemblerNode_c *st, const std::vector< unsigned int > &pn, bool cond)
bool subProbGrouping (const std::vector< unsigned int > &pn)
separation_ccheckSubproblem (int pieceCount, const std::vector< unsigned int > &pieces, const disassemblerNode_c *st, bool left, bool *ok)
 disassembler_a_c (const disassembler_a_c &)
void operator= (const disassembler_a_c &)

Private Attributes

grouping_cgroups
 For grouping pieces.
const problem_cpuzzle
 the problem we solve
unsigned short * piece2shape
 Converts piece number to the corresponding shape number.
movementAnalysator_canalyse
 the movement analysator we use.


Detailed Description

this class is a baseclass for disassemblers.

It provides common functionality for both all disassemblers. This is mainly bookkeeping of disassemblerNode_c objects

the space grid dependend information is collected from movementCache classes. those are like the assemblerFrontends for the assembler (a bit more complicated though)

All that the real disassemblers need to to is implement the disassemble_rec function which analyzes one piece of the puzzle until it falls apart


Constructor & Destructor Documentation

disassembler_a_c::disassembler_a_c ( const problem_c puz  ) 

construct the disassembler for this concrete problem.

The problem can not be changed, once you done that but you can analyse many assemblies for disassembability

References grouping_c::addPieces(), analyse, problem_c::getShape(), problem_c::getShapeGroup(), problem_c::getShapeGroupCount(), problem_c::getShapeGroupNumber(), problem_c::getShapeMax(), groups, problem_c::partNumber(), piece2shape, problem_c::pieceNumber(), and puzzle.

disassembler_a_c::~disassembler_a_c ( void   ) 

References analyse, groups, and piece2shape.

disassembler_a_c::disassembler_a_c ( const disassembler_a_c  )  [private]


Member Function Documentation

separation_c * disassembler_a_c::checkSubproblem ( int  pieceCount,
const std::vector< unsigned int > &  pieces,
const disassemblerNode_c st,
bool  left,
bool *  ok 
) [private]

separation_c * disassembler_a_c::checkSubproblems ( const disassemblerNode_c st,
const std::vector< unsigned int > &  pieces 
) [protected]

Analyze a sub-problem.

once a separating node has been found by the disassemble_rec function, it should call this function to analyze the sub-problems

References separation_c::addstate(), bt_assert, checkSubproblem(), disassemblerNode_c::getComefrom(), disassemblerNode_c::getX(), disassemblerNode_c::getY(), disassemblerNode_c::getZ(), disassemblerNode_c::is_piece_removed(), and state_c::set().

Referenced by disassembler_0_c::disassemble_rec().

separation_c * disassembler_a_c::disassemble ( const assembly_c assembly  )  [virtual]

Disassemble an assembly of the puzzle.

Because we can only have or don't have a disassembly sequence we don't need the same complicated callback interface. The function returns either the disassembly sequence or a null pointer. you need to take care of deleting the disassembly sequence after doing with it whatever you want.

Reimplemented from disassembler_c.

References bt_assert, disassemblerNode_c::decRefCount(), disassemble_rec(), disassemblerNode_c::getPiecenumber(), groups, assembly_c::isPlaced(), problem_c::pieceNumber(), assembly_c::placementCount(), puzzle, and grouping_c::reSet().

virtual separation_c* disassembler_a_c::disassemble_rec ( const std::vector< unsigned int > &  pieces,
disassemblerNode_c start 
) [protected, pure virtual]

this function must be implemented by the real disassemblers

Implemented in disassembler_0_c.

Referenced by checkSubproblem(), and disassemble().

disassemblerNode_c* disassembler_a_c::find ( void   )  [inline, protected]

get one possible next position for the currently running analysis

References analyse, and movementAnalysator_c::find().

Referenced by disassembler_0_c::disassemble_rec().

void disassembler_a_c::init_find ( disassemblerNode_c nd,
const std::vector< unsigned int > &  pieces 
) [inline, protected]

start analysing the position given in the disassemblerNode

References analyse, and movementAnalysator_c::init_find().

Referenced by disassembler_0_c::disassemble_rec().

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

unsigned short disassembler_a_c::subProbGroup ( const disassemblerNode_c st,
const std::vector< unsigned int > &  pn,
bool  cond 
) [private]

bool disassembler_a_c::subProbGrouping ( const std::vector< unsigned int > &  pn  )  [private]


Member Data Documentation

the movement analysator we use.

The movement analysator will return the possible moves from a given position

Referenced by disassembler_a_c(), find(), init_find(), and ~disassembler_a_c().

For grouping pieces.

Referenced by disassemble(), disassembler_a_c(), subProbGrouping(), and ~disassembler_a_c().

unsigned short* disassembler_a_c::piece2shape [private]

Converts piece number to the corresponding shape number.

These are needed for the grouping functions

Referenced by disassembler_a_c(), subProbGroup(), subProbGrouping(), and ~disassembler_a_c().

the problem we solve

Referenced by disassemble(), disassembler_a_c(), and subProbGroup().


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

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