MySQL 9.1.0
Source Code Documentation
mysql::serialization::Field_definition< Field_type, defined_field_size > Class Template Reference

Field definition provided by classes implementing Serializable interface. More...

#include <field_definition.h>

Public Types

using Tag = Field_definition_tag
 
using Field_type_ref = std::reference_wrapper< Field_type >
 

Public Member Functions

 Field_definition (Field_type &field, Field_encode_predicate encode_predicate, Unknown_field_policy unknown_field_policy, Field_missing_functor field_missing_functor)
 Constructs field definition object. More...
 
 Field_definition (Field_type &field, Unknown_field_policy unknown_field_policy=Unknown_field_policy::ignore)
 Constructs field definition object. More...
 
 Field_definition (Field_type &field, Field_encode_predicate encode_predicate, Unknown_field_policy unknown_field_policy=Unknown_field_policy::ignore)
 Constructs field definition object. More...
 
 Field_definition (Field_type &field, Field_missing_functor field_missing_functor)
 Constructs field definition object. More...
 
Field_typeget_ref ()
 
const Field_typeget_ref () const
 
void run_field_missing () const
 Runs "field missing functor" in case field is not available in the provided encoded data. More...
 
bool run_encode_predicate () const
 Runs encode predicate functor. More...
 
bool is_field_ignorable () const
 Indicates whether this field can be ignored by decoders that do not know this field. More...
 

Protected Attributes

Field_type_ref m_ref
 Field object reference. More...
 
Unknown_field_policy m_unknown_field_policy = Unknown_field_policy::ignore
 Defines what a decoder should do if the field is present but the decoder is a version that does not know how to interpret the field. More...
 
Field_encode_predicate m_encode_predicate
 Defines whether field will be encoded. More...
 
Field_missing_functor m_field_missing_functor
 Function that is called for this field during decoding in case field is missing in the encoded message. More...
 

Detailed Description

template<class Field_type, Field_size defined_field_size = sizeof(Field_type)>
class mysql::serialization::Field_definition< Field_type, defined_field_size >

Field definition provided by classes implementing Serializable interface.

Member Typedef Documentation

◆ Field_type_ref

template<class Field_type , Field_size defined_field_size = sizeof(Field_type)>
using mysql::serialization::Field_definition< Field_type, defined_field_size >::Field_type_ref = std::reference_wrapper<Field_type>

◆ Tag

template<class Field_type , Field_size defined_field_size = sizeof(Field_type)>
using mysql::serialization::Field_definition< Field_type, defined_field_size >::Tag = Field_definition_tag

Constructor & Destructor Documentation

◆ Field_definition() [1/4]

template<class Field_type , Field_size defined_field_size = sizeof(Field_type)>
mysql::serialization::Field_definition< Field_type, defined_field_size >::Field_definition ( Field_type field,
Field_encode_predicate  encode_predicate,
Unknown_field_policy  unknown_field_policy,
Field_missing_functor  field_missing_functor 
)
inline

Constructs field definition object.

Parameters
[in]fieldReference to described field object externally, serializer may ignore this value or use it to hide some fields
[in]encode_predicateFunction that is called for optional fields, defines whether field will be encoded
[in]unknown_field_policyWhat decoder should do in case this field definition is unknown to the decoder (error / ignore)
[in]field_missing_functorFunction that is called for this field in case it is not available in encoded data

◆ Field_definition() [2/4]

template<class Field_type , Field_size defined_field_size = sizeof(Field_type)>
mysql::serialization::Field_definition< Field_type, defined_field_size >::Field_definition ( Field_type field,
Unknown_field_policy  unknown_field_policy = Unknown_field_policy::ignore 
)
inline

Constructs field definition object.

Parameters
[in]fieldReference to described field object
[in]unknown_field_policyWhat decoder should do in case this field definition is unknown to the decoder (error / ignore)

◆ Field_definition() [3/4]

template<class Field_type , Field_size defined_field_size = sizeof(Field_type)>
mysql::serialization::Field_definition< Field_type, defined_field_size >::Field_definition ( Field_type field,
Field_encode_predicate  encode_predicate,
Unknown_field_policy  unknown_field_policy = Unknown_field_policy::ignore 
)
inline

Constructs field definition object.

Parameters
[in]fieldReference to described field object
[in]unknown_field_policyWhat decoder should do in case this field definition is unknown to the decoder (error / ignore)
[in]encode_predicateFunction that is called for optional fields, defines whether field will be encoded

◆ Field_definition() [4/4]

template<class Field_type , Field_size defined_field_size = sizeof(Field_type)>
mysql::serialization::Field_definition< Field_type, defined_field_size >::Field_definition ( Field_type field,
Field_missing_functor  field_missing_functor 
)
inline

Constructs field definition object.

Parameters
[in]fieldReference to described field object
[in]field_missing_functorFunction that is called for this field in case it is not available in encoded data

Member Function Documentation

◆ get_ref() [1/2]

template<class Field_type , Field_size defined_field_size = sizeof(Field_type)>
Field_type & mysql::serialization::Field_definition< Field_type, defined_field_size >::get_ref ( )
inline

◆ get_ref() [2/2]

template<class Field_type , Field_size defined_field_size = sizeof(Field_type)>
const Field_type & mysql::serialization::Field_definition< Field_type, defined_field_size >::get_ref ( ) const
inline

◆ is_field_ignorable()

template<class Field_type , Field_size defined_field_size = sizeof(Field_type)>
bool mysql::serialization::Field_definition< Field_type, defined_field_size >::is_field_ignorable ( ) const
inline

Indicates whether this field can be ignored by decoders that do not know this field.

Return values
trueDecoders that do not recognize this field may ignore it
falseDecoders that do not recognize this field should generate an error if they find this field in the packet

◆ run_encode_predicate()

template<class Field_type , Field_size defined_field_size = sizeof(Field_type)>
bool mysql::serialization::Field_definition< Field_type, defined_field_size >::run_encode_predicate ( ) const
inline

Runs encode predicate functor.

Return values
trueEncode field
falseDo not encode field

◆ run_field_missing()

template<class Field_type , Field_size defined_field_size = sizeof(Field_type)>
void mysql::serialization::Field_definition< Field_type, defined_field_size >::run_field_missing ( ) const
inline

Runs "field missing functor" in case field is not available in the provided encoded data.

Member Data Documentation

◆ m_encode_predicate

template<class Field_type , Field_size defined_field_size = sizeof(Field_type)>
Field_encode_predicate mysql::serialization::Field_definition< Field_type, defined_field_size >::m_encode_predicate
protected

Defines whether field will be encoded.

◆ m_field_missing_functor

template<class Field_type , Field_size defined_field_size = sizeof(Field_type)>
Field_missing_functor mysql::serialization::Field_definition< Field_type, defined_field_size >::m_field_missing_functor
protected

Function that is called for this field during decoding in case field is missing in the encoded message.

◆ m_ref

template<class Field_type , Field_size defined_field_size = sizeof(Field_type)>
Field_type_ref mysql::serialization::Field_definition< Field_type, defined_field_size >::m_ref
protected

Field object reference.

◆ m_unknown_field_policy

template<class Field_type , Field_size defined_field_size = sizeof(Field_type)>
Unknown_field_policy mysql::serialization::Field_definition< Field_type, defined_field_size >::m_unknown_field_policy = Unknown_field_policy::ignore
protected

Defines what a decoder should do if the field is present but the decoder is a version that does not know how to interpret the field.

Typically the encoder writes this information to the packet as a directive that instructs old decoders or third-party decoders how to handle the field, if the message definition that they are aware of does not include the field.


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