Gwyfile Library
Functions
Item – 32bit integer array

Functions

GwyfileItem * gwyfile_item_new_int32_array (const char *name, int32_t *value, uint32_t array_length)
 Creates a new 32bit integer array GWY file item. More...
 
GwyfileItem * gwyfile_item_new_int32_array_copy (const char *name, const int32_t *value, uint32_t array_length)
 Creates a new 32bit integer array GWY file item. More...
 
GwyfileItem * gwyfile_item_new_int32_array_const (const char *name, const int32_t *value, uint32_t array_length)
 Creates a new 32bit integer array GWY file item. More...
 
const int32_t * gwyfile_item_get_int32_array (const GwyfileItem *item)
 Gets the 32bit integer array value contained in a GWY file data item. More...
 
int32_t * gwyfile_item_take_int32_array (GwyfileItem *item)
 Takes the 32bit integer array value contained in a GWY file data item. More...
 
void gwyfile_item_set_int32_array (GwyfileItem *item, int32_t *value, uint32_t array_length)
 Sets the value of a 32bit integer array GWY file item. More...
 
void gwyfile_item_set_int32_array_copy (GwyfileItem *item, const int32_t *value, uint32_t array_length)
 Sets the value of a 32bit integer array GWY file item. More...
 
void gwyfile_item_set_int32_array_const (GwyfileItem *item, const int32_t *value, uint32_t array_length)
 Sets the value of a 32bit integer array GWY file item. More...
 

Detailed Description

Function Documentation

◆ gwyfile_item_get_int32_array()

const int32_t* gwyfile_item_get_int32_array ( const GwyfileItem *  item)

Gets the 32bit integer array value contained in a GWY file data item.

Use gwyfile_item_array_length() to obtain the array length.

The item must be of the 32bit integer array type. Use gwyfile_item_type() to check item type if the type may not match the expected type. Use gwyfile_object_get_with_type() to obtain object items ensuring the type.

Parameters
itemA 32bit integer array GWY file data item.
Returns
The 32bit integer array value of item. The array ownership does not change.
See also
gwyfile_item_take_int32_array

◆ gwyfile_item_new_int32_array()

GwyfileItem* gwyfile_item_new_int32_array ( const char *  name,
int32_t *  value,
uint32_t  array_length 
)

Creates a new 32bit integer array GWY file item.

The item consumes the provided array and takes care of freeing it later. You must not touch the array any more; it can be already freed when this function returns.

Parameters
nameItem name. It must be a non-empty UTF-8-encoded string (usually, it should be an ASCII string). A copy of the string will be made.
valueItem value (to be consumed).
array_lengthArray length. It must be non-zero as GWY files do not permit empty arrays.
Returns
The newly created GWY file data item.
See also
gwyfile_item_new_int32_array_copy

◆ gwyfile_item_new_int32_array_const()

GwyfileItem* gwyfile_item_new_int32_array_const ( const char *  name,
const int32_t *  value,
uint32_t  array_length 
)

Creates a new 32bit integer array GWY file item.

Parameters
nameItem name. It must be a non-empty UTF-8-encoded string (usually, it should be an ASCII string). A copy of the string will be made.
valueItem value (to be used as-is).
array_lengthArray length. It must be non-zero as GWY files do not permit empty arrays.
Returns
The newly created GWY file data item.
See also
gwyfile_item_new_int32_array gwyfile_item_new_int32_array_copy

◆ gwyfile_item_new_int32_array_copy()

GwyfileItem* gwyfile_item_new_int32_array_copy ( const char *  name,
const int32_t *  value,
uint32_t  array_length 
)

Creates a new 32bit integer array GWY file item.

This function makes a copy the provided array. You can continue doing whatever you wish with it after the function returns.

Parameters
nameItem name. It must be a non-empty UTF-8-encoded string (usually, it should be an ASCII string). A copy of the string will be made.
valueItem value (to be copied).
array_lengthArray length. It must be non-zero as GWY files do not permit empty arrays.
Returns
The newly created GWY file data item. Upon memory allocation failure NULL is returned and errno is set to ENOMEM.
See also
gwyfile_item_new_int32_array

◆ gwyfile_item_set_int32_array()

void gwyfile_item_set_int32_array ( GwyfileItem *  item,
int32_t *  value,
uint32_t  array_length 
)

Sets the value of a 32bit integer array GWY file item.

The item must be of the 32bit integer array type.

The item consumes the provided 32bit integer array and takes care of freeing it later. You must not touch the array any more; it can be already freed when this function returns.

Parameters
itemA 32bit integer array GWY file data item.
valueNew value for the item (to be consumed).
array_lengthArray length. It must be non-zero as GWY files do not permit empty arrays.
See also
gwyfile_item_set_int32_array_copy

◆ gwyfile_item_set_int32_array_const()

void gwyfile_item_set_int32_array_const ( GwyfileItem *  item,
const int32_t *  value,
uint32_t  array_length 
)

Sets the value of a 32bit integer array GWY file item.

The item must be of the 32bit integer array type.

The array must exist for the entire lifetime of the item. Hence this function is best for actual constant arrays, however, it can be also used with other arrays whose lifetime is guaranteed.

Parameters
itemA 32bit integer array GWY file data item.
valueNew value for the item (to be used as-is).
array_lengthArray length. It must be non-zero as GWY files do not permit empty arrays.
See also
gwyfile_item_set_int32_array gwyfile_item_set_int32_array_copy

◆ gwyfile_item_set_int32_array_copy()

void gwyfile_item_set_int32_array_copy ( GwyfileItem *  item,
const int32_t *  value,
uint32_t  array_length 
)

Sets the value of a 32bit integer array GWY file item.

The item must be of the 32bit integer array type.

This function makes a copy the provided array. You can continue doing whatever you wish with it after the function returns.

Parameters
itemA 32bit integer array GWY file data item.
valueNew value for the item (to be copied).
array_lengthArray length. It must be non-zero as GWY files do not permit empty arrays.
See also
gwyfile_item_set_int32_array

◆ gwyfile_item_take_int32_array()

int32_t* gwyfile_item_take_int32_array ( GwyfileItem *  item)

Takes the 32bit integer array value contained in a GWY file data item.

The item must own the array when this function is called. The ownership is transferred to the caller who becomes responsible to freeing it later. The array can still be obtained with gwyfile_item_get_int32_array() but, obviously, it cannot be taken again.

Use gwyfile_item_array_length() to obtain the array length.

The item must be of the 32bit integer array type. Use gwyfile_item_type() to check item type if the type may not match the expected type. Use gwyfile_object_get_with_type() to obtain object items ensuring the type.

Parameters
itemA 32bit integer array GWY file data item.
Returns
The 32bit integer array value of item. The array becomes owned by the caller.
See also
gwyfile_item_get_int32_array