22 #include "field_codec_id.h"
35 if(
id <= ONE_BYTE_MAX_ID)
44 return_bits.
set(0,
true);
57 bits->
get_more_bits((LONG_FORM_ID_BYTES - SHORT_FORM_ID_BYTES)*BITS_IN_BYTE);
80 unsigned dccl::DefaultIdentifierCodec::this_size(
const uint32&
id)
82 if(
id > TWO_BYTE_MAX_ID)
83 throw(
Exception(
"dccl.id provided (" + boost::lexical_cast<std::string>(
id) +
") exceeds maximum: " + boost::lexical_cast<std::string>(
int(TWO_BYTE_MAX_ID))));
85 return (
id <= ONE_BYTE_MAX_ID) ?
86 SHORT_FORM_ID_BYTES*BITS_IN_BYTE :
87 LONG_FORM_ID_BYTES*BITS_IN_BYTE;
93 return LONG_FORM_ID_BYTES * BITS_IN_BYTE;
98 return SHORT_FORM_ID_BYTES * BITS_IN_BYTE;
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.
google::protobuf::uint32 uint32
an unsigned 32 bit integer
virtual unsigned size()
Calculate the size (in bits) of an empty field.
bool test(size_type n) const
Test a bit (return its value)
A variable size container of bits (subclassed from std::deque<bool>) with an optional hierarchy....
virtual unsigned max_size()
Calculate maximum size of the field in bits.
virtual Bitset encode()
Encode an empty field.
virtual uint32 decode(Bitset *bits)
Decode a field. If the field is empty (i.e. was encoded using the zero-argument encode()),...
Bitset & set(size_type n, bool val=true)
Set a bit to a given value.
virtual unsigned min_size()
Calculate minimum size of the field in bits.