Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

CompressedMap Class Reference

This class represents a compressed version of a Map. More...

#include <compressed_map.h>

List of all members.

Public Methods

 CompressedMap (Map const &map)
 CompressedMap (QDataStream &stream)
int width () const
int height () const
int numberOfEmptyGoals () const
int keeperIndex () const
void setPieces (std::vector< int > &pieces) const
bool operator== (CompressedMap const &other_map) const
bool operator!= (CompressedMap const &other_map) const
bool operator< (CompressedMap const &other_map) const
void writeToStream (QDataStream &stream) const

Private Methods

int codesLength () const

Private Attributes

Q_UINT8 m_width
Q_UINT8 m_height
Q_UINT16 m_empty_goals
Q_UINT16 m_keeper_index
std::vector< Q_UINT32 > m_codes


Detailed Description

This class represents a compressed version of a Map.

This class is used for fast loading and storing and to check if to maps are equal. It also provides all operators to use it as a key in std::map<>.

Note, that Map itself uses a CompressedMap for loading and saving.

The format of a compressed map is easy. We simply store the pieces (which are in the range [0:8[) in 32 bit integers. Because a piece takes 3 bits, we can store 10 pieces per int.

Author:
Ralf Schmelter (ralfs@pc2a.chemie.uni-dortmund.de).
Version:
0.1


Constructor & Destructor Documentation

CompressedMap::CompressedMap Map const & map
 

Constructs the compressed map from a normal map.

Parameters:
map   The map to use.

CompressedMap::CompressedMap QDataStream & stream
 

Constructs the compressed map from a data stream.

Parameters:
stream   The stream to use.


Member Function Documentation

int CompressedMap::codesLength const [private]
 

Returns the length of the code array.

int CompressedMap::height const
 

Returns the height of the map.

int CompressedMap::keeperIndex const
 

Returns the index of the keeper.

int CompressedMap::numberOfEmptyGoals const
 

Returns the number of empty goals (without a gem).

bool CompressedMap::operator!= CompressedMap const & other_map const
 

Compares to maps for inequality.

Parameters:
other_map   The other map.

bool CompressedMap::operator< CompressedMap const & other_map const
 

This is needed for associative containers like std::map.

Parameters:
other_map   The other map.

bool CompressedMap::operator== CompressedMap const & other_map const
 

Compares to maps for equality.

Parameters:
other_map   The other map.

void CompressedMap::setPieces std::vector< int > & pieces const
 

Fills the given vector with the piece codes suitable to create a Map.

Parameters:
pieces   The vector to fill.

int CompressedMap::width const
 

Returns the width of the map.

void CompressedMap::writeToStream QDataStream & stream const
 

Writes the compressed map to a data stream.

Parameters:
stream   The stream to use.


Member Data Documentation

std::vector<Q_UINT32> CompressedMap::m_codes [private]
 

Here we store the compressed moves.

Q_UINT16 CompressedMap::m_empty_goals [private]
 

The number of empty goals in the map.

Q_UINT8 CompressedMap::m_height [private]
 

The height of the map.

Q_UINT16 CompressedMap::m_keeper_index [private]
 

The index of the keeper.

Q_UINT8 CompressedMap::m_width [private]
 

The width of the map.


The documentation for this class was generated from the following file:
Generated at Sun Jan 6 18:49:10 2002 for EasySok by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001