Buffer classes

Buffer classes

Functions

Properties

gpointer buffer Write / Construct Only
GBytes * data Write / Construct Only
GArrowBuffer * parent Read / Write / Construct Only

Types and Values

Object Hierarchy

    GObject
    ╰── GArrowBuffer
        ├── GArrowCUDABuffer
        ╰── GArrowMutableBuffer
            ├── GArrowCUDAHostBuffer
            ╰── GArrowResizableBuffer

Includes

#include <arrow-glib/arrow-glib.h>

Description

GArrowBuffer is a class for keeping data. Other classes such as GArrowArray and GArrowTensor can use data in buffer.

GArrowBuffer is immutable.

GArrowMutableBuffer is mutable.

GArrowResizableBuffer is mutable and resizable.

Functions

garrow_buffer_new ()

GArrowBuffer *
garrow_buffer_new (const guint8 *data,
                   gint64 size);

Parameters

data

Data for the buffer. They aren't owned by the new buffer. You must not free the data while the new buffer is alive.

[array length=size]

size

The number of bytes of the data.

 

Returns

A newly created GArrowBuffer.

Since: 0.3.0


garrow_buffer_new_bytes ()

GArrowBuffer *
garrow_buffer_new_bytes (GBytes *data);

Parameters

data

Data for the buffer.

 

Returns

A newly created GArrowBuffer.

Since: 0.9.0


garrow_buffer_equal ()

gboolean
garrow_buffer_equal (GArrowBuffer *buffer,
                     GArrowBuffer *other_buffer);

Parameters

buffer

A GArrowBuffer.

 

other_buffer

A GArrowBuffer to be compared.

 

Returns

TRUE if both of them have the same data, FALSE otherwise.

Since: 0.4.0


garrow_buffer_equal_n_bytes ()

gboolean
garrow_buffer_equal_n_bytes (GArrowBuffer *buffer,
                             GArrowBuffer *other_buffer,
                             gint64 n_bytes);

Parameters

buffer

A GArrowBuffer.

 

other_buffer

A GArrowBuffer to be compared.

 

n_bytes

The number of first bytes to be compared.

 

Returns

TRUE if both of them have the same data in the first n_bytes, FALSE otherwise.

Since: 0.4.0


garrow_buffer_is_mutable ()

gboolean
garrow_buffer_is_mutable (GArrowBuffer *buffer);

Parameters

buffer

A GArrowBuffer.

 

Returns

TRUE if the buffer is mutable, FALSE otherwise.

Since: 0.3.0


garrow_buffer_get_capacity ()

gint64
garrow_buffer_get_capacity (GArrowBuffer *buffer);

Parameters

buffer

A GArrowBuffer.

 

Returns

The number of bytes that where allocated for the buffer in total.

Since: 0.3.0


garrow_buffer_get_data ()

GBytes *
garrow_buffer_get_data (GArrowBuffer *buffer);

Parameters

buffer

A GArrowBuffer.

 

Returns

The data of the buffer. The data is owned by the buffer. You should not free or modify the data.

[transfer full]

Since: 0.3.0


garrow_buffer_get_mutable_data ()

GBytes *
garrow_buffer_get_mutable_data (GArrowBuffer *buffer);

Parameters

buffer

A GArrowBuffer.

 

Returns

The data of the buffer. If the buffer is imutable, it returns NULL. The data is owned by the buffer. You should not free the data.

[transfer full][nullable]

Since: 0.3.0


garrow_buffer_get_size ()

gint64
garrow_buffer_get_size (GArrowBuffer *buffer);

Parameters

buffer

A GArrowBuffer.

 

Returns

The number of bytes that might have valid data.

Since: 0.3.0


garrow_buffer_get_parent ()

GArrowBuffer *
garrow_buffer_get_parent (GArrowBuffer *buffer);

Parameters

buffer

A GArrowBuffer.

 

Returns

The parent GArrowBuffer or NULL.

[nullable][transfer full]

Since: 0.3.0


garrow_buffer_copy ()

GArrowBuffer *
garrow_buffer_copy (GArrowBuffer *buffer,
                    gint64 start,
                    gint64 size,
                    GError **error);

Parameters

buffer

A GArrowBuffer.

 

start

An offset of data to be copied in byte.

 

size

The number of bytes to be copied from the start.

 

error

Return location for a GError or NULL.

[nullable]

Returns

A newly copied GArrowBuffer on success, NULL on error.

[nullable][transfer full]

Since: 0.3.0


garrow_buffer_slice ()

GArrowBuffer *
garrow_buffer_slice (GArrowBuffer *buffer,
                     gint64 offset,
                     gint64 size);

Parameters

buffer

A GArrowBuffer.

 

offset

An offset in the buffer data in byte.

 

size

The number of bytes of the sliced data.

 

Returns

