Top | ![]() |
![]() |
![]() |
![]() |
gboolean | gwy_boxed_type_is_serializable () |
void | gwy_serializable_boxed_register_static () |
void | gwy_serializable_boxed_assign () |
gboolean | gwy_serializable_boxed_equal () |
gsize | gwy_serializable_boxed_n_items () |
void | gwy_serializable_boxed_itemize () |
gpointer | gwy_serializable_boxed_construct () |
The serialisable boxed protocol is an analogue of the serialisable object protocol described in section GwySerializable where more detailed discussion of the concept can be found. The protocol is intended for simple structs that do not do their own memory management and typically can be bitwise copied. Complex data should be represented as objects.
Boxed structs can be serialised as parts of objects. The top-level item of a serialised representation must be always an object. Also, serialisable boxed structs may contain only atomic types (FIXME: this is not enforced by the implementation at this moment).
gboolean
gwy_boxed_type_is_serializable (GType type
);
Determines if a type supports the boxed serialisable protocol.
void gwy_serializable_boxed_register_static (GType type
,const GwySerializableBoxedInfo *info
);
Registers a serialisable boxed type.
A boxed type must be registered before it can be deserialised. Usually this function is called in
gwy_foo_get_type()
for the type although it is possible to register foreign boxed
types as serialisable. They must be registered “soon enough” then.
Standard Gwyddion boxed serialisable types are registered by gwy_type_init()
, i.e. at the very latest when
deserialization is attempted.
void gwy_serializable_boxed_assign (GType type
,gpointer destination
,gconstpointer source
);
Copies the value of a boxed struct to another boxed struct.
gboolean gwy_serializable_boxed_equal (GType type
,gconstpointer a
,gconstpointer b
);
Compares the values of two boxed structs for equality.
gsize
gwy_serializable_boxed_n_items (GType type
);
Obtains the number of items a boxed type serialises to.
void gwy_serializable_boxed_itemize (GType type
,gpointer boxed
,GwySerializableItems *items
);
Creates the flattened representation of a serialisable boxed struct.
gpointer gwy_serializable_boxed_construct (GType type
,GwySerializableItems *items
,GwyErrorList **error_list
);
Constructs a serialisable struct type from its flattened representation.
typedef struct { gsize size; gsize n_items; gsize (*itemize) (gpointer boxed, GwySerializableItems *items); gpointer (*construct)(GwySerializableItems *items, GwyErrorList **error_list); void (*assign) (gpointer destination, gconstpointer source); gboolean (*equal) (gconstpointer a, gconstpointer b); } GwySerializableBoxedInfo;
Interface implemented by serialisable boxed types.
The fields and methods are similar to GwySerializableInterface where a more detailed discussion can be found. Some notes to the differences:
The number of items n_items
is a constant, not a method, which is appropriate for plain old data. However, it is
still an upper bound so you can actually serialise less items in GwySerializableBoxedInfo.itemize()
. For the same
reason, no equivalent of GwySerializableInterface.done()
method exists.
Since a serialisable boxed type is a GBoxed, functions such as duplication are realised by the
GBoxed protocol, namelyg_boxed_copy()
and hence needs not be specified.
Size of the boxed data for bit-wise operable plain old data. If it is non-zero |
||
Number of items the boxed struct serialises to. |
||
Appends flattened representation of the boxed struct to the |
||
Deserialises a boxed struct from array of flattened data items. It returns a newly allocated boxed
struct that must be freeable with |
||
Makes the content of a boxed struct identical to the content of another boxed struct of the same type.
If |
||
Compares two boxed data for equality, returns |