libgta
1.2.1
Read and Write Generic Tagged Array (GTA) files
|
The GTA header. More...
Public Member Functions | |
Constructor / Destructor & Co. | |
header () | |
Constructor. | |
header (const header &hdr) | |
Copy constructor. More... | |
~header () | |
Destructor. | |
const header & | operator= (const header &hdr) |
Assignment operator. More... | |
Read and Write a Header | |
void | read_from (custom_io &io) |
Read a header. More... | |
void | read_from (std::istream &is) |
Read a header. More... | |
void | read_from (FILE *f) |
Read a header. More... | |
void | read_from (int fd) |
Read a header. More... | |
void | write_to (custom_io &io) const |
Write a header. More... | |
void | write_to (std::ostream &os) const |
Write a header. More... | |
void | write_to (FILE *f) const |
Write a header. More... | |
void | write_to (int fd) const |
Write a header. More... | |
Access Header Information | |
const taglist & | global_taglist () const |
Get the global tag list. More... | |
taglist & | global_taglist () |
Get the global tag list. More... | |
uintmax_t | element_size () const |
Get the element size. More... | |
uintmax_t | components () const |
Get the number of components. More... | |
type | component_type (uintmax_t i) const |
Get the component type. More... | |
uintmax_t | component_size (uintmax_t i) const |
Get the component size. More... | |
const taglist & | component_taglist (uintmax_t i) const |
Get the component tag list. More... | |
taglist & | component_taglist (uintmax_t i) |
Get the component tag list. More... | |
uintmax_t | dimensions () const |
Get the number of dimensions. More... | |
uintmax_t | dimension_size (uintmax_t i) const |
Get the size in a dimension. More... | |
const taglist & | dimension_taglist (uintmax_t i) const |
Get the dimension tag list. More... | |
taglist & | dimension_taglist (uintmax_t i) |
Get the dimension tag list. More... | |
uintmax_t | elements () const |
Get the total number of elements in the array. More... | |
uintmax_t | data_size () const |
Get the total size of the array. More... | |
gta::compression | compression () const |
Get the compression. More... | |
void | set_compression (gta::compression compression) |
Set the compression. More... | |
Define an Array | |
void | set_components (uintmax_t n, const type *types, const uintmax_t *sizes=NULL) |
Set the components of an array element. More... | |
void | set_components (type type, uintmax_t size=0) |
Set the components of an array element (variant for elements with a single component). More... | |
void | set_components (type type0, type type1, uintmax_t size0=0, uintmax_t size1=0) |
Set the components of an array element (variant for elements with two components). More... | |
void | set_components (type type0, type type1, type type2, uintmax_t size0=0, uintmax_t size1=0, uintmax_t size2=0) |
Set the components of an array element (variant for elements with three components). More... | |
void | set_components (type type0, type type1, type type2, type type3, uintmax_t size0=0, uintmax_t size1=0, uintmax_t size2=0, uintmax_t size3=0) |
Set the components of an array element (variant for elements with four components). More... | |
void | set_dimensions (uintmax_t n, const uintmax_t *sizes) |
Set the dimensions. More... | |
void | set_dimensions (uintmax_t size) |
Set the dimensions (variant for one-dimensional arrays). More... | |
void | set_dimensions (uintmax_t size0, uintmax_t size1) |
Set the dimensions (variant for two-dimensional arrays). More... | |
void | set_dimensions (uintmax_t size0, uintmax_t size1, uintmax_t size2) |
Set the dimensions (variant for three-dimensional arrays). More... | |
void | set_dimensions (uintmax_t size0, uintmax_t size1, uintmax_t size2, uintmax_t size3) |
Set the dimensions (variant for four-dimensional arrays). More... | |
Read and Write Complete Arrays | |
void | read_data (custom_io &io, void *data) const |
Read the complete data. More... | |
void | read_data (std::istream &is, void *data) const |
Read the complete data. More... | |
void | read_data (FILE *f, void *data) const |
Read the complete data. More... | |
void | read_data (int fd, void *data) const |
Read the complete data. More... | |
void | skip_data (custom_io &io) const |
Skip the complete data. More... | |
void | skip_data (std::istream &is) const |
Skip the complete data. More... | |
void | skip_data (FILE *f) const |
Skip the complete data. More... | |
void | skip_data (int fd) const |
Skip the complete data. More... | |
void | write_data (custom_io &io, const void *data) const |
Write the complete data. More... | |
void | write_data (std::ostream &os, const void *data) const |
Write the complete data. More... | |
void | write_data (FILE *f, const void *data) const |
Write the complete data. More... | |
void | write_data (int fd, const void *data) const |
Write the complete data. More... | |
void | copy_data (custom_io &read_io, const header &write_header, custom_io &write_io) const |
Copy the complete data. More... | |
void | copy_data (std::istream &is, const header &write_header, std::ostream &os) const |
Copy the complete data. More... | |
void | copy_data (FILE *fi, const header &write_header, FILE *fo) const |
Copy the complete data. More... | |
void | copy_data (int fdi, const header &write_header, int fdo) const |
Copy the complete data. More... | |
In-Memory Data Access | |
void | linear_index_to_indices (uintmax_t index, uintmax_t *indices) const |
Transform a linear index to array indices. More... | |
uintmax_t | indices_to_linear_index (const uintmax_t *indices) const |
Transform array indices to a linear index. More... | |
const void * | element (const void *data, const uintmax_t *indices) const |
Get an array element. More... | |
void * | element (void *data, const uintmax_t *indices) const |
Get an array element. More... | |
const void * | element (const void *data, uintmax_t index) const |
Get an array element via a linear index. More... | |
void * | element (void *data, uintmax_t index) const |
Get an array element via a linear index. More... | |
const void * | element (const void *data, uintmax_t index0, uintmax_t index1) const |
Get an array element (variant for two-dimensional arrays). More... | |
void * | element (void *data, uintmax_t index0, uintmax_t index1) const |
Get an array element (variant for two-dimensional arrays). More... | |
const void * | element (const void *data, uintmax_t index0, uintmax_t index1, uintmax_t index2) const |
Get an array element (variant for three-dimensional arrays). More... | |
void * | element (void *data, uintmax_t index0, uintmax_t index1, uintmax_t index2) const |
Get an array element (variant for three-dimensional arrays). More... | |
const void * | element (const void *data, uintmax_t index0, uintmax_t index1, uintmax_t index2, uintmax_t index3) const |
Get an array element (variant for four-dimensional arrays). More... | |
void * | element (void *data, uintmax_t index0, uintmax_t index1, uintmax_t index2, uintmax_t index3) const |
Get an array element (variant for four-dimensional arrays). More... | |
const void * | component (const void *element, uintmax_t i) const |
Get a component of an array element. More... | |
void * | component (void *element, uintmax_t i) const |
Get a component of an array element. More... | |
Read and Write Array Elements | |
These functions are intended to be used for filtering a complete array on a per-element basis. They read or write a given number of elements, and it is expected that they are used repeatedly until all elements of an array have been read or written. Theses function work for all GTAs, and the input and output streams do not need to be seekable. Element-based input/output needs a state object gta::io_state. The same state object must be used until all elements are read or written, or until an error occurs. | |
void | read_elements (io_state &state, custom_io &io, uintmax_t n, void *buf) const |
Read array elements. More... | |
void | read_elements (io_state &state, std::istream &is, uintmax_t n, void *buf) const |
Read array elements. More... | |
void | read_elements (io_state &state, FILE *f, uintmax_t n, void *buf) const |
Read array elements. More... | |
void | read_elements (io_state &state, int fd, uintmax_t n, void *buf) const |
Read array elements. More... | |
void | write_elements (io_state &state, custom_io &io, uintmax_t n, const void *buf) const |
Write array elements. More... | |
void | write_elements (io_state &state, std::ostream &os, uintmax_t n, const void *buf) const |
Write array elements. More... | |
void | write_elements (io_state &state, FILE *f, uintmax_t n, const void *buf) const |
Write array elements. More... | |
void | write_elements (io_state &state, int fd, uintmax_t n, const void *buf) const |
Write array elements. More... | |
Read and Write Array Blocks | |
These functions can only be used if the input/output is seekable. | |
void | read_block (custom_io &io, uintmax_t data_offset, const uintmax_t *lower_coordinates, const uintmax_t *higher_coordinates, void *block) const |
Read an array block. More... | |
void | read_block (std::istream &is, uintmax_t data_offset, const uintmax_t *lower_coordinates, const uintmax_t *higher_coordinates, void *block) const |
Read an array block. More... | |
void | read_block (FILE *f, uintmax_t data_offset, const uintmax_t *lower_coordinates, const uintmax_t *higher_coordinates, void *block) const |
Read an array block. More... | |
void | read_block (int fd, uintmax_t data_offset, const uintmax_t *lower_coordinates, const uintmax_t *higher_coordinates, void *block) const |
Read an array block. More... | |
void | write_block (custom_io &io, uintmax_t data_offset, const uintmax_t *lower_coordinates, const uintmax_t *higher_coordinates, const void *block) const |
Write an array block. More... | |
void | write_block (std::ostream &os, uintmax_t data_offset, const uintmax_t *lower_coordinates, const uintmax_t *higher_coordinates, const void *block) const |
Write an array block. More... | |
void | write_block (FILE *f, uintmax_t data_offset, const uintmax_t *lower_coordinates, const uintmax_t *higher_coordinates, const void *block) const |
Write an array block. More... | |
void | write_block (int fd, uintmax_t data_offset, const uintmax_t *lower_coordinates, const uintmax_t *higher_coordinates, const void *block) const |
Write an array block. More... | |
The GTA header.
Each GTA file is described by its header. It stores information about the array elements and the dimensions, and the various tag lists. Using the header, one can access the data in a GTA file, either by managaing the complete data in memory (if it fits), or by using out-of-core data read/write functions. There are also functions that help the application to implement its own data access scheme, if that is necessary.
|
inline |
Copy constructor.
hdr | The header to copy. |
Assignment operator.
hdr | The header to copy. |
|
inline |
Read a header.
io | Custom input object. |
|
inline |
Read a header.
is | Input stream. |
|
inline |
Read a header.
f | Input C stream. |
|
inline |
Read a header.
fd | Input file descriptor. |
|
inline |
Write a header.
io | Custom output object. |
|
inline |
Write a header.
os | Output stream. |
|
inline |
Write a header.
f | Output C stream. |
|
inline |
Write a header.
fd | Output file descriptor. |
|
inline |
Get the global tag list.
|
inline |
Get the global tag list.
|
inline |
Get the element size.
|
inline |
Get the number of components.
|
inline |
Get the component type.
i | The component index. |
|
inline |
Get the component size.
i | The component index. |
|
inline |
Get the component tag list.
i | The component index. |
|
inline |
Get the component tag list.
i | The component index. |
|
inline |
Get the number of dimensions.
|
inline |
Get the size in a dimension.
i | The dimension index. |
|
inline |
Get the dimension tag list.
i | The dimension index. |
|
inline |
Get the dimension tag list.
i | The dimension index. |
|
inline |
Get the total number of elements in the array.
|
inline |
Get the total size of the array.
|
inline |
Get the compression.
Gets the compression type for the header and data.
Compression is deprecated so the return value should always be gta::none, unless you read legacy files. This function will be removed in a future version.
|
inline |
Set the compression.
compression | The compression type. |
Sets the compression type for writing the header and data. Compression is deprecated and this function actually does nothing. This function will be removed in a future version.
|
inline |
Set the components of an array element.
n | The number of components. |
types | The types of the n components. |
sizes | NULL, or the sizes of the components that have type gta::blob. |
Set the components of the array elements.
The sizes parameter can be NULL if no components have the type gta::blob. Otherwise, it must point to a list that contains the sizes of these components (and only these components). For example, if there are five components, but only two have the type gta::blob, then the sizes list must contain two size values.
All components will initially have an empty tag list.
|
inline |
Set the components of an array element (variant for elements with a single component).
type | The type of the component. |
size | The size of the component, in case the type is gta::blob. |
|
inline |
Set the components of an array element (variant for elements with two components).
|
inline |
Set the components of an array element (variant for elements with three components).
type0 | The type of the first component. |
type1 | The type of the second component. |
type2 | The type of the third component. |
size0 | The size of the first component, in case its type is gta::blob. |
size1 | The size of the second component, in case its type is gta::blob. |
size2 | The size of the third component, in case its type is gta::blob. |
|
inline |
Set the components of an array element (variant for elements with four components).
type0 | The type of the first component. |
type1 | The type of the second component. |
type2 | The type of the third component. |
type3 | The type of the fourth component. |
size0 | The size of the first component, in case its type is gta::blob. |
size1 | The size of the second component, in case its type is gta::blob. |
size2 | The size of the third component, in case its type is gta::blob. |
size3 | The size of the fourth component, in case its type is gta::blob. |
|
inline |
Set the dimensions.
n | The number of dimensions. |
sizes | The array sizes in each of the dimensions. |
Sets the array dimensions.
All dimensions will initially have an empty tag list.
|
inline |
Set the dimensions (variant for one-dimensional arrays).
size | The size in the single dimension. |
|
inline |
Set the dimensions (variant for two-dimensional arrays).
size0 | The size in the first dimension. |
size1 | The size in the second dimension. |
|
inline |
Set the dimensions (variant for three-dimensional arrays).
size0 | The size in the first dimension. |
size1 | The size in the second dimension. |
size2 | The size in the third dimension. |
|
inline |
Set the dimensions (variant for four-dimensional arrays).
size0 | The size in the first dimension. |
size1 | The size in the second dimension. |
size2 | The size in the third dimension. |
size3 | The size in the fourth dimension. |
|
inline |
Read the complete data.
io | Custom input object. |
data | Data buffer. |
Reads the complete data into the given buffer. The buffer must be large enough.
|
inline |
Read the complete data.
is | Input stream. |
data | Data buffer. |
Reads the complete data into the given buffer. The buffer must be large enough.
|
inline |
Read the complete data.
f | Input C stream. |
data | Data buffer. |
Reads the complete data into the given buffer. The buffer must be large enough.
|
inline |
Read the complete data.
fd | Input file descriptor. |
data | Data buffer. |
Reads the complete data into the given buffer. The buffer must be large enough.
|
inline |
Skip the complete data.
io | Custom input object. |
Skips the complete data, so that the next GTA header can be read.
|
inline |
Skip the complete data.
is | Input stream. |
Skips the complete data, so that the next GTA header can be read.
|
inline |
Skip the complete data.
f | Input C stream. |
Skips the complete data, so that the next GTA header can be read.
|
inline |
Skip the complete data.
fd | Input file descriptor. |
Skips the complete data, so that the next GTA header can be read.
|
inline |
Write the complete data.
io | Custom output object. |
data | Data buffer. |
|
inline |
Write the complete data.
os | Output stream. |
data | Data buffer. |
|
inline |
Write the complete data.
f | Output C stream. |
data | Data buffer. |
|
inline |
Write the complete data.
fd | Output file descriptor. |
data | Data buffer. |
|
inline |
Copy the complete data.
read_io | Custom input object. |
write_header | Output header. |
write_io | Custom output object. |
|
inline |
Copy the complete data.
is | Input stream. |
write_header | Output header. |
os | Output stream. |
|
inline |
Copy the complete data.
fi | Input C stream. |
write_header | Output header. |
fo | Output C stream. |
|
inline |
Copy the complete data.
fdi | Input file descriptor. |
write_header | Output header. |
fdo | Output file descriptor. |
|
inline |
Transform a linear index to array indices.
index | The linear index. |
indices | The array indices. |
|
inline |
Transform array indices to a linear index.
indices | The array indices. |
|
inline |
Get an array element.
data | Data Buffer. |
indices | Indices for each dimension of the array. |
|
inline |
Get an array element.
data | Data Buffer. |
indices | Indices for each dimension of the array. |
|
inline |
Get an array element via a linear index.
data | Data Buffer. |
index | Index of the element. |
This function not only works for one-dimensional arrays in the obvious way, but also for multidimensional arrays by using index as a linear index to the array data.
|
inline |
Get an array element via a linear index.
data | Data Buffer. |
index | Index of the element. |
This function not only works for one-dimensional arrays in the obvious way, but also for multidimensional arrays by using index as a linear index to the array data.
|
inline |
Get an array element (variant for two-dimensional arrays).
data | Data Buffer. |
index0 | Index of the element in the first dimension. |
index1 | Index of the element in the second dimension. |
|
inline |
Get an array element (variant for two-dimensional arrays).
data | Data Buffer. |
index0 | Index of the element in the first dimension. |
index1 | Index of the element in the second dimension. |
|
inline |
Get an array element (variant for three-dimensional arrays).
data | Data Buffer. |
index0 | Index of the element in the first dimension. |
index1 | Index of the element in the second dimension. |
index2 | Index of the element in the third dimension. |
|
inline |
Get an array element (variant for three-dimensional arrays).
data | Data Buffer. |
index0 | Index of the element in the first dimension. |
index1 | Index of the element in the second dimension. |
index2 | Index of the element in the third dimension. |
|
inline |
Get an array element (variant for four-dimensional arrays).
data | Data Buffer. |
index0 | Index of the element in the first dimension. |
index1 | Index of the element in the second dimension. |
index2 | Index of the element in the third dimension. |
index3 | Index of the element in the fourth dimension. |
|
inline |
Get an array element (variant for four-dimensional arrays).
data | Data Buffer. |
index0 | Index of the element in the first dimension. |
index1 | Index of the element in the second dimension. |
index2 | Index of the element in the third dimension. |
index3 | Index of the element in the fourth dimension. |
|
inline |
Get a component of an array element.
element | Element. |
i | Component index. |
|
inline |
Get a component of an array element.
element | Element. |
i | Component index. |
|
inline |
Read array elements.
state | The input/output state. |
io | Custom input object. |
n | The number of elements to read. |
buf | The buffer for the elements. |
Reads the given number of elements into the given buffer, which must be large enough.
|
inline |
Read array elements.
state | The input/output state. |
is | Input stream. |
n | The number of elements to read. |
buf | The buffer for the elements. |
Reads the given number of elements into the given buffer, which must be large enough.
|
inline |
Read array elements.
state | The input/output state. |
f | Input stream. |
n | The number of elements to read. |
buf | The buffer for the elements. |
Reads the given number of elements into the given buffer, which must be large enough.
|
inline |
Read array elements.
state | The input/output state. |
fd | Input file descriptor. |
n | The number of elements to read. |
buf | The buffer for the elements. |
Reads the given number of elements into the given buffer, which must be large enough.
|
inline |
Write array elements.
state | The input/output state. |
io | Custom output object. |
n | The number of elements to write. |
buf | The buffer for the elements. |
Writes the given number of elements from the given buffer.
|
inline |
Write array elements.
state | The input/output state. |
os | Output stream. |
n | The number of elements to write. |
buf | The buffer for the elements. |
Writes the given number of elements from the given buffer.
|
inline |
Write array elements.
state | The input/output state. |
f | Output stream. |
n | The number of elements to write. |
buf | The buffer for the elements. |
Writes the given number of elements from the given buffer.
|
inline |
Write array elements.
state | The input/output state. |
fd | Output file descriptor. |
n | The number of elements to write. |
buf | The buffer for the elements. |
Writes the given number of elements from the given buffer.
|
inline |
Read an array block.
io | Custom input object. |
data_offset | Offset of the first data byte. |
lower_coordinates | Coordinates of the lower corner element of the block. |
higher_coordinates | Coordinates of the higher corner element of the block. |
block | Block buffer. |
Reads the given array block and copies it to the given block buffer, which must be large enough.
This function modifies the file position indicator of the input.
|
inline |
Read an array block.
is | Input stream. |
data_offset | Offset of the first data byte. |
lower_coordinates | Coordinates of the lower corner element of the block. |
higher_coordinates | Coordinates of the higher corner element of the block. |
block | Block buffer. |
Reads the given array block and copies it to the given block buffer, which must be large enough.
This function modifies the file position indicator of the input.
|
inline |
Read an array block.
f | Input C stream. |
data_offset | Offset of the first data byte. |
lower_coordinates | Coordinates of the lower corner element of the block. |
higher_coordinates | Coordinates of the higher corner element of the block. |
block | Block buffer. |
Reads the given array block and copies it to the given block buffer, which must be large enough.
This function modifies the file position indicator of the input.
|
inline |
Read an array block.
fd | Input file descriptor. |
data_offset | Offset of the first data byte. |
lower_coordinates | Coordinates of the lower corner element of the block. |
higher_coordinates | Coordinates of the higher corner element of the block. |
block | Block buffer. |
Reads the given array block and copies it to the given block buffer, which must be large enough.
This function modifies the file position indicator of the input.
|
inline |
Write an array block.
io | Custom output object. |
data_offset | Offset of the first data byte. |
lower_coordinates | Coordinates of the lower corner element of the block. |
higher_coordinates | Coordinates of the higher corner element of the block. |
block | Block buffer. |
This function modifies the file position indicator of the output.
|
inline |
Write an array block.
os | Output stream. |
data_offset | Offset of the first data byte. |
lower_coordinates | Coordinates of the lower corner element of the block. |
higher_coordinates | Coordinates of the higher corner element of the block. |
block | Block buffer. |
This function modifies the file position indicator of the output.
|
inline |
Write an array block.
f | Output C stream. |
data_offset | Offset of the first data byte. |
lower_coordinates | Coordinates of the lower corner element of the block. |
higher_coordinates | Coordinates of the higher corner element of the block. |
block | Block buffer. |
This function modifies the file position indicator of the output.
|
inline |
Write an array block.
fd | Output file descriptor. |
data_offset | Offset of the first data byte. |
lower_coordinates | Coordinates of the lower corner element of the block. |
higher_coordinates | Coordinates of the higher corner element of the block. |
block | Block buffer. |
This function modifies the file position indicator of the output.