Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

Bitset.hpp File Reference

#include <cassert>
#include <set>
#include <string>
#include <vector>
#include "Benzene.hpp"
#include "Types.hpp"
#include <bitset>

Go to the source code of this file.

Namespaces

namespace  BitsetUtil
 

Utilities on bitsets.


Defines

#define USE_HOMEBREWED_BITSET   1
 If true, uses our own bitset, otherwise std::bitset.

Typedefs

typedef benzene_bitset
< BITSETSIZE
bitset_t
 Standard-sized bitset.

Functions

void BitsetUtil::BitsetToBytes (const bitset_t &b, byte *out, int numbits)
 Converts the bottom numbits of b into a byte stream.
bitset_t BitsetUtil::BytesToBitset (const byte *bytes, int numbits)
 Converts a byte stream into a bitset.
std::string BitsetUtil::BitsetToHex (const bitset_t &b, int numbits)
 Converts a bitset into a string of hex symbols.
bitset_t BitsetUtil::HexToBitset (const std::string &str)
 Converts a string of hex symbols into a bitset.
bitset_t BitsetUtil::Subtract (const bitset_t &b1, const bitset_t &b2)
 Subtracts b2 from b1.
bool BitsetUtil::SubtractIfLeavesAny (bitset_t &removeFrom, const bitset_t &remove)
 If removeFrom - remove is not empty, stores that value in removeFrom and returns true.
bool BitsetUtil::IsSubsetOf (const bitset_t &b1, const bitset_t &b2)
 Returns true if b1 is a subset of b2.
bool BitsetUtil::IsLessThan (const bitset_t &b1, const bitset_t &b2)
 Returns true if b1 comes before b2 in some consistent order (any well defined ordering, not necessarily lexicographic).
template<typename INT >
void BitsetUtil::BitsetToVector (const bitset_t &b, std::vector< INT > &indices)
 Stores indices of set bits in b in indices.
template<typename INT >
bitset_t BitsetUtil::SetToBitset (const std::set< INT > &indices)
 Converts of set of indices into a bitset with those bits set.
int BitsetUtil::FindSetBit (const bitset_t &b)
 Returns the bit that is set in b.
int BitsetUtil::FirstSetBit (const bitset_t &b)
 Returns least-significant set bit in b.
bitset_t operator- (const bitset_t &b1, const bitset_t &b2)
 Extends the standard binary '-' operator for bitsets.

Variables

static
_BEGIN_BENZENE_NAMESPACE_
const int 
BITSETSIZE = 128
 Maximum size of a bitset.
static const bitset_t EMPTY_BITSET
 Global empty bitset.

Detailed Description

Definition in file Bitset.hpp.


Define Documentation

#define USE_HOMEBREWED_BITSET   1

If true, uses our own bitset, otherwise std::bitset.

Homebrewed bitset is a copy of std::bitset with subset and less-than operations built in. Using the homebrewed bitset should improve performance slightly.

If you are getting compile errors, switch to the stl bitset.

Definition at line 25 of file Bitset.hpp.


Typedef Documentation

Standard-sized bitset.

Definition at line 66 of file Bitset.hpp.


Function Documentation

bitset_t operator- ( const bitset_t b1,
const bitset_t b2 
)

Extends the standard binary '-' operator for bitsets.


Variable Documentation

_BEGIN_BENZENE_NAMESPACE_ const int BITSETSIZE = 128 [static]
const bitset_t EMPTY_BITSET [static]


6 Jan 2011 Doxygen 1.6.3