MySQL 9.1.0
Source Code Documentation
mysql::abi_helpers Namespace Reference

Namespaces

namespace  detail
 

Classes

class  Array_view
 Ownership-agnostic array class, which is both trivial and standard-layout. More...
 
class  Field
 A type code and a value that is either a 64 bit integer, a boolean, or a bounded-length string. More...
 
class  Packet_builder
 Class to help constructing a Packet, by pushing values one by one. More...
 

Typedefs

template<class Type_enum_t >
using Packet = Array_view< Field< Type_enum_t > >
 Class to store a number of fields of heterogeneous types, in a way that provides ABI compatibility. More...
 

Typedef Documentation

◆ Packet

template<class Type_enum_t >
using mysql::abi_helpers::Packet = typedef Array_view<Field<Type_enum_t> >

Class to store a number of fields of heterogeneous types, in a way that provides ABI compatibility.

This provides ABI compatibility in two ways:

  • Packets can be passed as function parameters in calls between two shared objects that are linked dynamically, even if compiled with different options/compilers. This is works because the class satisfies std::is_standard_layout, which enforces a defined order of struct members. This holds only if memory alignment is the same, which is not guaranteed by the C++ standard, but typicall is the same across compilers on the same system. If stricter guarantees on memory alignment is ever needed, this needs to be replaced by something else.
  • Packet definitions can evolve over time, by adding new type codes and abandoning (but not removing) old ones, and then packets can be shared between shared objects that expect different packet definitions.
Template Parameters
Type_enum_tEnumeration type to use for the type code in the Field objects.