Main Page | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members

parquetfp::BitBoard Class Reference

#include <bitBoardP.h>

Collaboration diagram for parquetfp::BitBoard:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 BitBoard (unsigned size)
const std::vector< unsigned > & getIndicesOfSetBits () const
const vector< bool > & getBoardSpace () const
unsigned getSize () const
unsigned getNumBitsSet () const
bool isBitSet (unsigned idx) const
void setBit (unsigned idx)
void reset ()
void clear ()
void reset (unsigned newSize)

Private Attributes

std::vector< unsigned > _bitIndicesSet
vector< bool > _boardSpace

Friends

ostream & operator<< (ostream &os, const BitBoard &bb)

Constructor & Destructor Documentation

parquetfp::BitBoard::BitBoard unsigned  size  )  [inline]
 

Definition at line 74 of file bitBoardP.h.

References _boardSpace.

00074 : _boardSpace(size,false) {}


Member Function Documentation

void parquetfp::BitBoard::clear  )  [inline]
 

Definition at line 107 of file bitBoardP.h.

References _bitIndicesSet, and _boardSpace.

Referenced by parquetfp::ClusterDB::getClosestNode(), and reset().

00108        { 
00109                for(std::vector<unsigned>::iterator it= _bitIndicesSet.begin();
00110                                          it!=_bitIndicesSet.end(); it++)
00111           _boardSpace[*it]=false;
00112           _bitIndicesSet.clear(); 
00113        }

const vector<bool>& parquetfp::BitBoard::getBoardSpace  )  const [inline]
 

Definition at line 78 of file bitBoardP.h.

References _boardSpace.

00079        { return _boardSpace; }

const std::vector<unsigned>& parquetfp::BitBoard::getIndicesOfSetBits  )  const [inline]
 

Definition at line 75 of file bitBoardP.h.

References _bitIndicesSet.

Referenced by parquetfp::ClusterDB::getClosestNode().

00076        { return _bitIndicesSet; }

unsigned parquetfp::BitBoard::getNumBitsSet  )  const [inline]
 

Definition at line 83 of file bitBoardP.h.

References _bitIndicesSet.

00083 { return _bitIndicesSet.size(); }

unsigned parquetfp::BitBoard::getSize  )  const [inline]
 

Definition at line 81 of file bitBoardP.h.

References _boardSpace.

00081 { return _boardSpace.size();    }

bool parquetfp::BitBoard::isBitSet unsigned  idx  )  const [inline]
 

Definition at line 85 of file bitBoardP.h.

References _boardSpace.

00087        { 
00088        /* abkassert(idx<getSize()," Index out of range"); */
00089           return _boardSpace[idx]; 
00090        }

void parquetfp::BitBoard::reset unsigned  newSize  )  [inline]
 

Definition at line 115 of file bitBoardP.h.

References _bitIndicesSet, _boardSpace, and clear().

00116        {
00117          signed sizeDif = newSize-_boardSpace.size();
00118          if (sizeDif<=0) clear();
00119          else
00120          {
00121            _bitIndicesSet.clear();
00122            _boardSpace.clear();
00123            _boardSpace.insert(_boardSpace.end(),newSize,false);
00124          }
00125        }

Here is the call graph for this function:

void parquetfp::BitBoard::reset  )  [inline]
 

Definition at line 98 of file bitBoardP.h.

References _bitIndicesSet, and _boardSpace.

Referenced by parquetfp::ClusterDB::cluster1Layer().

00099        { 
00100          _bitIndicesSet.clear(); 
00101          std::fill(_boardSpace.begin(),_boardSpace.end(), false);
00102        }

void parquetfp::BitBoard::setBit unsigned  idx  )  [inline]
 

Definition at line 91 of file bitBoardP.h.

References _bitIndicesSet, and _boardSpace.

Referenced by parquetfp::ClusterDB::getClosestNode().

00093        { 
00094        /*      abkassert(idx<getSize()," Index out of range"); */
00095          if ( !_boardSpace[idx] ) 
00096          { _boardSpace[idx]=true; _bitIndicesSet.push_back(idx); }
00097        }


Friends And Related Function Documentation

ostream& operator<< ostream &  os,
const BitBoard bb
[friend]
 

Definition at line 48 of file bitBoardP.cxx.

00049 {
00050        out << bb.getNumBitsSet()
00051            << " bits are set to TRUE in bitBoard of size " 
00052            << bb.getSize() << endl;
00053        //if (bb.getNumBitsSet()) out << bb.getIndicesOfSetBits();
00054        return out;
00055 }


Member Data Documentation

std::vector<unsigned> parquetfp::BitBoard::_bitIndicesSet [private]
 

Definition at line 68 of file bitBoardP.h.

Referenced by clear(), getIndicesOfSetBits(), getNumBitsSet(), reset(), and setBit().

vector< bool > parquetfp::BitBoard::_boardSpace [private]
 

Definition at line 69 of file bitBoardP.h.

Referenced by BitBoard(), clear(), getBoardSpace(), getSize(), isBitSet(), reset(), and setBit().


The documentation for this class was generated from the following file:
Generated on Mon Apr 25 01:16:54 2005 for Parquete by doxygen 1.3.2