24 #include "field_codec_id.h"
34 if (
id <= ONE_BYTE_MAX_ID)
43 return_bits.
set(0,
true);
55 bits->
get_more_bits((LONG_FORM_ID_BYTES - SHORT_FORM_ID_BYTES) * BITS_IN_BYTE);
72 unsigned dccl::DefaultIdentifierCodec::this_size(
const uint32&
id)
74 if (
id > TWO_BYTE_MAX_ID)
76 "dccl.id provided (" + std::to_string(
id) +
77 ") exceeds maximum: " + std::to_string(
int(TWO_BYTE_MAX_ID))));
79 return (
id <= ONE_BYTE_MAX_ID) ? SHORT_FORM_ID_BYTES * BITS_IN_BYTE
80 : LONG_FORM_ID_BYTES * BITS_IN_BYTE;
unsigned size() override
Calculate the size (in bits) of an empty field.
unsigned long to_ulong() const
Returns the value of the Bitset as an unsigned long integer. Equivalent to to<unsigned long>().
void get_more_bits(size_type num_bits)
Retrieve more bits from the parent Bitset.
Exception class for DCCL.
unsigned min_size() override
Calculate minimum size of the field in bits.
google::protobuf::uint32 uint32
an unsigned 32 bit integer
unsigned max_size() override
Calculate maximum size of the field in bits.
uint32 decode(Bitset *bits) override
Decode a field. If the field is empty (i.e. was encoded using the zero-argument encode()),...
bool test(size_type n) const
Test a bit (return its value)
Bitset encode() override
Encode an empty field.
A variable size container of bits (subclassed from std::deque<bool>) with an optional hierarchy....
Bitset & set(size_type n, bool val=true)
Set a bit to a given value.