DCCL v4
dccl::FieldCodecManagerLocal Class Reference

A class for managing the various field codecs. Here you can add and remove field codecs. The DCCL Codec and DefaultMessageCodec use the find() methods to locate the appropriate field codec. More...

#include <dccl/field_codec_manager.h>

Public Member Functions

template<class Codec >
std::enable_if< std::is_base_of< google::protobuf::Message, typename Codec::wire_type >::value &&!std::is_same< google::protobuf::Message, typename Codec::wire_type >::value, void >::type add (const std::string &name)
 Add a new field codec (used for codecs operating on statically generated Protobuf messages, that is, children of google::protobuf::Message but not google::protobuf::Message itself). More...
 
template<class Codec >
std::enable_if< !(std::is_base_of< google::protobuf::Message, typename Codec::wire_type >::value &&!std::is_same< google::protobuf::Message, typename Codec::wire_type >::value), void >::type add (const std::string &name)
 Add a new field codec (used for codecs operating on all types except statically generated Protobuf messages). More...
 
template<class Codec , google::protobuf::FieldDescriptor::Type type>
void add (const std::string &name)
 Add a new field codec only valid for a specific google::protobuf::FieldDescriptor::Type. This is useful if a given codec is designed to work with only a specific Protobuf type that shares an underlying C++ type (e.g. Protobuf types bytes and string) More...
 
template<class Codec >
std::enable_if< std::is_base_of< google::protobuf::Message, typename Codec::wire_type >::value &&!std::is_same< google::protobuf::Message, typename Codec::wire_type >::value, void >::type remove (const std::string &name)
 Remove a new field codec (used for codecs operating on statically generated Protobuf messages, that is, children of google::protobuf::Message but not google::protobuf::Message itself). More...
 
template<class Codec >
std::enable_if< !(std::is_base_of< google::protobuf::Message, typename Codec::wire_type >::value &&!std::is_same< google::protobuf::Message, typename Codec::wire_type >::value), void >::type remove (const std::string &name)
 Remove a new field codec (used for codecs operating on all types except statically generated Protobuf messages). More...
 
template<class Codec , google::protobuf::FieldDescriptor::Type type>
void remove (const std::string &name)
 Remove a new field codec only valid for a specific google::protobuf::FieldDescriptor::Type. This is useful if a given codec is designed to work with only a specific Protobuf type that shares an underlying C++ type (e.g. Protobuf types bytes and string) More...
 
std::shared_ptr< FieldCodecBasefind (const google::protobuf::FieldDescriptor *field, int codec_version, bool has_codec_group, const std::string &codec_group) const
 Find the codec for a given field. For embedded messages, prefers (dccl.field).codec (inside field) over (dccl.msg).codec (inside embedded message).
 
std::shared_ptr< FieldCodecBasefind (const google::protobuf::Descriptor *desc, int codec_version=0, std::string name="") const
 Find the codec for a given base (or embedded) message. More...
 
std::shared_ptr< FieldCodecBasefind (google::protobuf::FieldDescriptor::Type type, int codec_version, std::string name) const
 
void clear ()
 
internal::TypeHelpertype_helper ()
 
const internal::TypeHelpertype_helper () const
 
internal::CodecDatacodec_data ()
 
const internal::CodecDatacodec_data () const
 
void set_hash (const google::protobuf::Descriptor *desc, std::size_t hash)
 
bool has_hash (const google::protobuf::Descriptor *desc) const
 
std::size_t hash (const google::protobuf::Descriptor *desc) const
 

Detailed Description

A class for managing the various field codecs. Here you can add and remove field codecs. The DCCL Codec and DefaultMessageCodec use the find() methods to locate the appropriate field codec.

Definition at line 39 of file field_codec_manager.h.

Member Function Documentation

◆ add() [1/3]

template<class Codec >
std::enable_if< !(std::is_base_of< google::protobuf::Message, typename Codec::wire_type >::value &&!std::is_same< google::protobuf::Message, typename Codec::wire_type >::value), void >::type dccl::FieldCodecManagerLocal::add ( const std::string &  name)

Add a new field codec (used for codecs operating on statically generated Protobuf messages, that is, children of google::protobuf::Message but not google::protobuf::Message itself).

