Class

NumCosmoMathSerialize

Description [src]

final class NumCosmoMath.Serialize : GObject.Object
{
  /* No available fields */
}

Serialization, deserialization and duplication of GObject instances.

An object is serialized as a GVariant of type #NCM_SERIALIZE_OBJECT_TYPE, (sa{sv}): its type name and a dictionary of its read-write properties. Object-valued properties are serialized recursively. The same content can be written as GVariant text, as the shorthand TypeName{'prop': <value>, ...}, as binary GVariant data, or as YAML. Arrays and dictionaries of objects (NcmObjArray, NcmObjDictStr, NcmObjDictInt) and NcmVarDict have their own functions.

A serializer keeps a table of named instances. An object in that table, or one serialized earlier with a name, is written as TypeName[name] without its properties. Deserializing TypeName[name] returns the instance of that name when the table has one. With #NCM_SERIALIZE_OPT_AUTONAME_SER each newly serialized object is named S<n>, and with #NCM_SERIALIZE_OPT_AUTOSAVE_SER each named object deserialized is added to the table. Together (#NCM_SERIALIZE_OPT_CLEAN_DUP) they make ncm_serialize_dup_obj() keep an object shared by several properties shared in the copy.

ncm_serialize_global() returns a process-wide serializer without options, and the ncm_serialize_global functions use it.

Ancestors

Constructors

ncm_serialize_new

Creates a new NcmSerialize.

Functions

ncm_serialize_clear

Decreases the reference count of ser by one and sets ser to NULL.

ncm_serialize_global

Returns the process-wide serializer, created without options on first use.

ncm_serialize_global_clear_instances

Same as ncm_serialize_clear_instances() with the serializer of ncm_serialize_global().

ncm_serialize_global_contain_instance

Same as ncm_serialize_contain_instance() with the serializer of ncm_serialize_global().

ncm_serialize_global_contain_name

Same as ncm_serialize_contain_name() with the serializer of ncm_serialize_global().

ncm_serialize_global_count_instances

Same as ncm_serialize_count_instances() with the serializer of ncm_serialize_global().

ncm_serialize_global_count_saved_serializations

Same as ncm_serialize_count_saved_serializations() with the serializer of ncm_serialize_global().

ncm_serialize_global_dup_obj

Same as ncm_serialize_dup_obj() with the serializer of ncm_serialize_global().

ncm_serialize_global_from_binfile

Same as ncm_serialize_from_binfile() with the serializer of ncm_serialize_global().

ncm_serialize_global_from_file

Same as ncm_serialize_from_file() with the serializer of ncm_serialize_global().

ncm_serialize_global_from_name_params

Same as ncm_serialize_from_name_params() with the serializer of ncm_serialize_global().

ncm_serialize_global_from_string

Same as ncm_serialize_from_string() with the serializer of ncm_serialize_global().

ncm_serialize_global_from_variant

Same as ncm_serialize_from_variant() with the serializer of ncm_serialize_global().

ncm_serialize_global_from_yaml

Same as ncm_serialize_from_yaml() with the serializer of ncm_serialize_global().

ncm_serialize_global_from_yaml_file

Same as ncm_serialize_from_yaml_file() with the serializer of ncm_serialize_global().

ncm_serialize_global_get_by_name

Same as ncm_serialize_get_by_name() with the serializer of ncm_serialize_global().

ncm_serialize_global_gvalue_to_gvariant

Same as ncm_serialize_gvalue_to_gvariant() with the serializer of ncm_serialize_global().

ncm_serialize_global_is_named

Same as ncm_serialize_is_named() with the serializer of ncm_serialize_global().

ncm_serialize_global_log_stats

Same as ncm_serialize_log_stats() with the serializer of ncm_serialize_global().

ncm_serialize_global_peek_name

Same as ncm_serialize_peek_name() with the serializer of ncm_serialize_global().

ncm_serialize_global_remove_ser

Same as ncm_serialize_remove_ser() with the serializer of ncm_serialize_global().

ncm_serialize_global_reset

Same as ncm_serialize_reset() with the serializer of ncm_serialize_global().

ncm_serialize_global_set

Same as ncm_serialize_set() with the serializer of ncm_serialize_global().

ncm_serialize_global_set_property

Same as ncm_serialize_set_property() with the serializer of ncm_serialize_global().

ncm_serialize_global_set_property_from_key_file

Same as ncm_serialize_set_property_from_key_file() with the serializer of ncm_serialize_global().

ncm_serialize_global_to_binfile

Same as ncm_serialize_to_binfile() with the serializer of ncm_serialize_global().

