LWMsgTypeClass Struct Reference

Custom type class. More...

#include <lwmsg/type.h>

Data Fields

LWMsgBool is_pointer
 Whether the type is a pointer. More...
 
LWMsgTypeSpectransmit_type
 The type of the transmitted form.
 
LWMsgTypeMarshalFunction marshal
 Marshal function.
 
LWMsgTypeUnmarshalFunction unmarshal
 Unmarshal function.
 
LWMsgTypeDestroyPresentedFunction destroy_presented
 Destroy presented function.
 
LWMsgTypeDestroyTransmittedFunction destroy_transmitted
 Destroy transmitted function.
 
LWMsgTypePrintFunction print
 Print callback function.
 

Detailed Description

Describes a custom type which may be used with LWMSG_CUSTOM() or LWMSG_MEMBER_CUSTOM() in a type specification.

A custom type actually comprises two types:

  • The presented type, which is the type seen by the application.
  • The transmitted type, which is the type represented in the data stream.

The presented type's size must be known to the marshaller so that it can allocate adequate memory for it when reconstructing the object graph from the data stream. All other details of the type are up to the application, which must provide functions to convert to and from the transmitted type, functions to destroy the presented and transmitted types, and a function to print the presented type in human-readable form.

Field Documentation

LWMsgBool LWMsgTypeClass::is_pointer

If a custom type is a pointer, it will not be subject to automatic pointer promotion when passed to lwmsg_data_marshal() et al.