cwchess::BitBoard Class Reference

A one-boolean-per-square chessboard. More...

#include <BitBoard.h>

Inheritance diagram for cwchess::BitBoard:

List of all members.

Public Member Functions

Constructors

 BitBoard (void)
 Construct an uninitialized BitBoard.
 BitBoard (BitBoard const& other)
 Construct a BitBoard from another BitBoard.
 BitBoard (Index const& index)
 Construct a BitBoard with a single bit set at index.
 BitBoard (BitBoardData data)
 Construct a BitBoard from a constant.
 BitBoard (int col, int row)
 Construct a BitBoard with a single bit set at col, row.
 BitBoard (mask_t bitmask)
 Construct a BitBoard from a constant or mask (for internal use only).
Assignment operators

BitBoard&  operator= (BitBoard const& bitboard)
 Assignment from other BitBoard.
BitBoard&  operator= (BitBoardData bitboard)
 Assignment from a constant.
Initialization

void reset (void)
 Set all values to FALSE.
void set (void)
 Set all values to TRUE.
Bit fiddling

void reset (int col, int row)
 Reset the bit at col, row.
void reset (Index const& index)
 Reset the bit at index.
void reset (mask_t mask)
 Reset the bits from mask.
void reset (BitBoardData bitboard)
 Reset the bits from bitboard.
void reset (BitBoard bitboard)
 Reset the bits from bitboard.
void set (int col, int row)
 Set the bit at col, row.
void set (Index const& index)
 Set the bit at index.
void set (mask_t mask)
 Set the bits from mask.
void set (BitBoardData bitboard)
 Set the bits from bitboard.
void set (BitBoard const& bitboard)
 Set the bits from bitboard.
void toggle (int col, int row)
 Toggle the bit at col, row.
void toggle (Index const& index)
 Toggle the bit at index.
void toggle (mask_t mask)
 Toggle the bits from mask.
void toggle (BitBoardData bitboard)
 Toggle the bits from bitboard.
void toggle (BitBoard const& bitboard)
 Toggle the bits from bitboard.
Accessors

bool test (void) const
 Test if any bit is set at all.
bool test (int col, int row) const
 Test if the bit at col, row is set.
bool test (Index const& index) const
 Test if the bit at index is set.
bool test (mask_t mask) const
 Test if any bit in mask is set.
bool test (BitBoardData bitboard) const
 Test if any bit in bitboard is set.
bool test (BitBoard const& bitboard) const
 Test if any bit in bitboard is set.
BitBoard operator~ (void) const
 Return the inverse of the bitboard.
 operator void* (void) const
 Return TRUE if the bitboard is not empty.
mask_t operator() (void) const
 Return the underlaying bitmask.

Friends

Comparison operators

bool operator== (BitBoard const& b1, BitBoard const& b2)
bool operator== (BitBoard const& b1, BitBoardData b2)
bool operator== (BitBoardData b1, BitBoard const& b2)
bool operator!= (BitBoard const& b1, BitBoard const& b2)
bool operator!= (BitBoard const& b1, BitBoardData b2)
bool operator!= (BitBoardData b1, BitBoard const& b2)

Bit-wise OR operators with another BitBoard



BitBoard&  operator|= (BitBoard const& bitboard)
BitBoard&  operator|= (BitBoardData bitboard)
BitBoard&  operator|= (mask_t bitmask)
BitBoard operator| (BitBoard const& bitboard1, BitBoard const& bitboard2)
BitBoard operator| (BitBoard const& bitboard1, BitBoardData bitboard2)
BitBoard operator| (BitBoardData bitboard1, BitBoard const& bitboard2)

Bit-wise AND operators with another BitBoard



BitBoard&  operator&= (BitBoard const& bitboard)
BitBoard&  operator&= (BitBoardData bitboard)
BitBoard&  operator&= (mask_t bitmask)
BitBoard operator& (BitBoard bitboard1, BitBoard bitboard2)
BitBoard operator& (BitBoard bitboard1, BitBoardData bitboard2)
BitBoard operator& (BitBoardData bitboard1, BitBoard bitboard2)

Bit-wise XOR operators with another BitBoard



BitBoard&  operator^= (BitBoard const& bitboard)
BitBoard&  operator^= (BitBoardData bitboard)
BitBoard&  operator^= (mask_t bitmask)
BitBoard operator^ (BitBoard bitboard1, BitBoard bitboard2)
BitBoard operator^ (BitBoard bitboard1, BitBoardData bitboard2)
BitBoard operator^ (BitBoardData bitboard1, BitBoard bitboard2)

Detailed Description

A one-boolean-per-square chessboard.

This class defines the interface for access to the bit-board.

Normally one should be hidden from the bit-level implemention (mask_t thus). Instead use BitBoardData constant:

a1 , ..., h8
file_a , ..., file_h
rank_1 , ..., rank_8
and others.

Definition at line 266 of file BitBoard.h.


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

Copyright © 2006 - 2010 Carlo Wood.  All rights reserved.