ncm_serialize_global_to_file

Same as ncm_serialize_to_file() with the serializer of ncm_serialize_global().

ncm_serialize_global_to_string

Same as ncm_serialize_to_string() with the serializer of ncm_serialize_global().

ncm_serialize_global_to_variant

Same as ncm_serialize_to_variant() with the serializer of ncm_serialize_global().

ncm_serialize_global_to_yaml

Same as ncm_serialize_to_yaml() with the serializer of ncm_serialize_global().

ncm_serialize_global_to_yaml_file

Same as ncm_serialize_to_yaml_file() with the serializer of ncm_serialize_global().

ncm_serialize_global_unset

Same as ncm_serialize_unset() with the serializer of ncm_serialize_global().

ncm_serialize_global_variant_to_yaml

Same as ncm_serialize_variant_to_yaml() with the serializer of ncm_serialize_global().

Instance methods

ncm_serialize_array_from_key_file

Deserializes an array of objects from the key file written by ncm_serialize_array_to_key_file().

ncm_serialize_array_from_variant

Deserializes an array of objects.

ncm_serialize_array_from_yaml

Deserializes an array of objects from YAML, in the form written by ncm_serialize_array_to_yaml().

ncm_serialize_array_from_yaml_file

Same as ncm_serialize_array_from_yaml() with the contents of filename.

ncm_serialize_array_to_key_file

Writes oa to filename as a key file: a group NcmObjArray with the key empty, and for each element a group ARRAY:ELEMENT:<i> with the type name under OBJECT:NAME and one key per property, as GVariant text.

ncm_serialize_array_to_variant

Serializes oa, each object as ncm_serialize_to_variant().

ncm_serialize_array_to_yaml

Serializes oa to YAML.

ncm_serialize_array_to_yaml_file

Writes ncm_serialize_array_to_yaml() to filename.

ncm_serialize_clear_instances

Removes the named instances, releasing the references ser holds.

ncm_serialize_contain_instance
No description available.

ncm_serialize_contain_name
No description available.

ncm_serialize_count_instances
No description available.

ncm_serialize_count_saved_serializations
No description available.

ncm_serialize_dict_int_from_variant

Deserializes a dictionary of objects with integer keys.

ncm_serialize_dict_int_from_yaml

Deserializes a dictionary of objects with integer keys from YAML, in the form written by ncm_serialize_dict_int_to_yaml().

ncm_serialize_dict_int_from_yaml_file

Same as ncm_serialize_dict_int_from_yaml() with the contents of filename.

ncm_serialize_dict_int_to_variant

Serializes odi, each object as ncm_serialize_to_variant().

ncm_serialize_dict_int_to_yaml

Serializes odi to YAML.

ncm_serialize_dict_int_to_yaml_file

Writes ncm_serialize_dict_int_to_yaml() to filename.

ncm_serialize_dict_str_from_binfile

Deserializes a NcmObjDictStr from the binary GVariant data written by ncm_serialize_dict_str_to_binfile().

ncm_serialize_dict_str_from_variant

Deserializes a dictionary of objects with string keys.

ncm_serialize_dict_str_from_yaml

Deserializes a dictionary of objects with string keys from YAML, in the form written by ncm_serialize_dict_str_to_yaml().

ncm_serialize_dict_str_from_yaml_file

Same as ncm_serialize_dict_str_from_yaml() with the contents of filename.

ncm_serialize_dict_str_to_binfile

Writes ods to filename as binary GVariant data.

ncm_serialize_dict_str_to_variant

Serializes ods, each object as ncm_serialize_to_variant().

ncm_serialize_dict_str_to_yaml

Serializes ods to YAML.

ncm_serialize_dict_str_to_yaml_file

Writes ncm_serialize_dict_str_to_yaml() to filename.

ncm_serialize_dup_array

Duplicates oa as ncm_serialize_dup_obj() does for each element.

ncm_serialize_dup_obj

Duplicates obj by serializing and deserializing it with ser. Named instances of ser are reused, not copied. With #NCM_SERIALIZE_OPT_CLEAN_DUP an object shared inside obj stays shared in the copy; the automatic names then remain in ser, so call ncm_serialize_reset() before using ser for another copy.

ncm_serialize_free

Decreases the reference count of ser by one.

ncm_serialize_from_binfile

Deserializes an object from the binary GVariant data written by ncm_serialize_to_binfile(). Aborts if the file cannot be read.

ncm_serialize_from_file

Same as ncm_serialize_from_string() with the contents of filename. Aborts if the file cannot be read.

ncm_serialize_from_name_params

