DCCL v3
Static Public Member Functions | List of all members
dccl::FieldCodecManager 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>

Static Public Member Functions

template<class Codec >
static boost::enable_if< boost::mpl::and_< boost::is_base_of< google::protobuf::Message, typename Codec::wire_type >, boost::mpl::not_< boost::is_same< google::protobuf::Message, typename Codec::wire_type > > >, void >::type add (const std::string &name, compiler::dummy_fcm< 0 > dummy_fcm=0)
 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 >
static boost::disable_if< boost::mpl::and_< boost::is_base_of< google::protobuf::Message, typename Codec::wire_type >, boost::mpl::not_< boost::is_same< google::protobuf::Message, typename Codec::wire_type > > >, void >::type add (const std::string &name, compiler::dummy_fcm< 1 > dummy_fcm=0)
 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>
static 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 >
static boost::enable_if< boost::mpl::and_< boost::is_base_of< google::protobuf::Message, typename Codec::wire_type >, boost::mpl::not_< boost::is_same< google::protobuf::Message, typename Codec::wire_type > > >, void >::type remove (const std::string &name, compiler::dummy_fcm< 0 > dummy_fcm=0)
 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 >
static boost::disable_if< boost::mpl::and_< boost::is_base_of< google::protobuf::Message, typename Codec::wire_type >, boost::mpl::not_< boost::is_same< google::protobuf::Message, typename Codec::wire_type > > >, void >::type remove (const std::string &name, compiler::dummy_fcm< 1 > dummy_fcm=0)
 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>
static 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...
 
static boost::shared_ptr< FieldCodecBasefind (const google::protobuf::FieldDescriptor *field, bool has_codec_group, const std::string &codec_group)
 Find the codec for a given field. For embedded messages, prefers (dccl.field).codec (inside field) over (dccl.msg).codec (inside embedded message).
 
static boost::shared_ptr< FieldCodecBasefind (const google::protobuf::Descriptor *desc, std::string name="")
 Find the codec for a given base (or embedded) message. More...
 
static boost::shared_ptr< FieldCodecBasefind (google::protobuf::FieldDescriptor::Type type, std::string name)
 
static void clear ()
 

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 44 of file field_codec_manager.h.

Member Function Documentation

◆ add() [1/3]

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

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 258 of file field_codec_manager.h.

◆ add() [2/3]

template<class Codec >
static boost::enable_if< boost::mpl::and_<boost::is_base_of<google::protobuf::Message, typename Codec::wire_type>, boost::mpl::not_<boost::is_same<google::protobuf::Message, typename Codec::wire_type> > >, void>::type dccl::FieldCodecManager::add ( const std::string &  name,
compiler::dummy_fcm< 0 >  dummy_fcm = 0 
)
static

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.

◆ add() [3/3]

template<class Codec >
boost::disable_if< boost::mpl::and_< boost::is_base_of< google::protobuf::Message, typename Codec::wire_type >, boost::mpl::not_< boost::is_same< google::protobuf::Message, typename Codec::wire_type > > >, void >::type dccl::FieldCodecManager::add ( const std::string &  name,
compiler::dummy_fcm< 1 >  dummy_fcm = 0 
)
static

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.

Definition at line 252 of file field_codec_manager.h.

◆ find()

static boost::shared_ptr<FieldCodecBase> dccl::FieldCodecManager::find ( const google::protobuf::Descriptor *  desc,
std::string  name = "" 
)
inlinestatic

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 138 of file field_codec_manager.h.

◆ remove() [1/3]

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

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 341 of file field_codec_manager.h.

◆ remove() [2/3]

template<class Codec >
static boost::enable_if< boost::mpl::and_<boost::is_base_of<google::protobuf::Message, typename Codec::wire_type>, boost::mpl::not_<boost::is_same<google::protobuf::Message, typename Codec::wire_type> > >, void>::type dccl::FieldCodecManager::remove ( const std::string &  name,
compiler::dummy_fcm< 0 >  dummy_fcm = 0 
)
static

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.

◆ remove() [3/3]

template<class Codec >
boost::disable_if< boost::mpl::and_< boost::is_base_of< google::protobuf::Message, typename Codec::wire_type >, boost::mpl::not_< boost::is_same< google::protobuf::Message, typename Codec::wire_type > > >, void >::type dccl::FieldCodecManager::remove ( const std::string &  name,
compiler::dummy_fcm< 1 >  dummy_fcm = 0 
)
static

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.

Definition at line 335 of file field_codec_manager.h.


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