A newly created GArrowBuffer that shares data of the base GArrowBuffer. The created GArrowBuffer has data start with offset from the base buffer data and are the specified bytes size.

[transfer full]

Since: 0.3.0


garrow_mutable_buffer_new ()

GArrowMutableBuffer *
garrow_mutable_buffer_new (guint8 *data,
                           gint64 size);

Parameters

data

Data for the buffer. They aren't owned by the new buffer. You must not free the data while the new buffer is alive.

[array length=size]

size

The number of bytes of the data.

 

Returns

A newly created GArrowMutableBuffer.

Since: 0.3.0


garrow_mutable_buffer_new_bytes ()

GArrowMutableBuffer *
garrow_mutable_buffer_new_bytes (GBytes *data);

Parameters

data

Data for the buffer.

 

Returns

A newly created GArrowMutableBuffer.

Since: 0.9.0


garrow_mutable_buffer_slice ()

GArrowMutableBuffer *
garrow_mutable_buffer_slice (GArrowMutableBuffer *buffer,
                             gint64 offset,
                             gint64 size);

Parameters

buffer

A GArrowMutableBuffer.

 

offset

An offset in the buffer data in byte.

 

size

The number of bytes of the sliced data.

 

Returns

A newly created GArrowMutableBuffer that shares data of the base GArrowMutableBuffer. The created GArrowMutableBuffer has data start with offset from the base buffer data and are the specified bytes size.

[transfer full]

Since: 0.3.0


garrow_mutable_buffer_set_data ()

gboolean
garrow_mutable_buffer_set_data (GArrowMutableBuffer *buffer,
                                gint64 offset,
                                const guint8 *data,
                                gint64 size,
                                GError **error);

Parameters

buffer

A GArrowMutableBuffer.

 

offset

A write offset in the buffer data in byte.

 

data

The data to be written.

[array length=size]

size

The number of bytes of the data to be written.

 

error

Return location for a GError or NULL.

[nullable]

Returns

TRUE on success, FALSE otherwise.

Since: 0.12.0


garrow_resizable_buffer_new ()

GArrowResizableBuffer *
garrow_resizable_buffer_new (gint64 initial_size,
                             GError **error);

Parameters

initial_size

The initial buffer size in bytes.

 

error

Return location for a GError or NULL.

[nullable]

Returns

A newly created GArrowResizableBuffer.

[nullable]

Since: 0.10.0


garrow_resizable_buffer_resize ()

gboolean
garrow_resizable_buffer_resize (GArrowResizableBuffer *buffer,
                                gint64 new_size,
                                GError **error);

Parameters

buffer

A GArrowResizableBuffer.

 

new_size

The new buffer size in bytes.

 

error

Return location for a GError or NULL.

[nullable]

Returns

TRUE on success, FALSE if there was an error.

Since: 0.3.0


garrow_resizable_buffer_reserve ()

gboolean
garrow_resizable_buffer_reserve (GArrowResizableBuffer *buffer,
                                 gint64 new_capacity,
                                 GError **error);

Parameters

buffer

A GArrowResizableBuffer.

 

new_capacity

The new buffer capacity in bytes.

 

error

Return location for a GError or NULL.

[nullable]

Returns

TRUE on success, FALSE if there was an error.

Since: 0.3.0

Types and Values

GARROW_TYPE_BUFFER

#define GARROW_TYPE_BUFFER (garrow_buffer_get_type())

struct GArrowBufferClass

struct GArrowBufferClass {
  GObjectClass parent_class;
};

GARROW_TYPE_MUTABLE_BUFFER

#define GARROW_TYPE_MUTABLE_BUFFER (garrow_mutable_buffer_get_type())

struct GArrowMutableBufferClass

struct GArrowMutableBufferClass {
  GArrowBufferClass parent_class;
};

GARROW_TYPE_RESIZABLE_BUFFER

#define GARROW_TYPE_RESIZABLE_BUFFER (garrow_resizable_buffer_get_type())

struct GArrowResizableBufferClass

struct GArrowResizableBufferClass {
  GArrowMutableBufferClass parent_class;
};

GArrowBuffer

typedef struct _GArrowBuffer GArrowBuffer;

GArrowMutableBuffer

typedef struct _GArrowMutableBuffer GArrowMutableBuffer;

GArrowResizableBuffer

typedef struct _GArrowResizableBuffer GArrowResizableBuffer;

Property Details

The “buffer” property

  “buffer”                   gpointer

The raw std::shared_ptr<arrow::Buffer> *.

Owner: GArrowBuffer

Flags: Write / Construct Only


The “data” property

  “data”                     GBytes *

The raw data passed as GBytes *.

Owner: GArrowBuffer

Flags: Write / Construct Only


The “parent” property

  “parent”                   GArrowBuffer *

The parent GArrowBuffer *.

Owner: GArrowBuffer

Flags: Read / Write / Construct Only