BData

BData — Base class for data objects.

Functions

Signals

void changed No Recursion

Types and Values

struct BDataClass
  BData

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── BData
            ├── BMatrix
            ├── BVector
            ├── BScalar
            ╰── BStruct

Description

Abstract base class for data classes, including BScalar, BVector, and BMatrix, representing single numbers or arrays of numbers, respectively.

Data objects can maintain a cache for fast access. When the underlying data changes, the "changed" signal is emitted, and the default signal handler invalidates the cache. Subsequent calls to "get_values" will refill the cache. The size of the array and minimum and maximum values are also cached. Depending on the implementation, the get_value() functions (for getting single values) may not refill the cache.

Data objects also maintain a timestamp that updates when the "changed" signal is emitted.

Functions

b_data_dup ()

BData *
b_data_dup (BData *src);

Duplicates a BData object.

Parameters

src

BData

 

Returns

A deep copy of src .

[transfer full]


b_data_dup_to_simple ()

BData *
b_data_dup_to_simple (BData *src);

Duplicates a BData object, creating a simple data object of the same size and contents. So for example, any subclass of BVector is duplicated as a BValVector.

Parameters

src

BData

 

Returns

A deep copy of src .

[transfer full]


b_data_get_timestamp ()

gint64
b_data_get_timestamp (BData *data);

Returns a timestamp (microseconds since January 1, 1970, UTC) giving the last time the data changed.

Parameters

data

BData

 

b_data_serialize ()

char *
b_data_serialize (BData *dat,
                  gpointer user);

Parameters

dat

BData

 

user

a pointer describing the context.

 

Returns

a string representation of the data that the caller is responsible for freeing


b_data_emit_changed ()

void
b_data_emit_changed (BData *data);

Utility to emit a 'changed' signal

Parameters

data

BData

 

b_data_has_value ()

gboolean
b_data_has_value (BData *data);

Returns whether data contains a finite value.

Parameters

data

BData

 

Returns

TRUE if data has at least one finite value.


b_data_get_n_dimensions ()

char
b_data_get_n_dimensions (BData *data);

Get the number of dimensions in data , i.e. 0 for a scalar, 1 for a vector, and 2 for a matrix. Returns -1 for a struct.

Parameters

data

BData

 

Returns

the number of dimensions


b_data_get_n_values ()

unsigned int
b_data_get_n_values (BData *data);

Get the number of values in data .

Parameters

data

BData

 

Returns

the number of elements

Types and Values

struct BDataClass

struct BDataClass {
  GObjectClass base;

  BData *(*dup) (BData * src);

  char *(*serialize) (BData * dat, gpointer user);

  char (*get_sizes) (BData * data, unsigned int *sizes);
  gboolean (*has_value) (BData *data);

  /* signals */
  void (*emit_changed) (BData * data);
};

Class for BData.

Members

GObjectClass base;

base class.

 

dup ()

duplicates the BData.

 

serialize ()

serializes to text.

 

get_sizes ()

gets the size of each dimension and returns the number of dimensions.

 

has_value ()

returns whether data has a finite value.

 

emit_changed ()

changed signal default handler

 

BData

typedef struct _BData BData;

Object representing data.

Signal Details

The “changed” signal

void
user_function (BData   *BData,
               gpointer user_data)

The ::changed signal is emitted when the data changes.

Parameters

BData

the data object that changed

 

user_data

user data set when the signal handler was connected.

 

Flags: No Recursion