Template Parameters
CodecA child of FieldCodecBase
Parameters
nameName to use for this codec. Corresponds to (dccl.field).codec="name" in .proto file.
Returns
nothing (void). Return templates are used for template metaprogramming selection of the proper add() overload.

Definition at line 313 of file field_codec_manager.h.

◆ add() [2/3]

template<class Codec >
std::enable_if< !(std::is_base_of<google::protobuf::Message, typename Codec::wire_type>::value && !std::is_same<google::protobuf::Message, typename Codec::wire_type>::value), void>::type dccl::FieldCodecManagerLocal::add ( const std::string &  name)

Add a new field codec (used for codecs operating on all types except statically generated Protobuf messages).

Template Parameters
CodecA child of FieldCodecBase
Parameters
nameName to use for this codec. Corresponds to (dccl.field).codec="name" in .proto file.
Returns
nothing (void). Return templates are used for template metaprogramming selection of the proper add() overload.

◆ add() [3/3]

template<class Codec , google::protobuf::FieldDescriptor::Type type>
void dccl::FieldCodecManagerLocal::add ( const std::string &  name)

Add a new field codec only valid for a specific google::protobuf::FieldDescriptor::Type. This is useful if a given codec is designed to work with only a specific Protobuf type that shares an underlying C++ type (e.g. Protobuf types bytes and string)

Template Parameters
CodecA child of FieldCodecBase
typeThe google::protobuf::FieldDescriptor::Type enumeration that this codec works on.
Parameters
nameName to use for this codec. Corresponds to (dccl.field).codec="name" in .proto file.

Definition at line 332 of file field_codec_manager.h.

◆ find()

std::shared_ptr<FieldCodecBase> dccl::FieldCodecManagerLocal::find ( const google::protobuf::Descriptor *  desc,
int  codec_version = 0,
std::string  name = "" 
) const
inline

Find the codec for a given base (or embedded) message.

Parameters
descMessage descriptor to find codec for
nameCodec name (used for embedded messages to prefer the codec listed as a field option). Omit for finding the codec of a base message (one that is not embedded).

Definition at line 130 of file field_codec_manager.h.

◆ remove() [1/3]

template<class Codec >
std::enable_if< !(std::is_base_of< google::protobuf::Message, typename Codec::wire_type >::value &&!std::is_same< google::protobuf::Message, typename Codec::wire_type >::value), void >::type dccl::FieldCodecManagerLocal::remove ( const std::string &  name)

Remove a new field codec (used for codecs operating on statically generated Protobuf messages, that is, children of google::protobuf::Message but not google::protobuf::Message itself).

Template Parameters
CodecA child of FieldCodecBase
Parameters
nameName to use for this codec. Corresponds to (dccl.field).codec="name" in .proto file.
Returns
nothing (void). Return templates are used for template metaprogramming selection of the proper remove() overload.

Definition at line 385 of file field_codec_manager.h.

◆ remove() [2/3]

template<class Codec >
std::enable_if< !(std::is_base_of<google::protobuf::Message, typename Codec::wire_type>::value && !std::is_same<google::protobuf::Message, typename Codec::wire_type>::value), void>::type dccl::FieldCodecManagerLocal::remove ( const std::string &  name)

Remove a new field codec (used for codecs operating on all types except statically generated Protobuf messages).

Template Parameters
CodecA child of FieldCodecBase
Parameters
nameName to use for this codec. Corresponds to (dccl.field).codec="name" in .proto file.
Returns
nothing (void). Return templates are used for template metaprogramming selection of the proper remove() overload.

◆ remove() [3/3]

template<class Codec , google::protobuf::FieldDescriptor::Type type>
void dccl::FieldCodecManagerLocal::remove ( const std::string &  name)

Remove a new field codec only valid for a specific google::protobuf::FieldDescriptor::Type. This is useful if a given codec is designed to work with only a specific Protobuf type that shares an underlying C++ type (e.g. Protobuf types bytes and string)

Template Parameters
CodecA child of FieldCodecBase
typeThe google::protobuf::FieldDescriptor::Type enumeration that this codec works on.
Parameters
nameName to use for this codec. Corresponds to (dccl.field).codec="name" in .proto file.

Definition at line 404 of file field_codec_manager.h.


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