DCCL v4
dccl::arith::ArithmeticFieldCodecBase< FieldType > Class Template Reference
Inheritance diagram for dccl::arith::ArithmeticFieldCodecBase< FieldType >:

Public Member Functions

Bitset encode_repeated (const std::vector< Model::value_type > &wire_value) override
 
Bitset encode_repeated (const std::vector< Model::value_type > &wire_value, bool update_model)
 
void bit_plus_follow (Bitset *bits, int *bits_to_follow, bool bit)
 
std::vector< Model::value_type > decode_repeated (Bitset *bits) override
 Decode a repeated field.
 
unsigned size_repeated (const std::vector< Model::value_type > &wire_values) override
 
unsigned max_size_repeated () override
 Give the max size of a repeated field.
 
unsigned min_size_repeated () override
 Give the min size of a repeated field.
 
void validate () override
 Validate a field. Use require() inside your overloaded validate() to assert requirements or throw Exceptions directly as needed.
 
Model::symbol_type bits_to_symbol (Bitset *bits, uint64 &value, int &bit_stream_offset, uint64 low, uint64 range)
 
dccl::int32 max_repeat ()
 
Modelcurrent_model ()
 
ModelManagermodel_manager ()
 
- Public Member Functions inherited from dccl::RepeatedTypedFieldCodec< Model::value_type, Model::value_type >
virtual Bitset encode_repeated (const std::vector< Model::value_type > &wire_value)=0
 Encode a repeated field.
 
virtual unsigned size_repeated (const std::vector< Model::value_type > &wire_values)=0
 Give the size of a repeated field.
 
Bitset encode () override
 Encode an empty field. More...
 
Bitset encode (const Model::value_type &wire_value) override
 Encode a non-empty field. More...
 
Model::value_type decode (dccl::Bitset *bits) override
 Decode a field. If the field is empty (i.e. was encoded using the zero-argument encode()), throw NullValueException to indicate this. More...
 
unsigned size () override
 Calculate the size (in bits) of an empty field. More...
 
unsigned size (const Model::value_type &wire_value) override
 Calculate the size (in bits) of a non-empty field. More...
 
unsigned max_size () override
 Calculate maximum size of the field in bits. More...
 
unsigned min_size () override
 Calculate minimum size of the field in bits. More...
 
- Public Member Functions inherited from dccl::FieldCodecSelector< Model::value_type, Model::value_type >
virtual Model::value_type pre_encode (const Model::value_type &field_value)=0
 Convert from the FieldType representation (used in the Google Protobuf message) to the WireType representation (used with encode() and decode(), i.e. "on the wire"). More...
 
virtual Model::value_type post_decode (const Model::value_type &wire_value)=0
 Convert from the WireType representation (used with encode() and decode(), i.e. "on the wire") to the FieldType representation (used in the Google Protobuf message). More...
 
- Public Member Functions inherited from dccl::FieldCodecBase
 FieldCodecBase ()
 
virtual ~FieldCodecBase ()=default
 
void base_encode (Bitset *bits, const google::protobuf::Message &msg, MessagePart part, bool strict)
 Encode this part (body or head) of the base message. More...
 
void base_size (unsigned *bit_size, const google::protobuf::Message &msg, MessagePart part)
 Calculate the size (in bits) of a part of the base message when it is encoded. More...
 
void base_decode (Bitset *bits, google::protobuf::Message *msg, MessagePart part)
 Decode part of a message. More...
 
void base_max_size (unsigned *bit_size, const google::protobuf::Descriptor *desc, MessagePart part)
 Calculate the maximum size of a message given its Descriptor alone (no data) More...
 
void base_min_size (unsigned *bit_size, const google::protobuf::Descriptor *desc, MessagePart part)
 Calculate the minimum size of a message given its Descriptor alone (no data) More...
 
void base_validate (const google::protobuf::Descriptor *desc, MessagePart part)
 Validate this part of the message to make sure all required extensions are set. More...
 
void base_info (std::ostream *os, const google::protobuf::Descriptor *desc, MessagePart part)
 Get human readable information (size of fields, etc.) about this part of the DCCL message. More...
 
void base_hash (std::size_t *hash, const google::protobuf::Descriptor *desc, MessagePart part)
 Provide a hash of the DCCL message definition to detect changes in the DCCL message. More...
 
std::string name () const
 the name of the codec used to identifier it in the .proto custom option extension
 
google::protobuf::FieldDescriptor::Type field_type () const
 the type exposed to the user in the original and decoded Protobuf messages More...
 
google::protobuf::FieldDescriptor::CppType wire_type () const
 the C++ type used "on the wire". This is the type visible after pre_encode and before post_decode functions are called. More...
 
const google::protobuf::FieldDescriptor * this_field () const
 Returns the FieldDescriptor (field schema meta-data) for this field. More...
 
const google::protobuf::Descriptor * this_descriptor () const
 Returns the Descriptor (message schema meta-data) for the immediate parent Message. More...
 
const google::protobuf::Messagethis_message ()
 
const google::protobuf::Messageroot_message ()
 
const google::protobuf::Descriptor * root_descriptor () const
 
internal::MessageStackDatamessage_data ()
 
const internal::MessageStackDatamessage_data () const
 
bool has_codec_group ()
 
std::string codec_group ()
 
int codec_version ()
 
MessagePart part ()
 the part of the message currently being encoded (head or body)
 
bool strict ()
 
void set_force_use_required (bool force_required=true)
 Force the codec to always use the "required" field encoding, regardless of the FieldDescriptor setting. Useful when wrapping this codec in another that handles optional and repeated fields.
 
