Previous topic

SDatasource Structure

Next topic

Structured Data Interface

SDatasourceClass StructureΒΆ

speect class SDatasourceClass

The data source class structure.

Protected Attributes
SObjectClass _inherit

Inherit from SObjectClass.

size_t(*const read)(SDatasource *self, void *ptr, size_t size, size_t nmemb, s_erc *error)

Read function pointer.

Read from a data source. Reads nmemb items of size bytes from the data source into a buffer.

Parameters:
  • self

    The data source to read from.

  • ptr

    The buffer to read the data into.

  • size

    The size of the items.

  • nmemb

    Number of items to read.

  • error

    Error code.

Return:

The number of bytes read.

size_t(*const read_at)(SDatasource *self, void *ptr, size_t size, size_t nmemb, long pos, s_erc *error)

ReadAt function pointer.

Read from a data source starting at a given offset position. Reads nmemb items of size bytes from the data source into a buffer starting at pos.

Parameters:
  • self

    The data source to read from.

  • ptr

    The buffer to read the data into.

  • size

    The size of the items.

  • nmemb

    Number of items to read.

  • pos

    The offset to start reading from.

  • error

    Error code.

Return:

The number of bytes read.

size_t(*const write)(SDatasource *self, const void *ptr, size_t size, size_t nmemb, s_erc *error)

Write function pointer.

Write to a data source. Writes nmemb items of size bytes from a buffer into the data source.

Parameters:
  • self

    The data source to write from.

  • ptr

    The buffer containing the data.

  • size

    The size of the items.

  • nmemb

    Number of items to write.

  • error

    Error code.

Return:

The number of bytes written.

size_t(*const write_at)(SDatasource *self, const void *ptr, size_t size, size_t nmemb, long pos, s_erc *error)

WriteAt function pointer.

Write to a data source starting at a given offset position. Writes nmemb items of size bytes from a buffer into the data source starting at pos.

Parameters:
  • self

    The data source to write from.

  • ptr

    The buffer containing the data.

  • size

    The size of the items.

  • nmemb

    Number of items to write.

  • pos

    The offset to start writing from.

  • error

    Error code.

Return:

The number of bytes written.

long(*const tell)(SDatasource *self, s_erc *error)

Tell function pointer.

Returns the current position in the data source. If the underlying data source does not support this operation, a value of -1 is returned.

Parameters:
  • self

    The data source.

  • error

    Error code.

Return:

The offset position.

void(*const seek)(SDatasource *self, long pos, s_seek_mode mode, s_erc *error)

Seek function pointer.

Seeks to the given position in the data source, where mode is one of: s_seek_mode.

Parameters:
  • self

    The data source.

  • pos

    The position.

  • mode

    The position relative to s_seek_mode.

  • error

    Error code.