VisuDataLoader

VisuDataLoader — a base class for all load methods.

Functions

Types and Values

Object Hierarchy

    GBoxed
    ╰── VisuDataLoaderIter
    GObject
    ╰── ToolDbgObj
        ╰── ToolFileFormat
            ╰── VisuDataLoader

Description

This is a base class to define load methods for atomic or spin data.

Functions

VisuDataLoaderFunc ()

gboolean
(*VisuDataLoaderFunc) (VisuDataLoader *self,
                       const gchar *filename,
                       VisuData *dataObj,
                       guint iSet,
                       GCancellable *cancel,
                       GError **error);

Prototype of function to load filanema and populate dataObj accordingly.

Parameters

self

a VisuDataLoader object.

 

filename

a path to the file to load.

 

dataObj

the VisuData object to populate.

 

iSet

an integer specifying the set to load, if any.

 

cancel

a GCancellable object.

[allow-none]

error

an error location.

[allow-none]

Returns

TRUE if filename matches the format defined by self , even if some parsing errors may occur.

Since: 3.8


visu_data_loader_new ()

VisuDataLoader *
visu_data_loader_new (const gchar *descr,
                      const gchar **patterns,
                      gboolean restricted,
                      VisuDataLoaderFunc func,
                      guint priority);

Creates a new VisuDataLoader with the given description.

Parameters

descr

a string describing the object, translated and in UTF8.

 

patterns

the patterns used to identify files of this type.

[array zero-terminated=1]

restricted

a boolean.

 

func

a loading method.

[scope call]

priority

a integer.

 

Returns

a newly created VisuDataLoader object.

[transfer full]

Since: 3.8


visu_data_loader_comparePriority ()

gint
visu_data_loader_comparePriority (const VisuDataLoader *a,
                                  const VisuDataLoader *b);

Compare the priority of a and b .

Parameters

a

a VisuDataLoader object.

 

b

a VisuDataLoader object.

 

Returns

-1 if a is at a lower priority than b , +1 otherwise and 0 in case of equality.

Since: 3.8


visu_data_loader_load ()

gboolean
visu_data_loader_load (VisuDataLoader *loader,
                       const gchar *filename,
                       VisuData *dataObj,
                       guint iSet,
                       GCancellable *cancel,
                       GError **error);

Try to load filename as a file format corresponding to loader . error is not set if filename is not of this format, simply FALSE is returned.

Parameters

loader

a VisuDataLoader object.

 

filename

a filename.

 

dataObj

a VisuData object to be populated.

 

iSet

an integer.

 

cancel

a cancellation object.

[allow-none]

error

an error location.

 

Returns

TRUE if filename is of a format handled by loader .

Since: 3.8


visu_data_loader_setStatus ()

void
visu_data_loader_setStatus (VisuDataLoader *loader,
                            const gchar *status);

Change the current status of loader . This can be used to notify changes when visu_data_loader_load() is taking long time.

Parameters

loader

a VisuDataLoader object.

 

status

a string.

 

Since: 3.8


visu_data_loader_iter_new ()

VisuDataLoaderIter *
visu_data_loader_iter_new ();

Creates a newly allocated iterator. This iterator can be used to accumulate nodes when parsing a file. When parsing is finished, use visu_data_loader_iter_allocate() to allocate enough memory in a VisuNodeArray to store the parsed data.

Returns

a newly allocated VisuDataLoaderIter object. Use visu_data_loader_iter_unref() when no longer needed.

[transfer full]

Since: 3.8


visu_data_loader_iter_addNode ()

void
visu_data_loader_iter_addNode (VisuDataLoaderIter *iter,
                               const VisuElement *element);

Register an additional node of type element .

Parameters

iter

a VisuDataLoaderIter object.

 

element

a VisuElement object.

 

Since: 3.8


visu_data_loader_iter_allocate ()

guint
visu_data_loader_iter_allocate (VisuDataLoaderIter *iter,
                                VisuNodeArray *array);

Call visu_node_array_allocate() on array with the proper VisuElement list and number of nodes as registered in iter .

Parameters

iter

a VisuDataLoaderIter object.

 

array

a VisuNodeArray object.

 

Returns

the total number of nodes registered in iter .

Since: 3.8


visu_data_loader_iter_unref ()

void
visu_data_loader_iter_unref (VisuDataLoaderIter *iter);

Decrement the reference counter of iter . When counter reaches 0, the memory occupied by iter is freed.

Parameters

iter

a VisuDataLoaderIter object.

 

Since: 3.8


visu_data_loader_iter_ref ()

VisuDataLoaderIter *
visu_data_loader_iter_ref (VisuDataLoaderIter *iter);

Increment the reference counter on iter .

Parameters

iter

a VisuDataLoaderIter object.

 

Returns

a pointer on iter .

[transfer full]

Since: 3.8

Types and Values

struct VisuDataLoader

struct VisuDataLoader;

An opaque structure.


struct VisuDataLoaderClass

struct VisuDataLoaderClass {
  ToolFileFormatClass parent;
};

An opaque structure.

Members

ToolFileFormatClass parent;

the parent class.