Creates an object of type TypeName with the properties in params. For TypeName[name], the named instance is returned if ser has one; giving params as well then aborts. With #NCM_SERIALIZE_OPT_AUTOSAVE_SER a new named object is added to the named instances. Aborts if TypeName is not a registered type.

ncm_serialize_from_string

Deserializes obj_ser, written either as GVariant text of type

NCM_SERIALIZE_OBJECT_TYPE or as the shorthand TypeName{'prop': <value>, ...}, where

the properties are optional and TypeName may be TypeName[name]. Aborts if obj_ser has neither form.

ncm_serialize_from_variant

Deserializes an object, see ncm_serialize_from_name_params().

ncm_serialize_from_yaml

Deserializes an object from YAML, in the form written by ncm_serialize_to_yaml().

ncm_serialize_from_yaml_file

Same as ncm_serialize_from_yaml() with the contents of filename.

ncm_serialize_get_by_name
No description available.

ncm_serialize_gvalue_to_gvariant

Converts val to a GVariant, serializing objects with ncm_serialize_to_variant(). Aborts for a type it cannot convert.

ncm_serialize_is_named

Parses serobj, as GVariant text or the shorthand of ncm_serialize_from_string(), and checks whether it has the form TypeName[name]. Aborts if serobj cannot be parsed.

ncm_serialize_log_stats

Logs the sizes of the tables of ser.

ncm_serialize_peek_by_name
No description available.

ncm_serialize_peek_name

Aborts if obj is not a named instance of ser.

ncm_serialize_ref

Increases the reference count of ser by one.

ncm_serialize_remove_ser

Removes the saved serialization of obj, if any.

ncm_serialize_reset

Empties the table of named instances and the saved serializations, see ncm_serialize_clear_instances(), and restarts the automatic names at S0.

ncm_serialize_set

Adds obj to the named instances under name, holding a reference to it. Aborts if another instance has name and overwrite is FALSE.

ncm_serialize_set_property

Sets the properties of obj from prop_str, deserializing object-valued properties. Aborts if prop_str cannot be parsed.

ncm_serialize_set_property_from_key_file

Sets the properties of obj from the keys of the group Precision Parameters of prop_file, each value written as GVariant text. A file without groups is read as that group. Aborts if the file cannot be read.

ncm_serialize_to_binfile

Writes obj to filename as binary GVariant data. Aborts if the file cannot be written.

ncm_serialize_to_file

Writes obj to filename as GVariant text. Aborts if the file cannot be written.

ncm_serialize_to_string

Serializes obj as GVariant text or, if valid_variant is FALSE, as the shorthand read by ncm_serialize_from_string().

ncm_serialize_to_variant

Serializes obj. A named instance, or an object serialized earlier with a name, is written as TypeName[name] without properties. Otherwise every read-write property is serialized; with #NCM_SERIALIZE_OPT_AUTONAME_SER the object is named S<n> and its serialization saved.

ncm_serialize_to_yaml

Serializes obj to YAML.

ncm_serialize_to_yaml_file

Writes ncm_serialize_to_yaml() to filename.

ncm_serialize_unref

Same as ncm_serialize_free().

ncm_serialize_unset

Removes obj from the named instances. Does nothing if obj is not one.

ncm_serialize_var_dict_from_variant

Deserializes a NcmVarDict; each value is stored with ncm_var_dict_set_variant().

ncm_serialize_var_dict_from_variant_file

Deserializes a NcmVarDict from the file written by ncm_serialize_var_dict_to_variant_file().

ncm_serialize_var_dict_from_yaml

Deserializes a NcmVarDict from YAML, in the form written by ncm_serialize_var_dict_to_yaml().

ncm_serialize_var_dict_from_yaml_file

Same as ncm_serialize_var_dict_from_yaml() with the contents of filename.

ncm_serialize_var_dict_to_variant

Serializes vd, each object as ncm_serialize_to_variant().

ncm_serialize_var_dict_to_variant_file

Writes vd to filename as binary GVariant data or GVariant text.

ncm_serialize_var_dict_to_yaml

Serializes dict to YAML.

ncm_serialize_var_dict_to_yaml_file

Writes ncm_serialize_var_dict_to_yaml() to filename.

ncm_serialize_variant_to_yaml

Converts a serialized object to YAML.

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Properties

NumCosmoMath.Serialize:options

The NcmSerializeOpt flags.

Signals

Signals inherited from GObject (1)
GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Class structure

struct NumCosmoMathSerializeClass {
  GObjectClass parent_class;
  
}

No description available.

Class members
parent_class: GObjectClass

No description available.