SurgSim::Devices::BitSetBuffer< N > Class Template Reference

A bit set corresponding to a contiguous memory buffer. More...

`#include <SurgSim/Devices/MultiAxis/BitSetBuffer.h>`

## Public Member Functions

| BitSetBuffer ()
| Create a bit buffer with all bits set to zero. More...
| BitSetBuffer (const BitSetBuffer &other)
| Create a bit buffer by copying another buffer. More...
BitSetBuffer & | operator= (const BitSetBuffer &other)
| Copy bit buffer contents from another buffer. More...
void | set ()
| Set all bits in the buffer to on. More...
void | set (size_t pos)
| Set the specified bit in the buffer to on. More...
void | reset ()
| Reset all bits in the buffer to off. More...
void | reset (size_t pos)
| Reset the specified bit in the buffer to off. More...
bool | test (size_t pos) const
| Get the specified bit in the buffer. More...
void * | getPointer ()
| Get a pointer to the buffer's storage. More...
const void * | getPointer () const
| Get a pointer to the buffer's storage. More...

## Static Public Member Functions

static size_t | size ()
| Get the number of bits in the bit set. More...
static size_t | sizeBytes ()
| Get the number of bytes in the bit set. More...

## Private Types

typedef unsigned char | value_type

## Private Attributes

std::array< value_type, NUM_BYTES > | m_bytes

## Static Private Attributes

static const size_t | ELEMENT_BYTES = sizeof(value_type)
static const size_t | ELEMENT_BITS = ELEMENT_BYTES * 8
static const size_t | NUM_BITS = N
static const size_t | NUM_BYTES = (NUM_BITS + ELEMENT_BITS - 1) / ELEMENT_BITS

## Detailed Description

### template<size_t N>
class SurgSim::Devices::BitSetBuffer< N >

A bit set corresponding to a contiguous memory buffer.

A std::bitset {almost} does everything we need, but we need to also access the storage as bytes.

The method names are generally stolen straight from std::bitset.

Template Parameters

  N | The number of bits in the bit set.

## Member Typedef Documentation

## value_type

template<size_t N>

typedef unsigned char SurgSim::Devices::BitSetBuffer< N >::value_type

private

## Constructor & Destructor Documentation

## BitSetBuffer() [1/2]

template<size_t N>

SurgSim::Devices::BitSetBuffer< N >::BitSetBuffer | ( |  | ) |

inline

Create a bit buffer with all bits set to zero.

## BitSetBuffer() [2/2]

template<size_t N>

SurgSim::Devices::BitSetBuffer< N >::BitSetBuffer | ( | const BitSetBuffer< N > & | other | ) |

inline

Create a bit buffer by copying another buffer.

## Member Function Documentation

## getPointer() [1/2]

template<size_t N>

void* SurgSim::Devices::BitSetBuffer< N >::getPointer | ( |  | ) |

inline

Get a pointer to the buffer's storage.

## getPointer() [2/2]

template<size_t N>

const void* SurgSim::Devices::BitSetBuffer< N >::getPointer | ( |  | ) | const

inline

Get a pointer to the buffer's storage.

## operator=()

template<size_t N>

BitSetBuffer& SurgSim::Devices::BitSetBuffer< N >::operator= | ( | const BitSetBuffer< N > & | other | ) |

inline

Copy bit buffer contents from another buffer.

## reset() [1/2]

template<size_t N>

void SurgSim::Devices::BitSetBuffer< N >::reset | ( |  | ) |

inline

Reset all bits in the buffer to off.

## reset() [2/2]

template<size_t N>

void SurgSim::Devices::BitSetBuffer< N >::reset | ( | size_t | pos | ) |

inline

Reset the specified bit in the buffer to off.

Parameters

  pos | The index of the bit to turn off.

## set() [1/2]

template<size_t N>

void SurgSim::Devices::BitSetBuffer< N >::set | ( |  | ) |

inline

Set all bits in the buffer to on.

## set() [2/2]

template<size_t N>

void SurgSim::Devices::BitSetBuffer< N >::set | ( | size_t | pos | ) |

inline

Set the specified bit in the buffer to on.

Parameters

  pos | The index of the bit to turn on.

## size()

template<size_t N>

static size_t SurgSim::Devices::BitSetBuffer< N >::size | ( |  | ) |

inline static

Get the number of bits in the bit set.

## sizeBytes()

template<size_t N>

static size_t SurgSim::Devices::BitSetBuffer< N >::sizeBytes | ( |  | ) |

inline static

Get the number of bytes in the bit set.

## test()

template<size_t N>

bool SurgSim::Devices::BitSetBuffer< N >::test | ( | size_t | pos | ) | const

inline

Get the specified bit in the buffer.

Parameters

  pos | The index of the bit to test.

## Member Data Documentation

## ELEMENT_BITS

template<size_t N>

const size_t SurgSim::Devices::BitSetBuffer< N >::ELEMENT_BITS = ELEMENT_BYTES * 8

static private

## ELEMENT_BYTES

template<size_t N>

const size_t SurgSim::Devices::BitSetBuffer< N >::ELEMENT_BYTES = sizeof(value_type)

static private

## m_bytes

template<size_t N>

std::array<value_type, NUM_BYTES> SurgSim::Devices::BitSetBuffer< N >::m_bytes

private

## NUM_BITS

template<size_t N>

const size_t SurgSim::Devices::BitSetBuffer< N >::NUM_BITS = N

static private

## NUM_BYTES

template<size_t N>

const size_t SurgSim::Devices::BitSetBuffer< N >::NUM_BYTES = (NUM_BITS + ELEMENT_BITS - 1) / ELEMENT_BITS

static private

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

- SurgSim/Devices/MultiAxis/BitSetBuffer.h