Unstructured data interface for any type of data, for example reading an integer from a file. There are currently two different implementations of the SDatasource object.
Also see SDatasource Example.
The data source structure.
Provides a generic interface to different data sources, where a data source can be anything that can be read from and/or written to. Integer I/O Functions and Floating Point I/O Functions are also provided for data source I/O.
The data source class structure.
An enum to define the byte order of a data source.
Values:
big endian byte order.
little endian byte order.
An enum to define the relative position of seek.
Values:
Relative to beginning.
Relative to current position.
Relative to end.
Return the given SDatasource child class object as a SDatasource object.
Parameters: |
|
---|---|
Return: | Given object as SDatasource* type. |
Note: | This casting is not safety checked. |
Read from a data source.
Reads nmemb items of size bytes from the data source into a buffer.
Parameters: |
|
---|---|
Return: | The number of bytes read. |
Note: | Can set S_IOEOF (end-of-file) error, which must be interpreted by the caller if it is an error or not. |
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: |
|
---|---|
Return: | The number of bytes read. |
Note: | Can set S_IOEOF (end-of-file) error, which must be interpreted by the caller if it is an error or not. |
Write to a data source.
Writes nmemb items of size bytes from a buffer into the data source.
Parameters: |
|
---|---|
Return: | The number of bytes written. |
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: |
|
---|---|
Return: | The number of bytes written. |
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: |
|
---|---|
Return: | The offset position. |
Seeks to the given position in the data source, where mode is one of: s_seek_mode.
Parameters: |
|
---|
Configures the byte order to be used by integer read/write operations.
Order may be one of s_byte_order.
Parameters: |
|
---|---|
Parameters: |
|
See also: | |
Note: | At initialization of any object derived from SDatasource the byte order is set to bigendian. |
Read a uint8 value from a data source.
Parameters: |
|
---|---|
Return: | The read uint8 value. |
Read a uint8 value from a data source starting at a given offset position.
Parameters: |
|
---|---|
Return: | The read uint8 value. |
Write a uint8 value to a data source.
Parameters: |
|
---|
Write a uint8 value to a data source with an offset.
Parameters: |
|
---|
Read a uint16 value from a data source.
Parameters: |
|
---|---|
Return: | The read uint16 value. |
Read a uint16 value from a data source starting at a given offset position.
Parameters: |
|
---|---|
Return: | The read uint16 value. |
Write a uint16 value to a data source.
Parameters: |
|
---|
Write a uint16 value to a data source with an offset.
Parameters: |
|
---|
Read a uint32 value from a data source.
Parameters: |
|
---|---|
Return: | The read uint32 value. |
Read a uint32 value from a data source starting at a given offset position.
Parameters: |
|
---|---|
Return: | The read uint32 value. |
Write a uint32 value to a data source.
Parameters: |
|
---|
Write a uint32 value to a data source with an offset.
Parameters: |
|
---|
Read a sint8 value from a data source.
Parameters: |
|
---|---|
Return: | The read sint8 value. |
Read a sint8 value from a data source starting at a given offset position.
Parameters: |
|
---|---|
Return: | The read sint8 value. |
Write a sint8 value to a data source.
Parameters: |
|
---|
Write a sint8 value to a data source with an offset.
Parameters: |
|
---|
Read a sint16 value from a data source.
Parameters: |
|
---|---|
Return: | The read sint16 value. |
Read a sint16 value from a data source starting at a given offset position.
Parameters: |
|
---|---|
Return: | The read sint16 value. |
Write a sint16 value to a data source.
Parameters: |
|
---|
Write a sint16 value to a data source with an offset.
Parameters: |
|
---|
Read a sint32 value from a data source.
Parameters: |
|
---|---|
Return: | The read sint32 value. |
Read a sint32 value from a data source starting at a given offset position.
Parameters: |
|
---|---|
Return: | The read sint32 value. |
Write a sint32 value to a data source.
Parameters: |
|
---|
Write a sint32 value to a data source with an offset.
Parameters: |
|
---|
Read a float value from a data source.
Parameters: |
|
---|---|
Return: | The read float value. |
Read a float value from a data source starting at a given offset position.
Parameters: |
|
---|---|
Return: | The read float value. |
Write a float value to a data source.
Parameters: |
|
---|
Write a float value to a data source with an offset.
Parameters: |
|
---|
Read a double value from a data source.
Parameters: |
|
---|---|
Return: | The read double value. |
Read a double value from a data source starting at a given offset position.
Parameters: |
|
---|---|
Return: | The read double value. |
Write a double value to a data source.
Parameters: |
|
---|
Write a double value to a data source with an offset.
Parameters: |
|
---|
Two different implementations of the abstract SDatasource object:
The file source structure.
Provides an interface to a file based data source.
Create a data source from a previously opened file.
Parameters: |
|
---|---|
Return: | Pointer to the newly created data source. |
Open a file to be used as a data source.
Open the file at path, where mode is character string as used by the standard function fopen().
Parameters: |
|
---|---|
Return: | Pointer to the newly created data source. |
The mmap file source structure.
Provides an interface to a memory mapped file based data source.
Opens a file to be memory mapped and used as a data source.
Open the file at path, where mode is character string as used by the standard function fopen().
Parameters: |
|
---|---|
Return: | Pointer to the newly created data source. |
Note: | The SMMapFilesource data source is read only and does not implement SDatasourceClass methods write (SDatasourceWrite) and write_at (SDatasourceWriteAt). |