DCCL v4
Loading...
Searching...
No Matches
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, typenameCodec::wire_type >::value &&!std::is_same< google::protobuf::Message, typenameCodec::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).
 
template<class Codec >
std::enable_if<!(std::is_base_of< google::protobuf::Message, typenameCodec::wire_type >::value &&!std::is_same< google::protobuf::Message, typenameCodec::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).
 
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)
 
template<class Codec >
std::enable_if< std::is_base_of< google::protobuf::Message, typenameCodec::wire_type >::value &&!std::is_same< google::protobuf::Message, typenameCodec::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).
 
template<class Codec >
std::enable_if<!(std::is_base_of< google::protobuf::Message, typenameCodec::wire_type >::value &&!std::is_same< google::protobuf::Message, typenameCodec::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).
 
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)
 
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.
 
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.

Constructor & Destructor Documentation

◆ FieldCodecManagerLocal()

dccl::FieldCodecManagerLocal::FieldCodecManagerLocal ( )

Definition at line 26 of file field_codec_manager.cpp.

Member Function Documentation

◆ add() [1/3]

template<class Codec >
std::enable_if<!(std::is_base_of< google::protobuf::Message, typenameCodec::wire_type >::value &&!std::is_same< google::protobuf::Message, typenameCodec::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, typenameCodec::wire_type >::value &&!std::is_same< google::protobuf::Message, typenameCodec::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.

◆ clear()

void dccl::FieldCodecManagerLocal::clear ( )
inline

Definition at line 154 of file field_codec_manager.h.

◆ codec_data() [1/2]

internal::CodecData & dccl::FieldCodecManagerLocal::codec_data ( )
inline

Definition at line 163 of file field_codec_manager.h.

◆ codec_data() [2/2]

const internal::CodecData & dccl::FieldCodecManagerLocal::codec_data ( ) const
inline

Definition at line 164 of file field_codec_manager.h.

◆ find() [1/3]

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.

◆ find() [2/3]

std::shared_ptr< FieldCodecBase > dccl::FieldCodecManagerLocal::find ( const google::protobuf::FieldDescriptor *  field,
int  codec_version,
bool  has_codec_group,
const std::string &  codec_group 
) const
inline

Find the codec for a given field. For embedded messages, prefers (dccl.field).codec (inside field) over (dccl.msg).codec (inside embedded message).

Definition at line 114 of file field_codec_manager.h.

◆ find() [3/3]

std::shared_ptr< FieldCodecBase > dccl::FieldCodecManagerLocal::find ( google::protobuf::FieldDescriptor::Type  type,
int  codec_version,
std::string  name 
) const
inline

Definition at line 148 of file field_codec_manager.h.

◆ has_hash()

bool dccl::FieldCodecManagerLocal::has_hash ( const google::protobuf::Descriptor *  desc) const
inline

Definition at line 170 of file field_codec_manager.h.

◆ hash()

std::size_t dccl::FieldCodecManagerLocal::hash ( const google::protobuf::Descriptor *  desc) const
inline

Definition at line 171 of file field_codec_manager.h.

◆ remove() [1/3]

template<class Codec >
std::enable_if<!(std::is_base_of< google::protobuf::Message, typenameCodec::wire_type >::value &&!std::is_same< google::protobuf::Message, typenameCodec::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, typenameCodec::wire_type >::value &&!std::is_same< google::protobuf::Message, typenameCodec::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.

◆ set_hash()

void dccl::FieldCodecManagerLocal::set_hash ( const google::protobuf::Descriptor *  desc,
std::size_t  hash 
)
inline

Definition at line 166 of file field_codec_manager.h.

◆ type_helper() [1/2]

internal::TypeHelper & dccl::FieldCodecManagerLocal::type_helper ( )
inline

Definition at line 160 of file field_codec_manager.h.

◆ type_helper() [2/2]

const internal::TypeHelper & dccl::FieldCodecManagerLocal::type_helper ( ) const
inline

Definition at line 161 of file field_codec_manager.h.


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