Template Class BitStuffer

Class Documentation

template <class T>
class BitStuffer

base_packed_component.h

Purpose: Defines the classes BitStuffer() and BasePackedComponent().

Copyright (C) 2018 Zayd Hammoudeh. All rights reserved.

Author
Zayd Hammoudeh zayd@ucsc.edu
Version
0.00.00

This software may be modified and distributed under the terms of the MIT license. See the LICENSE file for details.

Original Author: Marc Thurley. Manages the data in a byte array. It shift the bits into the array of objects of type T.

Template Parameters
  • T: Generally the “unsigned” type.

Public Functions

BitStuffer(T *data)
void stuff(const unsigned val, const unsigned num_bits_val)

Packs the specified signal “val” into the memory.

Parameters
  • val: Binary value to pack into memory.
  • num_bits_val: The expected bit length of val.

void assert_size(unsigned size)

Verify the specified size matches the actual contents of the BitStuff object.

Parameters
  • size: number of bytes between the data_start_ pointer and the end of the BitStuff managed area.