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.
Functions
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_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_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_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_str_from_binfile
Deserializes a NcmObjDictStr from the binary GVariant data written by ncm_serialize_dict_str_to_binfile().
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_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_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_yaml
Deserializes an object from YAML, in the form written by ncm_serialize_to_yaml().
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_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_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_file
Writes vd to filename as binary GVariant data or GVariant text.
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.