void field_pre_encode (dccl::any *wire_value, const dccl::any &field_value)
 Pre-encodes a non-repeated (i.e. optional or required) field by converting the FieldType representation (the Google Protobuf representation) into the WireType representation (the type used in the encoded DCCL message). This allows for type-converting codecs. More...
 
void field_pre_encode_repeated (std::vector< dccl::any > *wire_values, const std::vector< dccl::any > &field_values)
 Pre-encodes a repeated field. More...
 
void field_encode (Bitset *bits, const dccl::any &field_value, const google::protobuf::FieldDescriptor *field)
 Encode a non-repeated field. More...
 
void field_encode_repeated (Bitset *bits, const std::vector< dccl::any > &field_values, const google::protobuf::FieldDescriptor *field)
 Encode a repeated field. More...
 
void field_size (unsigned *bit_size, const dccl::any &field_value, const google::protobuf::FieldDescriptor *field)
 Calculate the size of a field. More...
 
void field_size_repeated (unsigned *bit_size, const std::vector< dccl::any > &field_values, const google::protobuf::FieldDescriptor *field)
 Calculate the size of a repeated field. More...
 
void field_decode (Bitset *bits, dccl::any *field_value, const google::protobuf::FieldDescriptor *field)
 Decode a non-repeated field. More...
 
void field_decode_repeated (Bitset *bits, std::vector< dccl::any > *field_values, const google::protobuf::FieldDescriptor *field)
 Decode a repeated field. More...
 
void field_post_decode (const dccl::any &wire_value, dccl::any *field_value)
 Post-decodes a non-repeated (i.e. optional or required) field by converting the WireType (the type used in the encoded DCCL message) representation into the FieldType representation (the Google Protobuf representation). This allows for type-converting codecs. More...
 
void field_post_decode_repeated (const std::vector< dccl::any > &wire_values, std::vector< dccl::any > *field_values)
 Post-decodes a repeated field. More...
 
void field_max_size (unsigned *bit_size, const google::protobuf::FieldDescriptor *field)
 Calculate the upper bound on this field's size (in bits) More...
 
void field_min_size (unsigned *bit_size, const google::protobuf::FieldDescriptor *field)
 Calculate the lower bound on this field's size (in bits) More...
 
void field_validate (bool *b, const google::protobuf::FieldDescriptor *field)
 Validate this field, checking that all required option extensions are set (e.g. (dccl.field).max and (dccl.field).min for arithmetic codecs) More...
 
void field_info (std::ostream *os, const google::protobuf::FieldDescriptor *field)
 Write human readable information about the field and its bounds to the provided stream. More...
 
void field_hash (std::size_t *hash, const google::protobuf::FieldDescriptor *field)
 Provide a hash for this field definition. More...
 
dccl::DCCLFieldOptions dccl_field_options () const
 Get the DCCL field option extension value for the current field. More...
 
void require (bool b, const std::string &description)
 Essentially an assertion to be used in the validate() virtual method. More...
 
DynamicConditionsdynamic_conditions (const google::protobuf::FieldDescriptor *field)
 
FieldCodecManagerLocalmanager ()
 
const FieldCodecManagerLocalmanager () const
 
virtual void set_manager (FieldCodecManagerLocal *manager)
 

Static Public Attributes

static constexpr uint64 TOP_VALUE
 
static constexpr uint64 HALF
 
static constexpr uint64 FIRST_QTR = HALF >> 1
 
static constexpr uint64 THIRD_QTR = HALF + FIRST_QTR
 

Additional Inherited Members

- Public Types inherited from dccl::RepeatedTypedFieldCodec< Model::value_type, Model::value_type >
using wire_type = Model::value_type
 
using field_type = Model::value_type
 
- Public Types inherited from dccl::TypedFieldCodec< Model::value_type, Model::value_type >
using wire_type = Model::value_type
 
using field_type = Model::value_type
 
- Static Public Member Functions inherited from dccl::FieldCodecBase
static std::string codec_group (const google::protobuf::Descriptor *desc)
 
- Protected Member Functions inherited from dccl::FieldCodecBase
bool use_required ()
 Whether to use the required or optional encoding.
 
virtual std::string info ()
 Write field specific information (in addition to general information such as sizes that are automatically written by this class for all fields. More...
 
virtual std::size_t hash ()
 Generate a field specific hash to be combined with the descriptor hash.
 
virtual void any_pre_encode_repeated (std::vector< dccl::any > *wire_values, const std::vector< dccl::any > &field_values)
 
virtual void any_post_decode_repeated (const std::vector< dccl::any > &wire_values, std::vector< dccl::any > *field_values)
 
void check_repeat_settings () const
 

Detailed Description

template<typename FieldType = Model::value_type>
class dccl::arith::ArithmeticFieldCodecBase< FieldType >

Definition at line 214 of file field_codec_arithmetic.h.

Member Data Documentation

◆ HALF

template<typename FieldType >
const uint64 dccl::arith::ArithmeticFieldCodecBase< FieldType >::HALF
staticconstexpr
Initial value:
=
(static_cast<uint64>(1) << (Model::CODE_VALUE_BITS - 1))

Definition at line 219 of file field_codec_arithmetic.h.

◆ TOP_VALUE

template<typename FieldType >
const uint64 dccl::arith::ArithmeticFieldCodecBase< FieldType >::TOP_VALUE
staticconstexpr
Initial value:
=
(static_cast<uint64>(1) << Model::CODE_VALUE_BITS) - 1

Definition at line 217 of file field_codec_arithmetic.h.


The documentation for this class was generated from the following file:
dccl::uint64
google::protobuf::uint64 uint64
an unsigned 64 bit integer
Definition: common.h:60