gta.h   gta.h 
/* /*
* gta.h * gta.h
* *
* This file is part of libgta, a library that implements the Generic Tagge d * This file is part of libgta, a library that implements the Generic Tagge d
* Array (GTA) file format. * Array (GTA) file format.
* *
* Copyright (C) 2010 Martin Lambers <marlam@marlam.de> * Copyright (C) 2010, 2011
* Martin Lambers <marlam@marlam.de>
* *
* Libgta is free software: you can redistribute it and/or modify it under the * Libgta is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free * terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 2.1 of the License, or (at your opti on) * Software Foundation, either version 2.1 of the License, or (at your opti on)
* any later version. * any later version.
* *
* Libgta is distributed in the hope that it will be useful, but WITHOUT AN Y * Libgta is distributed in the hope that it will be useful, but WITHOUT AN Y
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNES S FOR * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNES S FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details. * details.
skipping to change at line 384 skipping to change at line 385
* the requested version number will be stored there. * the requested version number will be stored there.
*/ */
extern GTA_EXPORT const char * extern GTA_EXPORT const char *
gta_version(int *GTA_RESTRICT major, int *GTA_RESTRICT minor, int *GTA_REST RICT patch) gta_version(int *GTA_RESTRICT major, int *GTA_RESTRICT minor, int *GTA_REST RICT patch)
GTA_ATTR_NOTHROW; GTA_ATTR_NOTHROW;
/*@}*/ /*@}*/
/** /**
* *
* \name Initialize/Deinitialize GTA Headers * \name Create and destroy GTA Headers
* *
*/ */
/*@{*/ /*@{*/
/** /**
* \brief Initialize a GTA header structure. * \brief Create a new GTA header structure and initialize it .
* \param header The header. * \param header The header.
* \return \a GTA_OK or \a GTA_SYSTEM_ERROR. * \return \a GTA_OK or \a GTA_SYSTEM_ERROR.
* *
* Initializes a GTA header. This has to be done before doing anything with * Creates a new GTA header and initializes it.
* a GTA header.\n
* The GTA will initially be empty (zero element components, zero dimension s) * The GTA will initially be empty (zero element components, zero dimension s)
* and contain no tags. The compression method will be \a GTA_NONE. * and contain no tags. The compression method will be \a GTA_NONE.
*/ */
extern GTA_EXPORT gta_result_t extern GTA_EXPORT gta_result_t
gta_init_header(gta_header_t *GTA_RESTRICT *GTA_RESTRICT header) gta_create_header(gta_header_t *GTA_RESTRICT *GTA_RESTRICT header)
GTA_ATTR_WARN_UNUSED_RESULT GTA_ATTR_NONNULL_ALL GTA_ATTR_NOTHROW; GTA_ATTR_WARN_UNUSED_RESULT GTA_ATTR_NONNULL_ALL GTA_ATTR_NOTHROW;
/** /**
* \brief Clone a GTA header structure. * \brief Clone a GTA header structure.
* \param dst_header The destination header. * \param dst_header The destination header.
* \param src_header The source header. * \param src_header The source header.
* \return \a GTA_OK or \a GTA_SYSTEM_ERROR. * \return \a GTA_OK or \a GTA_SYSTEM_ERROR.
* *
* Copies \a src_header to \a dst_header. * Clones \a src_header into \a dst_header.
*/ */
extern GTA_EXPORT gta_result_t extern GTA_EXPORT gta_result_t
gta_clone_header(gta_header_t *GTA_RESTRICT dst_header, gta_clone_header(gta_header_t *GTA_RESTRICT dst_header,
const gta_header_t *GTA_RESTRICT src_header) const gta_header_t *GTA_RESTRICT src_header)
GTA_ATTR_WARN_UNUSED_RESULT GTA_ATTR_NONNULL_ALL GTA_ATTR_NOTHROW; GTA_ATTR_WARN_UNUSED_RESULT GTA_ATTR_NONNULL_ALL GTA_ATTR_NOTHROW;
/** /**
* \brief Deinitialize a GTA header structure. * \brief Destroy a GTA header structure and free its resourc es.
* \param header The header. * \param header The header.
* *
* Deinitializes a GTA header and free all of its resources. * Destroys a GTA header structure and fress all of its resources.
*/ */
extern GTA_EXPORT void extern GTA_EXPORT void
gta_deinit_header(gta_header_t *GTA_RESTRICT header) gta_destroy_header(gta_header_t *GTA_RESTRICT header)
GTA_ATTR_NONNULL_ALL GTA_ATTR_NOTHROW; GTA_ATTR_NONNULL_ALL GTA_ATTR_NOTHROW;
/*@}*/ /*@}*/
/** /**
* *
* \name Read and Write GTA Headers * \name Read and Write GTA Headers
* *
*/ */
skipping to change at line 1114 skipping to change at line 1114
/** /**
* *
* \name Read and Write Array Elements * \name Read and Write Array Elements
* *
* These functions are intended to be used for filtering a complete array o n a per-element basis. * These functions are intended to be used for filtering a complete array o n a per-element basis.
* They read or write a given number of elements, and it is expected that t hey are used * They read or write a given number of elements, and it is expected that t hey are used
* repeatedly until all elements of an array have been read or written. * repeatedly until all elements of an array have been read or written.
* Theses function work for all GTAs, with or without compression, an the i nput and output streams * Theses function work for all GTAs, with or without compression, an the i nput and output streams
* do not need to be seekable. * do not need to be seekable.
* *
* Element-based input/output needs a state structure. This structure must * Element-based input/output needs a state structure. This structure must
be initialized with be allocated with
* gta_init_io_state() before the first element is read or written, and dei * gta_create_io_state() before the first element is read or written, and f
nitialized with reed with
* gta_deinit_io_state() after the last element was read or written, or aft * gta_destroy_io_state() after the last element was read or written, or af
er an error occured. ter an error occured.
*/ */
/*@{*/ /*@{*/
/** /**
* \brief Initialize input/output state. * \brief Create and initialize a new input/output state.
* \param io_state The input/output state. * \param io_state The input/output state.
* \return \a GTA_OK or \a GTA_SYSTEM_ERROR. * \return \a GTA_OK or \a GTA_SYSTEM_ERROR.
* *
* Initializes a state structure for element-based input/output. * Creates and initializes a state structure for element-based input/output .
*/ */
extern GTA_EXPORT gta_result_t extern GTA_EXPORT gta_result_t
gta_init_io_state(gta_io_state_t *GTA_RESTRICT *GTA_RESTRICT io_state) gta_create_io_state(gta_io_state_t *GTA_RESTRICT *GTA_RESTRICT io_state)
GTA_ATTR_WARN_UNUSED_RESULT GTA_ATTR_NONNULL_ALL GTA_ATTR_NOTHROW; GTA_ATTR_WARN_UNUSED_RESULT GTA_ATTR_NONNULL_ALL GTA_ATTR_NOTHROW;
/** /**
* \brief Deinitialize input/output state.
* \param io_state The input/output state.
*
* Deinitializes a state structure for element-based input/output.
*/
extern GTA_EXPORT void
gta_deinit_io_state(gta_io_state_t *GTA_RESTRICT io_state)
GTA_ATTR_NONNULL_ALL GTA_ATTR_NOTHROW;
/**
* \brief Clone an input/output state. * \brief Clone an input/output state.
* \param dst_io_state The destination state. * \param dst_io_state The destination state.
* \param src_io_state The source state. * \param src_io_state The source state.
* \return \a GTA_OK or \a GTA_SYSTEM_ERROR. * \return \a GTA_OK or \a GTA_SYSTEM_ERROR.
* *
* Copies \a src_io_state to \a dst_io_state. * Clones \a src_io_state into \a dst_io_state.
*/ */
extern GTA_EXPORT gta_result_t extern GTA_EXPORT gta_result_t
gta_clone_io_state(gta_io_state_t *GTA_RESTRICT dst_io_state, gta_clone_io_state(gta_io_state_t *GTA_RESTRICT dst_io_state,
const gta_io_state_t *GTA_RESTRICT src_io_state) const gta_io_state_t *GTA_RESTRICT src_io_state)
GTA_ATTR_NONNULL_ALL GTA_ATTR_NOTHROW; GTA_ATTR_NONNULL_ALL GTA_ATTR_NOTHROW;
/** /**
* \brief Destroy input/output state and free its resources.
* \param io_state The input/output state.
*
* Destroys a state structure for element-based input/output and frees its
resources.
*/
extern GTA_EXPORT void
gta_destroy_io_state(gta_io_state_t *GTA_RESTRICT io_state)
GTA_ATTR_NONNULL_ALL GTA_ATTR_NOTHROW;
/**
* \brief Read array elements. * \brief Read array elements.
* \param header The header. * \param header The header.
* \param io_state The input/output state. * \param io_state The input/output state.
* \param n The number of elements to read. * \param n The number of elements to read.
* \param buf The buffer for the elements. * \param buf The buffer for the elements.
* \param read_fn The custom input function. * \param read_fn The custom input function.
* \param userdata A parameter to the custom input function. * \param userdata A parameter to the custom input function.
* \return \a GTA_OK, \a GTA_OVERFLOW, \a GTA_UNEXPECTED_EOF, or \a GTA_SYSTEM_ERROR. * \return \a GTA_OK, \a GTA_OVERFLOW, \a GTA_UNEXPECTED_EOF, or \a GTA_SYSTEM_ERROR.
* *
* Reads the given number of elements into the given buffer, which must be large enough. * Reads the given number of elements into the given buffer, which must be large enough.
 End of changes. 16 change blocks. 
30 lines changed or deleted 31 lines changed or added


 gta.hpp   gta.hpp 
/* /*
* gta.hpp * gta.hpp
* *
* This file is part of libgta, a library that implements the Generic Tagge d * This file is part of libgta, a library that implements the Generic Tagge d
* Array (GTA) file format. * Array (GTA) file format.
* *
* Copyright (C) 2010 Martin Lambers <marlam@marlam.de> * Copyright (C) 2010, 2011
* Martin Lambers <marlam@marlam.de>
* *
* Libgta is free software: you can redistribute it and/or modify it under the * Libgta is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free * terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 2.1 of the License, or (at your opti on) * Software Foundation, either version 2.1 of the License, or (at your opti on)
* any later version. * any later version.
* *
* Libgta is distributed in the hope that it will be useful, but WITHOUT AN Y * Libgta is distributed in the hope that it will be useful, but WITHOUT AN Y
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNES S FOR * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNES S FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details. * details.
skipping to change at line 36 skipping to change at line 37
* *
* This document describes the C++ language interface of libgta. * This document describes the C++ language interface of libgta.
*/ */
#ifndef GTA_HPP #ifndef GTA_HPP
#define GTA_HPP #define GTA_HPP
#include <exception> #include <exception>
#include <istream> #include <istream>
#include <ostream> #include <ostream>
#include <vector>
#include <limits> #include <limits>
#include <cerrno> #include <cerrno>
#include <cstring> #include <cstring>
#include <cstdio> #include <cstdio>
#include <gta/gta.h> #include <gta/gta.h>
/** /**
* \brief The gta namespace. * \brief The gta namespace.
*/ */
skipping to change at line 164 skipping to change at line 166
zlib7 = GTA_ZLIB7, /**< \brief ZLIB compression with level 7 */ zlib7 = GTA_ZLIB7, /**< \brief ZLIB compression with level 7 */
zlib8 = GTA_ZLIB8, /**< \brief ZLIB compression with level 8 */ zlib8 = GTA_ZLIB8, /**< \brief ZLIB compression with level 8 */
zlib9 = GTA_ZLIB9, /**< \brief ZLIB compression with level 9 */ zlib9 = GTA_ZLIB9, /**< \brief ZLIB compression with level 9 */
bzip2 = GTA_BZIP2, /**< \brief BZIP2 compression (moderate speed, g ood compression rates) */ bzip2 = GTA_BZIP2, /**< \brief BZIP2 compression (moderate speed, g ood compression rates) */
xz = GTA_XZ /**< \brief XZ compression (low/moderate speed, good/very good compression rates) */ xz = GTA_XZ /**< \brief XZ compression (low/moderate speed, good/very good compression rates) */
}; };
/** /**
* \brief The exception class. * \brief The exception class.
* *
* The GTA C++ library reports errors by throwing exceptions. You can u se * The GTA C++ interface reports errors by throwing exceptions. You can use
* them just like std::exceptions, but you can also query the original * them just like std::exceptions, but you can also query the original
* \a gta::result that caused the exception. * \a gta::result that caused the exception.
*/ */
class exception : public std::exception class exception : public std::exception
{ {
private: private:
static const int _whatsize = 96; static const int _whatsize = 96;
gta::result _r; gta::result _r;
int _sys_errno; int _sys_errno;
char _what[_whatsize]; char _what[_whatsize];
public: public:
/** /**
* \brief Constructor. * \brief Constructor.
* \param s The action that failed. * \param s The action that failed.
* \param r The GTA result. * \param r The GTA result.
*/ */
exception(const char *s, gta::result r) throw () exception(const char *s, gta::result r)
: _r(r), _sys_errno(r == system_error ? errno : 0) : _r(r), _sys_errno(r == system_error ? errno : 0)
{ {
const char *w = ""; const char *w = "";
switch (r) switch (r)
{ {
case ok: case ok:
w = "success"; w = "success";
break; break;
case overflow: case overflow:
w = "value too large for data type"; w = "value too large for data type";
skipping to change at line 237 skipping to change at line 239
*/ */
int sys_errno() const int sys_errno() const
{ {
return _sys_errno; return _sys_errno;
} }
/** /**
* \brief Get a description. * \brief Get a description.
* \return A description of the exception. * \return A description of the exception.
*/ */
virtual const char* what() const throw() virtual const char* what() const throw ()
{ {
return _what; return _what;
} }
}; };
/** /**
* \brief Tag Lists. * \brief Tag Lists.
* *
* GTA stores meta information in tags. * GTA stores meta information in tags.
* Tag names are non-empty UTF-8 strings that must not contain '='.\n * Tag names are non-empty UTF-8 strings that must not contain '='.\n
* Tag values are UTF-8 strings.\n * Tag values are UTF-8 strings.\n
* If you do not want to deal with conversions between the local charac ter set and UTF-8, * If you do not want to deal with conversions between the local charac ter set and UTF-8,
* you must restrict names and values to ASCII. * you must restrict names and values to ASCII.
*/ */
class taglist class taglist
{ {
private: private:
gta_taglist_t *_taglist; gta_taglist_t *_taglist;
public:
/** \cond INTERNAL */ /** \cond INTERNAL */
taglist(const gta_taglist_t *taglist) throw () void set(gta_taglist_t *taglist)
: _taglist(const_cast<gta_taglist_t *>(taglist))
{
}
taglist(gta_taglist_t *taglist) throw ()
: _taglist(taglist)
{ {
_taglist = taglist;
} }
taglist(const taglist &taglist) throw (exception)
taglist()
{ {
gta_result_t r = gta_clone_taglist(_taglist, taglist._taglist);
if (r != GTA_OK)
{
throw exception("cannot clone GTA tag list", static_cast<gt
a::result>(r));
}
} }
/** \endcond */ /** \endcond */
public:
/** /**
* \brief Get the number of tags. * \brief Get the number of tags.
* \return The number of tags. * \return The number of tags.
*/ */
uintmax_t tags() const throw () uintmax_t tags() const
{ {
return gta_get_tags(_taglist); return gta_get_tags(_taglist);
} }
/** /**
* \brief Get a tag name. * \brief Get a tag name.
* \param i The tag index. * \param i The tag index.
* \return The name of the tag. * \return The name of the tag.
*/ */
const char *name(uintmax_t i) const throw () const char *name(uintmax_t i) const
{ {
return gta_get_tag_name(_taglist, i); return gta_get_tag_name(_taglist, i);
} }
/** /**
* \brief Get a tag value. * \brief Get a tag value.
* \param i The tag index. * \param i The tag index.
* \return The value of the tag. * \return The value of the tag.
*/ */
const char *value(uintmax_t i) const throw () const char *value(uintmax_t i) const
{ {
return gta_get_tag_value(_taglist, i); return gta_get_tag_value(_taglist, i);
} }
/** /**
* \brief Get a tag value by its name. * \brief Get a tag value by its name.
* \param name The tag name. * \param name The tag name.
* \return The tag value, or NULL if the tag name is not found . * \return The tag value, or NULL if the tag name is not found .
*/ */
const char *get(const char *name) const throw () const char *get(const char *name) const
{ {
return gta_get_tag(_taglist, name); return gta_get_tag(_taglist, name);
} }
/** /**
* \brief Set a tag. * \brief Set a tag.
* \param name The tag name. * \param name The tag name.
* \param value The tag value. * \param value The tag value.
* *
* Sets the given tag, possibly overwriting an existing tag with th e same name. * Sets the given tag, possibly overwriting an existing tag with th e same name.
* The name and value must be valid UTF-8 strings without control c haracters. * The name and value must be valid UTF-8 strings without control c haracters.
* Additionally, the name must not contain the equal sign and must not be empty. * Additionally, the name must not contain the equal sign and must not be empty.
*/ */
void set(const char *name, const char *value) throw (exception) void set(const char *name, const char *value)
{ {
gta_result_t r = gta_set_tag(_taglist, name, value); gta_result_t r = gta_set_tag(_taglist, name, value);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot set GTA tag", static_cast<gta::resu lt>(r)); throw exception("Cannot set GTA tag", static_cast<gta::resu lt>(r));
} }
} }
/** /**
* \brief Unset a tag. * \brief Unset a tag.
* \param name The tag name. * \param name The tag name.
* *
* Removes the tag with the given name, if it exists. * Removes the tag with the given name, if it exists.
*/ */
void unset(const char *name) throw (exception) void unset(const char *name)
{ {
gta_result_t r = gta_unset_tag(_taglist, name); gta_result_t r = gta_unset_tag(_taglist, name);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot unset GTA tag", static_cast<gta::re sult>(r)); throw exception("Cannot unset GTA tag", static_cast<gta::re sult>(r));
} }
} }
/** /**
* \brief Unset all tags. * \brief Unset all tags.
* *
* Removes all tags. * Removes all tags.
*/ */
void unset_all() throw () void unset_all()
{ {
gta_unset_all_tags(_taglist); gta_unset_all_tags(_taglist);
} }
/** /**
* \brief Assignment operator. * \brief Assignment operator.
* \param tl The tag list to copy. * \param tl The tag list to copy.
*/ */
const taglist &operator=(const taglist &tl) throw (exception) const taglist &operator=(const taglist &tl)
{ {
gta_result_t r = gta_clone_taglist(_taglist, tl._taglist); gta_result_t r = gta_clone_taglist(_taglist, tl._taglist);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot clone GTA taglist", static_cast<gta ::result>(r)); throw exception("Cannot clone GTA taglist", static_cast<gta ::result>(r));
} }
return *this; return *this;
} }
friend class header;
}; };
/** /**
* \brief Class for custom input/output. * \brief Class for custom input/output.
* *
* You can define your own custom input/output media by implementing th is interface. * You can define your own custom input/output media by implementing th is interface.
* The seek function is only required if you want to use the out-of-cor e data access * The seek function is only required if you want to use the out-of-cor e data access
* funtions \a header::read_block() or \a header::write_block(). * funtions \a header::read_block() or \a header::write_block().
*/ */
class custom_io class custom_io
skipping to change at line 400 skipping to change at line 395
* \param buffer The destionation buffer. * \param buffer The destionation buffer.
* \param size The number of bytes to read. * \param size The number of bytes to read.
* \param error The error flag. * \param error The error flag.
* *
* This function must read the given number of bytes into the given buffer.\n * This function must read the given number of bytes into the given buffer.\n
* Its return value must be the number of bytes successfully read.\ n * Its return value must be the number of bytes successfully read.\ n
* If an error occured, the error flag must be set to true. * If an error occured, the error flag must be set to true.
* The function must set errno to indicate the type of error. If th e * The function must set errno to indicate the type of error. If th e
* error type is unknown, errno should be set to EIO. * error type is unknown, errno should be set to EIO.
*/ */
virtual size_t read(void *buffer GTA_ATTR_UNUSED, size_t size GTA_A TTR_UNUSED, bool *error) throw () virtual size_t read(void *buffer GTA_ATTR_UNUSED, size_t size GTA_A TTR_UNUSED, bool *error)
{ {
errno = ENOSYS; errno = ENOSYS;
*error = true; *error = true;
return 0; return 0;
} }
/** /**
* \brief Custom write function. * \brief Custom write function.
* \param buffer The source buffer. * \param buffer The source buffer.
* \param size The number of bytes to write. * \param size The number of bytes to write.
* \param error The error flag. * \param error The error flag.
* *
* This function must write the given number of bytes from the give n buffer.\n * This function must write the given number of bytes from the give n buffer.\n
* Its return value must be the number of bytes successfully writte n.\n * Its return value must be the number of bytes successfully writte n.\n
* If an error occured, the error flag must be set to true. * If an error occured, the error flag must be set to true.
* The function must set errno to indicate the type of error. If th e * The function must set errno to indicate the type of error. If th e
* error type is unknown, errno should be set to EIO. * error type is unknown, errno should be set to EIO.
*/ */
virtual size_t write(const void *buffer GTA_ATTR_UNUSED, size_t siz e GTA_ATTR_UNUSED, bool *error) throw () virtual size_t write(const void *buffer GTA_ATTR_UNUSED, size_t siz e GTA_ATTR_UNUSED, bool *error)
{ {
errno = ENOSYS; errno = ENOSYS;
*error = true; *error = true;
return 0; return 0;
} }
/** /**
* \brief Tell if this object is seekable. * \brief Tell if this object is seekable.
* \return Whether this object is seekable. * \return Whether this object is seekable.
* *
* This function must return true if the object is seekable, i.e. i f the * This function must return true if the object is seekable, i.e. i f the
* \a seek function can be used. Otherwise, it must return false. * \a seek function can be used. Otherwise, it must return false.
*/ */
virtual bool seekable() throw () virtual bool seekable()
{ {
return false; return false;
} }
/** /**
* \brief Custom seek function. * \brief Custom seek function.
* \param offset The position offset. * \param offset The position offset.
* \param whence SEEK_SET or SEEK_CUR. * \param whence SEEK_SET or SEEK_CUR.
* \param error The error flag. * \param error The error flag.
* *
* This function must change the position indicator as indicated by the parameters \a * This function must change the position indicator as indicated by the parameters \a
* offset and \a whence, just like fseeko() and lseek() do. The par ameter \a whence * offset and \a whence, just like fseeko() and lseek() do. The par ameter \a whence
* can be SEEK_SET or SEEK_CUR (SEEK_END is never used).\n * can be SEEK_SET or SEEK_CUR (SEEK_END is never used).\n
* If an error occured, the error flag must be set to true. * If an error occured, the error flag must be set to true.
* The function must set errno to indicate the type of error. If th e * The function must set errno to indicate the type of error. If th e
* error type is unknown, errno should be set to EIO. * error type is unknown, errno should be set to EIO.
*/ */
virtual void seek(intmax_t offset GTA_ATTR_UNUSED, int whence GTA_A TTR_UNUSED, bool *error) throw () virtual void seek(intmax_t offset GTA_ATTR_UNUSED, int whence GTA_A TTR_UNUSED, bool *error)
{ {
errno = ENOSYS; errno = ENOSYS;
*error = true; *error = true;
} }
}; };
/** \cond INTERNAL */ /** \cond INTERNAL */
class istream_io : public custom_io class istream_io : public custom_io
{ {
private: private:
std::istream &_is; std::istream &_is;
public: public:
istream_io(std::istream &is) throw () istream_io(std::istream &is)
: _is(is) : _is(is)
{ {
} }
virtual size_t read(void *buffer, size_t size, bool *error) throw ( ) virtual size_t read(void *buffer, size_t size, bool *error)
{ {
try try
{ {
_is.read(static_cast<char *>(buffer), size); _is.read(static_cast<char *>(buffer), size);
} }
catch (...) catch (...)
{ {
_is.setstate(std::ios::failbit); _is.setstate(std::ios::failbit);
} }
if (!_is.good()) if (!_is.good())
{ {
errno = EIO; errno = EIO;
*error = true; *error = true;
} }
return size; return size;
} }
virtual bool seekable() throw () virtual bool seekable()
{ {
return (_is.tellg() != static_cast<std::streampos>(-1)); return (_is.tellg() != static_cast<std::streampos>(-1));
} }
virtual void seek(intmax_t offset, int whence, bool *error) throw ( ) virtual void seek(intmax_t offset, int whence, bool *error)
{ {
if (offset > std::numeric_limits<std::streamoff>::max()) if (offset > std::numeric_limits<std::streamoff>::max())
{ {
#ifdef EOVERFLOW #ifdef EOVERFLOW
errno = EOVERFLOW; errno = EOVERFLOW;
#else #else
errno = EFBIG; errno = EFBIG;
#endif #endif
*error = true; *error = true;
return; return;
skipping to change at line 533 skipping to change at line 528
/** \cond INTERNAL */ /** \cond INTERNAL */
class ostream_io : public custom_io class ostream_io : public custom_io
{ {
private: private:
std::ostream &_os; std::ostream &_os;
public: public:
ostream_io(std::ostream &os) throw () ostream_io(std::ostream &os)
: _os(os) : _os(os)
{ {
} }
virtual size_t write(const void *buffer, size_t size, bool *error) throw () virtual size_t write(const void *buffer, size_t size, bool *error)
{ {
try try
{ {
_os.write(static_cast<const char *>(buffer), size); _os.write(static_cast<const char *>(buffer), size);
} }
catch (...) catch (...)
{ {
_os.setstate(std::ios::failbit); _os.setstate(std::ios::failbit);
} }
if (!_os.good()) if (!_os.good())
{ {
errno = EIO; errno = EIO;
*error = true; *error = true;
} }
return size; return size;
} }
virtual bool seekable() throw () virtual bool seekable()
{ {
return (_os.tellp() != static_cast<std::streampos>(-1)); return (_os.tellp() != static_cast<std::streampos>(-1));
} }
virtual void seek(intmax_t offset, int whence, bool *error) throw ( ) virtual void seek(intmax_t offset, int whence, bool *error)
{ {
if (offset > std::numeric_limits<std::streamoff>::max()) if (offset > std::numeric_limits<std::streamoff>::max())
{ {
#ifdef EOVERFLOW #ifdef EOVERFLOW
errno = EOVERFLOW; errno = EOVERFLOW;
#else #else
errno = EFBIG; errno = EFBIG;
#endif #endif
*error = true; *error = true;
return; return;
skipping to change at line 644 skipping to change at line 639
* See gta::header::read_elements() and gta::header::write_elements(). * See gta::header::read_elements() and gta::header::write_elements().
*/ */
class io_state class io_state
{ {
private: private:
gta_io_state_t *_state; gta_io_state_t *_state;
public: public:
io_state() throw (exception) io_state()
{ {
gta_result_t r = gta_init_io_state(&_state); gta_result_t r = gta_create_io_state(&_state);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot initialize GTA i/o state", static_c ast<gta::result>(r)); throw exception("Cannot initialize GTA i/o state", static_c ast<gta::result>(r));
} }
} }
/** \cond INTERNAL */ /** \cond INTERNAL */
io_state(const io_state &s) io_state(const io_state &s)
{ {
gta_result_t r = gta_init_io_state(&_state); gta_result_t r = gta_create_io_state(&_state);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot initialize GTA i/o state", static_c ast<gta::result>(r)); throw exception("Cannot initialize GTA i/o state", static_c ast<gta::result>(r));
} }
r = gta_clone_io_state(_state, s._state); r = gta_clone_io_state(_state, s._state);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot clone GTA i/o state", static_cast<g ta::result>(r)); throw exception("Cannot clone GTA i/o state", static_cast<g ta::result>(r));
} }
} }
/** \endcond */ /** \endcond */
~io_state() ~io_state()
{ {
if (_state) if (_state)
{ {
gta_deinit_io_state(_state); gta_destroy_io_state(_state);
} }
} }
/** \cond INTERNAL */ /** \cond INTERNAL */
io_state &operator=(const io_state &s) throw (exception) io_state &operator=(const io_state &s)
{ {
gta_result_t r = gta_clone_io_state(_state, s._state); gta_result_t r = gta_clone_io_state(_state, s._state);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot clone GTA i/o state", static_cast<g ta::result>(r)); throw exception("Cannot clone GTA i/o state", static_cast<g ta::result>(r));
} }
return *this; return *this;
} }
/** \endcond */ /** \endcond */
friend class header; friend class header;
}; };
/** /**
* \brief The GTA header. * \brief The GTA header.
skipping to change at line 707 skipping to change at line 702
* Using the header, one can access the data in a GTA file, either by * 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 * 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 * 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. * the application to implement its own data access scheme, if that is necessary.
*/ */
class header class header
{ {
private: private:
gta_header_t *_header; gta_header_t *_header;
taglist _global_taglist;
std::vector<taglist> _dimension_taglists;
std::vector<taglist> _component_taglists;
void reset_global_taglist()
{
_global_taglist.set(gta_get_global_taglist(_header));
}
void reset_component_taglists()
{
_component_taglists.resize(gta_get_components(_header), taglist
());
for (uintmax_t i = 0; i < _component_taglists.size(); i++)
{
_component_taglists[i].set(gta_get_component_taglist(_heade
r, i));
}
}
void reset_dimension_taglists()
{
_dimension_taglists.resize(gta_get_dimensions(_header), taglist
());
for (size_t i = 0; i < _dimension_taglists.size(); i++)
{
_dimension_taglists[i].set(gta_get_dimension_taglist(_heade
r, i));
}
}
void reset_taglists()
{
reset_global_taglist();
reset_component_taglists();
reset_dimension_taglists();
}
public: public:
/** /**
* \name Constructor / Destructor & Co. * \name Constructor / Destructor & Co.
*/ */
/*@{*/ /*@{*/
/** /**
* \brief Constructor. * \brief Constructor.
*/ */
header() throw (exception) header()
{ {
gta_result_t r = gta_init_header(&_header); gta_result_t r = gta_create_header(&_header);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot initialize GTA header", static_cast <gta::result>(r)); throw exception("Cannot initialize GTA header", static_cast <gta::result>(r));
} }
reset_taglists();
} }
/** /**
* \brief Copy constructor. * \brief Copy constructor.
* \param hdr The header to copy. * \param hdr The header to copy.
*/ */
header(const header &hdr) throw (exception) header(const header &hdr)
: _header(NULL) : _header(NULL)
{ {
gta_result_t r; gta_result_t r;
r = gta_init_header(&_header); r = gta_create_header(&_header);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot initialize GTA header", static_cast <gta::result>(r)); throw exception("Cannot initialize GTA header", static_cast <gta::result>(r));
} }
r = gta_clone_header(_header, hdr._header); r = gta_clone_header(_header, hdr._header);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot clone GTA header", static_cast<gta: :result>(r)); throw exception("Cannot clone GTA header", static_cast<gta: :result>(r));
} }
reset_taglists();
} }
/** /**
* \brief Destructor. * \brief Destructor.
*/ */
~header() ~header()
{ {
if (_header) if (_header)
{ {
gta_deinit_header(_header); gta_destroy_header(_header);
} }
} }
/** /**
* \brief Assignment operator. * \brief Assignment operator.
* \param hdr The header to copy. * \param hdr The header to copy.
*/ */
const header &operator=(const header &hdr) throw (exception) const header &operator=(const header &hdr)
{ {
gta_result_t r = gta_clone_header(_header, hdr._header); gta_result_t r = gta_clone_header(_header, hdr._header);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot clone GTA header", static_cast<gta: :result>(r)); throw exception("Cannot clone GTA header", static_cast<gta: :result>(r));
} }
reset_taglists();
return *this; return *this;
} }
/*@}*/ /*@}*/
/** /**
* \name Read and Write a Header * \name Read and Write a Header
*/ */
/*@{*/ /*@{*/
/** /**
* \brief Read a header. * \brief Read a header.
* \param io Custom input object. * \param io Custom input object.
*/ */
void read_from(custom_io &io) throw (exception) void read_from(custom_io &io)
{ {
gta_result_t r = gta_read_header(_header, read_custom_io, reint erpret_cast<intptr_t>(&io)); gta_result_t r = gta_read_header(_header, read_custom_io, reint erpret_cast<intptr_t>(&io));
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot read GTA header", static_cast<gta:: result>(r)); throw exception("Cannot read GTA header", static_cast<gta:: result>(r));
} }
reset_taglists();
} }
/** /**
* \brief Read a header. * \brief Read a header.
* \param is Input stream. * \param is Input stream.
*/ */
void read_from(std::istream &is) throw (exception) void read_from(std::istream &is)
{ {
istream_io io(is); istream_io io(is);
gta_result_t r = gta_read_header(_header, read_custom_io, reint erpret_cast<intptr_t>(&io)); gta_result_t r = gta_read_header(_header, read_custom_io, reint erpret_cast<intptr_t>(&io));
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot read GTA header", static_cast<gta:: result>(r)); throw exception("Cannot read GTA header", static_cast<gta:: result>(r));
} }
reset_taglists();
} }
/** /**
* \brief Read a header. * \brief Read a header.
* \param f Input C stream. * \param f Input C stream.
*/ */
void read_from(FILE *f) throw (exception) void read_from(FILE *f)
{ {
gta_result_t r = gta_read_header_from_stream(_header, f); gta_result_t r = gta_read_header_from_stream(_header, f);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot read GTA header", static_cast<gta:: result>(r)); throw exception("Cannot read GTA header", static_cast<gta:: result>(r));
} }
reset_taglists();
} }
/** /**
* \brief Read a header. * \brief Read a header.
* \param fd Input file descriptor. * \param fd Input file descriptor.
*/ */
void read_from(int fd) throw (exception) void read_from(int fd)
{ {
gta_result_t r = gta_read_header_from_fd(_header, fd); gta_result_t r = gta_read_header_from_fd(_header, fd);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot read GTA header", static_cast<gta:: result>(r)); throw exception("Cannot read GTA header", static_cast<gta:: result>(r));
} }
reset_taglists();
} }
/** /**
* \brief Write a header. * \brief Write a header.
* \param io Custom output object. * \param io Custom output object.
*/ */
void write_to(custom_io &io) const throw (exception) void write_to(custom_io &io) const
{ {
gta_result_t r = gta_write_header(_header, write_custom_io, rei nterpret_cast<intptr_t>(&io)); gta_result_t r = gta_write_header(_header, write_custom_io, rei nterpret_cast<intptr_t>(&io));
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot write GTA header", static_cast<gta: :result>(r)); throw exception("Cannot write GTA header", static_cast<gta: :result>(r));
} }
} }
/** /**
* \brief Write a header. * \brief Write a header.
* \param os Output stream. * \param os Output stream.
*/ */
void write_to(std::ostream &os) const throw (exception) void write_to(std::ostream &os) const
{ {
ostream_io io(os); ostream_io io(os);
gta_result_t r = gta_write_header(_header, write_custom_io, rei nterpret_cast<intptr_t>(&io)); gta_result_t r = gta_write_header(_header, write_custom_io, rei nterpret_cast<intptr_t>(&io));
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot write GTA header", static_cast<gta: :result>(r)); throw exception("Cannot write GTA header", static_cast<gta: :result>(r));
} }
} }
/** /**
* \brief Write a header. * \brief Write a header.
* \param f Output C stream. * \param f Output C stream.
*/ */
void write_to(FILE *f) const throw (exception) void write_to(FILE *f) const
{ {
gta_result_t r = gta_write_header_to_stream(_header, f); gta_result_t r = gta_write_header_to_stream(_header, f);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot write GTA header", static_cast<gta: :result>(r)); throw exception("Cannot write GTA header", static_cast<gta: :result>(r));
} }
} }
/** /**
* \brief Write a header. * \brief Write a header.
* \param fd Output file descriptor. * \param fd Output file descriptor.
*/ */
void write_to(int fd) const throw (exception) void write_to(int fd) const
{ {
gta_result_t r = gta_write_header_to_fd(_header, fd); gta_result_t r = gta_write_header_to_fd(_header, fd);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot write GTA header", static_cast<gta: :result>(r)); throw exception("Cannot write GTA header", static_cast<gta: :result>(r));
} }
} }
/*@}*/ /*@}*/
/** /**
* \name Access Header Information * \name Access Header Information
*/ */
/*@{*/ /*@{*/
/** /**
* \brief Get the global tag list. * \brief Get the global tag list.
* \return The global tag list. * \return The global tag list.
*/ */
const taglist global_taglist() const throw () const taglist &global_taglist() const
{ {
return taglist(gta_get_global_taglist_const(_header)); return _global_taglist;
} }
/** /**
* \brief Get the global tag list. * \brief Get the global tag list.
* \return The global tag list. * \return The global tag list.
*/ */
taglist global_taglist() throw () taglist &global_taglist()
{ {
return taglist(gta_get_global_taglist(_header)); return _global_taglist;
} }
/** /**
* \brief Get the element size. * \brief Get the element size.
* \return The size of an array element. * \return The size of an array element.
*/ */
uintmax_t element_size() const throw () uintmax_t element_size() const
{ {
return gta_get_element_size(_header); return gta_get_element_size(_header);
} }
/** /**
* \brief Get the number of components. * \brief Get the number of components.
* \return The number of components. * \return The number of components.
*/ */
uintmax_t components() const throw () uintmax_t components() const
{ {
return gta_get_components(_header); return gta_get_components(_header);
} }
/** /**
* \brief Get the component type. * \brief Get the component type.
* \param i The component index. * \param i The component index.
* \return The type of the component. * \return The type of the component.
*/ */
type component_type(uintmax_t i) const throw () type component_type(uintmax_t i) const
{ {
return static_cast<type>(gta_get_component_type(_header, i)); return static_cast<type>(gta_get_component_type(_header, i));
} }
/** /**
* \brief Get the component size. * \brief Get the component size.
* \param i The component index. * \param i The component index.
* \return The size of the component. * \return The size of the component.
*/ */
uintmax_t component_size(uintmax_t i) const throw () uintmax_t component_size(uintmax_t i) const
{ {
return gta_get_component_size(_header, i); return gta_get_component_size(_header, i);
} }
/** /**
* \brief Get the component tag list. * \brief Get the component tag list.
* \param i The component index. * \param i The component index.
* \return The tag list of the component. * \return The tag list of the component.
*/ */
const taglist component_taglist(uintmax_t i) const throw () const taglist &component_taglist(uintmax_t i) const
{ {
return taglist(gta_get_component_taglist(_header, i)); return _component_taglists[i];
} }
/** /**
* \brief Get the component tag list. * \brief Get the component tag list.
* \param i The component index. * \param i The component index.
* \return The tag list of the component. * \return The tag list of the component.
*/ */
taglist component_taglist(uintmax_t i) throw () taglist &component_taglist(uintmax_t i)
{ {
return taglist(gta_get_component_taglist(_header, i)); return _component_taglists[i];
} }
/** /**
* \brief Get the number of dimensions. * \brief Get the number of dimensions.
* \return The number of dimensions. * \return The number of dimensions.
*/ */
uintmax_t dimensions() const throw () uintmax_t dimensions() const
{ {
return gta_get_dimensions(_header); return gta_get_dimensions(_header);
} }
/** /**
* \brief Get the size in a dimension. * \brief Get the size in a dimension.
* \param i The dimension index. * \param i The dimension index.
* \return The size in the dimension. * \return The size in the dimension.
*/ */
uintmax_t dimension_size(uintmax_t i) const throw () uintmax_t dimension_size(uintmax_t i) const
{ {
return gta_get_dimension_size(_header, i); return gta_get_dimension_size(_header, i);
} }
/** /**
* \brief Get the dimension tag list. * \brief Get the dimension tag list.
* \param i The dimension index. * \param i The dimension index.
* \return The tag list of the dimension. * \return The tag list of the dimension.
*/ */
const taglist dimension_taglist(uintmax_t i) const throw () const taglist &dimension_taglist(uintmax_t i) const
{ {
return taglist(gta_get_dimension_taglist(_header, i)); return _dimension_taglists[i];
} }
/** /**
* \brief Get the dimension tag list. * \brief Get the dimension tag list.
* \param i The dimension index. * \param i The dimension index.
* \return The tag list of the dimension. * \return The tag list of the dimension.
*/ */
taglist dimension_taglist(uintmax_t i) throw () taglist &dimension_taglist(uintmax_t i)
{ {
return taglist(gta_get_dimension_taglist(_header, i)); return _dimension_taglists[i];
} }
/** /**
* \brief Get the total number of elements in the array. * \brief Get the total number of elements in the array.
* \return The total number of elements in the array. * \return The total number of elements in the array.
*/ */
uintmax_t elements() const throw () uintmax_t elements() const
{ {
return gta_get_elements(_header); return gta_get_elements(_header);
} }
/** /**
* \brief Get the total size of the array. * \brief Get the total size of the array.
* \return The size (in bytes) of the complete array. * \return The size (in bytes) of the complete array.
*/ */
uintmax_t data_size() const throw () uintmax_t data_size() const
{ {
return gta_get_data_size(_header); return gta_get_data_size(_header);
} }
/** /**
* \brief Get the compression. * \brief Get the compression.
* \return The compression type. * \return The compression type.
* *
* Gets the compression type for the header and data.\n * Gets the compression type for the header and data.\n
* See \a gta_compression_t for more information on compression typ es.\n * See \a gta_compression_t for more information on compression typ es.\n
* Compressed data is always stored in chunks, while uncompressed * Compressed data is always stored in chunks, while uncompressed
* data is never stored in chunks. * data is never stored in chunks.
*/ */
gta::compression compression() const throw () gta::compression compression() const
{ {
return static_cast<gta::compression>(gta_get_compression(_heade r)); return static_cast<gta::compression>(gta_get_compression(_heade r));
} }
/** /**
* \brief Set the compression. * \brief Set the compression.
* \param compression The compression type. * \param compression The compression type.
* *
* Sets the compression type for writing the header and data.\n * Sets the compression type for writing the header and data.\n
* See \a gta_compression_t for more information on compression typ es. * See \a gta_compression_t for more information on compression typ es.
*/ */
void set_compression(gta::compression compression) throw () void set_compression(gta::compression compression)
{ {
gta_set_compression(_header, static_cast<gta_compression_t>(com pression)); gta_set_compression(_header, static_cast<gta_compression_t>(com pression));
} }
/*@}*/ /*@}*/
/** /**
* \name Define an Array * \name Define an Array
*/ */
skipping to change at line 1075 skipping to change at line 1110
* \param types The types of the \a n components. * \param types The types of the \a n components.
* \param sizes NULL, or the sizes of the components that have typ e \a gta::blob. * \param sizes NULL, or the sizes of the components that have typ e \a gta::blob.
* *
* Set the components of the array elements.\n * Set the components of the array elements.\n
* The \a sizes parameter can be NULL if no components have the typ e \a gta::blob. * The \a sizes parameter can be NULL if no components have the typ e \a gta::blob.
* Otherwise, it must point to a list that contains the sizes of th ese components (and only * Otherwise, it must point to a list that contains the sizes of th ese components (and only
* these components). For example, if there are five components, bu t only two have the type * these components). For example, if there are five components, bu t only two have the type
* \a gta::blob, then the \a sizes list must contain two size value s.\n * \a gta::blob, then the \a sizes list must contain two size value s.\n
* All components will initially have an empty tag list.\n * All components will initially have an empty tag list.\n
*/ */
void set_components(uintmax_t n, const type *types, const uintmax_t *sizes = NULL) throw (exception) void set_components(uintmax_t n, const type *types, const uintmax_t *sizes = NULL)
{ {
gta_result_t r = gta_set_components(_header, n, reinterpret_cas t<const gta_type_t *>(types), sizes); gta_result_t r = gta_set_components(_header, n, reinterpret_cas t<const gta_type_t *>(types), sizes);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot set GTA components", static_cast<gt a::result>(r)); throw exception("Cannot set GTA components", static_cast<gt a::result>(r));
} }
reset_component_taglists();
} }
/** /**
* \brief Set the components of an array element (variant for elements with a single component). * \brief Set the components of an array element (variant for elements with a single component).
* \param type The type of the component. * \param type The type of the component.
* \param size The size of the component, in case the type is \a g ta::blob. * \param size The size of the component, in case the type is \a g ta::blob.
*/ */
void set_components(type type, uintmax_t size = 0) throw (exception ) void set_components(type type, uintmax_t size = 0)
{ {
gta::type types[] = { type }; gta::type types[] = { type };
uintmax_t sizes[] = { size }; uintmax_t sizes[] = { size };
gta_result_t r = gta_set_components(_header, 1, reinterpret_cas t<gta_type_t *>(types), sizes); gta_result_t r = gta_set_components(_header, 1, reinterpret_cas t<gta_type_t *>(types), sizes);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot set GTA components", static_cast<gt a::result>(r)); throw exception("Cannot set GTA components", static_cast<gt a::result>(r));
} }
reset_component_taglists();
} }
/** /**
* \brief Set the components of an array element (variant for elements with two components). * \brief Set the components of an array element (variant for elements with two components).
* \param type0 The type of the first component. * \param type0 The type of the first component.
* \param type1 The type of the second component. * \param type1 The type of the second component.
* \param size0 The size of the first component, in case its type i s \a gta::blob. * \param size0 The size of the first component, in case its type i s \a gta::blob.
* \param size1 The size of the second component, in case its type is \a gta::blob. * \param size1 The size of the second component, in case its type is \a gta::blob.
*/ */
void set_components(type type0, type type1, void set_components(type type0, type type1,
uintmax_t size0 = 0, uintmax_t size1 = 0) throw (exception) uintmax_t size0 = 0, uintmax_t size1 = 0)
{ {
type types[] = { type0, type1 }; type types[] = { type0, type1 };
uintmax_t sizes[] = { size0, size1 }; uintmax_t sizes[] = { size0, size1 };
gta_result_t r = gta_set_components(_header, 2, reinterpret_cas t<gta_type_t *>(types), sizes); gta_result_t r = gta_set_components(_header, 2, reinterpret_cas t<gta_type_t *>(types), sizes);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot set GTA components", static_cast<gt a::result>(r)); throw exception("Cannot set GTA components", static_cast<gt a::result>(r));
} }
reset_component_taglists();
} }
/** /**
* \brief Set the components of an array element (variant for elements with three components). * \brief Set the components of an array element (variant for elements with three components).
* \param type0 The type of the first component. * \param type0 The type of the first component.
* \param type1 The type of the second component. * \param type1 The type of the second component.
* \param type2 The type of the third component. * \param type2 The type of the third component.
* \param size0 The size of the first component, in case its type i s \a gta::blob. * \param size0 The size of the first component, in case its type i s \a gta::blob.
* \param size1 The size of the second component, in case its type is \a gta::blob. * \param size1 The size of the second component, in case its type is \a gta::blob.
* \param size2 The size of the third component, in case its type i s \a gta::blob. * \param size2 The size of the third component, in case its type i s \a gta::blob.
*/ */
void set_components(type type0, type type1, type type2, void set_components(type type0, type type1, type type2,
uintmax_t size0 = 0, uintmax_t size1 = 0, uintmax_t size2 = 0) throw (exception) uintmax_t size0 = 0, uintmax_t size1 = 0, uintmax_t size2 = 0)
{ {
type types[] = { type0, type1, type2 }; type types[] = { type0, type1, type2 };
uintmax_t sizes[] = { size0, size1, size2 }; uintmax_t sizes[] = { size0, size1, size2 };
gta_result_t r = gta_set_components(_header, 3, reinterpret_cas t<gta_type_t *>(types), sizes); gta_result_t r = gta_set_components(_header, 3, reinterpret_cas t<gta_type_t *>(types), sizes);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot set GTA components", static_cast<gt a::result>(r)); throw exception("Cannot set GTA components", static_cast<gt a::result>(r));
} }
reset_component_taglists();
} }
/** /**
* \brief Set the components of an array element (variant for elements with four components). * \brief Set the components of an array element (variant for elements with four components).
* \param type0 The type of the first component. * \param type0 The type of the first component.
* \param type1 The type of the second component. * \param type1 The type of the second component.
* \param type2 The type of the third component. * \param type2 The type of the third component.
* \param type3 The type of the fourth component. * \param type3 The type of the fourth component.
* \param size0 The size of the first component, in case its type i s \a gta::blob. * \param size0 The size of the first component, in case its type i s \a gta::blob.
* \param size1 The size of the second component, in case its type is \a gta::blob. * \param size1 The size of the second component, in case its type is \a gta::blob.
* \param size2 The size of the third component, in case its type i s \a gta::blob. * \param size2 The size of the third component, in case its type i s \a gta::blob.
* \param size3 The size of the fourth component, in case its type is \a gta::blob. * \param size3 The size of the fourth component, in case its type is \a gta::blob.
*/ */
void set_components(type type0, type type1, type type2, type type3, 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) throw (exception) uintmax_t size0 = 0, uintmax_t size1 = 0, uintmax_t size2 = 0, uintmax_t size3 = 0)
{ {
type types[] = { type0, type1, type2, type3 }; type types[] = { type0, type1, type2, type3 };
uintmax_t sizes[] = { size0, size1, size2, size3 }; uintmax_t sizes[] = { size0, size1, size2, size3 };
gta_result_t r = gta_set_components(_header, 4, reinterpret_cas t<gta_type_t *>(types), sizes); gta_result_t r = gta_set_components(_header, 4, reinterpret_cas t<gta_type_t *>(types), sizes);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot set GTA components", static_cast<gt a::result>(r)); throw exception("Cannot set GTA components", static_cast<gt a::result>(r));
} }
reset_component_taglists();
} }
/** /**
* \brief Set the dimensions. * \brief Set the dimensions.
* \param n The number of dimensions. * \param n The number of dimensions.
* \param sizes The array sizes in each of the \n dimensions. * \param sizes The array sizes in each of the \n dimensions.
* *
* Sets the array dimensions.\n * Sets the array dimensions.\n
* All dimensions will initially have an empty tag list. * All dimensions will initially have an empty tag list.
*/ */
void set_dimensions(uintmax_t n, const uintmax_t *sizes) throw (exc eption) void set_dimensions(uintmax_t n, const uintmax_t *sizes)
{ {
gta_result_t r = gta_set_dimensions(_header, n, sizes); gta_result_t r = gta_set_dimensions(_header, n, sizes);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot set GTA dimensions", static_cast<gt a::result>(r)); throw exception("Cannot set GTA dimensions", static_cast<gt a::result>(r));
} }
reset_dimension_taglists();
} }
/** /**
* \brief Set the dimensions (variant for one-dimensional arr ays). * \brief Set the dimensions (variant for one-dimensional arr ays).
* \param size The size in the single dimension. * \param size The size in the single dimension.
*/ */
void set_dimensions(uintmax_t size) throw (exception) void set_dimensions(uintmax_t size)
{ {
uintmax_t sizes[] = { size }; uintmax_t sizes[] = { size };
gta_result_t r = gta_set_dimensions(_header, 1, sizes); gta_result_t r = gta_set_dimensions(_header, 1, sizes);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot set GTA dimensions", static_cast<gt a::result>(r)); throw exception("Cannot set GTA dimensions", static_cast<gt a::result>(r));
} }
reset_dimension_taglists();
} }
/** /**
* \brief Set the dimensions (variant for two-dimensional arr ays). * \brief Set the dimensions (variant for two-dimensional arr ays).
* \param size0 The size in the first dimension. * \param size0 The size in the first dimension.
* \param size1 The size in the second dimension. * \param size1 The size in the second dimension.
*/ */
void set_dimensions(uintmax_t size0, uintmax_t size1) throw (except ion) void set_dimensions(uintmax_t size0, uintmax_t size1)
{ {
uintmax_t sizes[] = { size0, size1 }; uintmax_t sizes[] = { size0, size1 };
gta_result_t r = gta_set_dimensions(_header, 2, sizes); gta_result_t r = gta_set_dimensions(_header, 2, sizes);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot set GTA dimensions", static_cast<gt a::result>(r)); throw exception("Cannot set GTA dimensions", static_cast<gt a::result>(r));
} }
reset_dimension_taglists();
} }
/** /**
* \brief Set the dimensions (variant for three-dimensional a rrays). * \brief Set the dimensions (variant for three-dimensional a rrays).
* \param size0 The size in the first dimension. * \param size0 The size in the first dimension.
* \param size1 The size in the second dimension. * \param size1 The size in the second dimension.
* \param size2 The size in the third dimension. * \param size2 The size in the third dimension.
*/ */
void set_dimensions(uintmax_t size0, uintmax_t size1, uintmax_t siz e2) throw (exception) void set_dimensions(uintmax_t size0, uintmax_t size1, uintmax_t siz e2)
{ {
uintmax_t sizes[] = { size0, size1, size2 }; uintmax_t sizes[] = { size0, size1, size2 };
gta_result_t r = gta_set_dimensions(_header, 3, sizes); gta_result_t r = gta_set_dimensions(_header, 3, sizes);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot set GTA dimensions", static_cast<gt a::result>(r)); throw exception("Cannot set GTA dimensions", static_cast<gt a::result>(r));
} }
reset_dimension_taglists();
} }
/** /**
* \brief Set the dimensions (variant for four-dimensional ar rays). * \brief Set the dimensions (variant for four-dimensional ar rays).
* \param size0 The size in the first dimension. * \param size0 The size in the first dimension.
* \param size1 The size in the second dimension. * \param size1 The size in the second dimension.
* \param size2 The size in the third dimension. * \param size2 The size in the third dimension.
* \param size3 The size in the fourth dimension. * \param size3 The size in the fourth dimension.
*/ */
void set_dimensions(uintmax_t size0, uintmax_t size1, uintmax_t siz e2, uintmax_t size3) throw (exception) void set_dimensions(uintmax_t size0, uintmax_t size1, uintmax_t siz e2, uintmax_t size3)
{ {
uintmax_t sizes[] = { size0, size1, size2, size3 }; uintmax_t sizes[] = { size0, size1, size2, size3 };
gta_result_t r = gta_set_dimensions(_header, 4, sizes); gta_result_t r = gta_set_dimensions(_header, 4, sizes);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot set GTA dimensions", static_cast<gt a::result>(r)); throw exception("Cannot set GTA dimensions", static_cast<gt a::result>(r));
} }
reset_dimension_taglists();
} }
/*@}*/ /*@}*/
/** /**
* \name Read and Write Complete Arrays * \name Read and Write Complete Arrays
*/ */
/*@{*/ /*@{*/
/** /**
* \brief Read the complete data. * \brief Read the complete data.
* \param io Custom input object. * \param io Custom input object.
* \param data Data buffer. * \param data Data buffer.
* *
* Reads the complete data into the given buffer. The buffer must b e large enough. * Reads the complete data into the given buffer. The buffer must b e large enough.
*/ */
void read_data(custom_io &io, void *data) const throw (exception) void read_data(custom_io &io, void *data) const
{ {
gta_result_t r = gta_read_data(_header, data, read_custom_io, r einterpret_cast<intptr_t>(&io)); gta_result_t r = gta_read_data(_header, data, read_custom_io, r einterpret_cast<intptr_t>(&io));
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot read GTA data", static_cast<gta::re sult>(r)); throw exception("Cannot read GTA data", static_cast<gta::re sult>(r));
} }
} }
/** /**
* \brief Read the complete data. * \brief Read the complete data.
* \param is Input stream. * \param is Input stream.
* \param data Data buffer. * \param data Data buffer.
* *
* Reads the complete data into the given buffer. The buffer must b e large enough. * Reads the complete data into the given buffer. The buffer must b e large enough.
*/ */
void read_data(std::istream &is, void *data) const throw (exception ) void read_data(std::istream &is, void *data) const
{ {
istream_io io(is); istream_io io(is);
gta_result_t r = gta_read_data(_header, data, read_custom_io, r einterpret_cast<intptr_t>(&io)); gta_result_t r = gta_read_data(_header, data, read_custom_io, r einterpret_cast<intptr_t>(&io));
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot read GTA data", static_cast<gta::re sult>(r)); throw exception("Cannot read GTA data", static_cast<gta::re sult>(r));
} }
} }
/** /**
* \brief Read the complete data. * \brief Read the complete data.
* \param f Input C stream. * \param f Input C stream.
* \param data Data buffer. * \param data Data buffer.
* *
* Reads the complete data into the given buffer. The buffer must b e large enough. * Reads the complete data into the given buffer. The buffer must b e large enough.
*/ */
void read_data(FILE *f, void *data) const throw (exception) void read_data(FILE *f, void *data) const
{ {
gta_result_t r = gta_read_data_from_stream(_header, data, f); gta_result_t r = gta_read_data_from_stream(_header, data, f);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot read GTA data", static_cast<gta::re sult>(r)); throw exception("Cannot read GTA data", static_cast<gta::re sult>(r));
} }
} }
/** /**
* \brief Read the complete data. * \brief Read the complete data.
* \param fd Input file descriptor. * \param fd Input file descriptor.
* \param data Data buffer. * \param data Data buffer.
* *
* Reads the complete data into the given buffer. The buffer must b e large enough. * Reads the complete data into the given buffer. The buffer must b e large enough.
*/ */
void read_data(int fd, void *data) const throw (exception) void read_data(int fd, void *data) const
{ {
gta_result_t r = gta_read_data_from_fd(_header, data, fd); gta_result_t r = gta_read_data_from_fd(_header, data, fd);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot read GTA data", static_cast<gta::re sult>(r)); throw exception("Cannot read GTA data", static_cast<gta::re sult>(r));
} }
} }
/** /**
* \brief Skip the complete data. * \brief Skip the complete data.
* \param io Custom input object. * \param io Custom input object.
* *
* Skips the complete data, so that the next GTA header can be read . * Skips the complete data, so that the next GTA header can be read .
*/ */
void skip_data(custom_io &io) const throw (exception) void skip_data(custom_io &io) const
{ {
gta_result_t r = gta_skip_data(_header, read_custom_io, gta_result_t r = gta_skip_data(_header, read_custom_io,
(io.seekable() ? seek_custom_io : NULL), (io.seekable() ? seek_custom_io : NULL),
reinterpret_cast<intptr_t>(&io)); reinterpret_cast<intptr_t>(&io));
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot skip GTA data", static_cast<gta::re sult>(r)); throw exception("Cannot skip GTA data", static_cast<gta::re sult>(r));
} }
} }
/** /**
* \brief Skip the complete data. * \brief Skip the complete data.
* \param is Input stream. * \param is Input stream.
* *
* Skips the complete data, so that the next GTA header can be read . * Skips the complete data, so that the next GTA header can be read .
*/ */
void skip_data(std::istream &is) const throw (exception) void skip_data(std::istream &is) const
{ {
istream_io io(is); istream_io io(is);
gta_result_t r = gta_skip_data(_header, read_custom_io, gta_result_t r = gta_skip_data(_header, read_custom_io,
(io.seekable() ? seek_custom_io : NULL), (io.seekable() ? seek_custom_io : NULL),
reinterpret_cast<intptr_t>(&io)); reinterpret_cast<intptr_t>(&io));
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot skip GTA data", static_cast<gta::re sult>(r)); throw exception("Cannot skip GTA data", static_cast<gta::re sult>(r));
} }
} }
/** /**
* \brief Skip the complete data. * \brief Skip the complete data.
* \param f Input C stream. * \param f Input C stream.
* *
* Skips the complete data, so that the next GTA header can be read . * Skips the complete data, so that the next GTA header can be read .
*/ */
void skip_data(FILE *f) const throw (exception) void skip_data(FILE *f) const
{ {
gta_result_t r = gta_skip_data_from_stream(_header, f); gta_result_t r = gta_skip_data_from_stream(_header, f);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot skip GTA data", static_cast<gta::re sult>(r)); throw exception("Cannot skip GTA data", static_cast<gta::re sult>(r));
} }
} }
/** /**
* \brief Skip the complete data. * \brief Skip the complete data.
* \param fd Input file descriptor. * \param fd Input file descriptor.
* *
* Skips the complete data, so that the next GTA header can be read . * Skips the complete data, so that the next GTA header can be read .
*/ */
void skip_data(int fd) const throw (exception) void skip_data(int fd) const
{ {
gta_result_t r = gta_skip_data_from_fd(_header, fd); gta_result_t r = gta_skip_data_from_fd(_header, fd);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot skip GTA data", static_cast<gta::re sult>(r)); throw exception("Cannot skip GTA data", static_cast<gta::re sult>(r));
} }
} }
/** /**
* \brief Write the complete data. * \brief Write the complete data.
* \param io Custom output object. * \param io Custom output object.
* \param data Data buffer. * \param data Data buffer.
*/ */
void write_data(custom_io &io, const void *data) const throw (excep tion) void write_data(custom_io &io, const void *data) const
{ {
gta_result_t r = gta_write_data(_header, data, write_custom_io, reinterpret_cast<intptr_t>(&io)); gta_result_t r = gta_write_data(_header, data, write_custom_io, reinterpret_cast<intptr_t>(&io));
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot write GTA data", static_cast<gta::r esult>(r)); throw exception("Cannot write GTA data", static_cast<gta::r esult>(r));
} }
} }
/** /**
* \brief Write the complete data. * \brief Write the complete data.
* \param os Output stream. * \param os Output stream.
* \param data Data buffer. * \param data Data buffer.
*/ */
void write_data(std::ostream &os, const void *data) const throw (ex ception) void write_data(std::ostream &os, const void *data) const
{ {
ostream_io io(os); ostream_io io(os);
gta_result_t r = gta_write_data(_header, data, write_custom_io, reinterpret_cast<intptr_t>(&io)); gta_result_t r = gta_write_data(_header, data, write_custom_io, reinterpret_cast<intptr_t>(&io));
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot write GTA data", static_cast<gta::r esult>(r)); throw exception("Cannot write GTA data", static_cast<gta::r esult>(r));
} }
} }
/** /**
* \brief Write the complete data. * \brief Write the complete data.
* \param f Output C stream. * \param f Output C stream.
* \param data Data buffer. * \param data Data buffer.
*/ */
void write_data(FILE *f, const void *data) const throw (exception) void write_data(FILE *f, const void *data) const
{ {
gta_result_t r = gta_write_data_to_stream(_header, data, f); gta_result_t r = gta_write_data_to_stream(_header, data, f);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot write GTA data", static_cast<gta::r esult>(r)); throw exception("Cannot write GTA data", static_cast<gta::r esult>(r));
} }
} }
/** /**
* \brief Write the complete data. * \brief Write the complete data.
* \param fd Output file descriptor. * \param fd Output file descriptor.
* \param data Data buffer. * \param data Data buffer.
*/ */
void write_data(int fd, const void *data) const throw (exception) void write_data(int fd, const void *data) const
{ {
gta_result_t r = gta_write_data_to_fd(_header, data, fd); gta_result_t r = gta_write_data_to_fd(_header, data, fd);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot write GTA data", static_cast<gta::r esult>(r)); throw exception("Cannot write GTA data", static_cast<gta::r esult>(r));
} }
} }
/** /**
* \brief Copy the complete data. * \brief Copy the complete data.
* \param read_io Custom input object. * \param read_io Custom input object.
* \param write_header Output header. * \param write_header Output header.
* \param write_io Custom output object. * \param write_io Custom output object.
*/ */
void copy_data(custom_io &read_io, const header &write_header, cust om_io &write_io) const throw (exception) void copy_data(custom_io &read_io, const header &write_header, cust om_io &write_io) const
{ {
gta_result_t r = gta_copy_data(_header, gta_result_t r = gta_copy_data(_header,
read_custom_io, reinterpret_cast<intptr_t>(&read_io), read_custom_io, reinterpret_cast<intptr_t>(&read_io),
write_header._header, write_header._header,
write_custom_io, reinterpret_cast<intptr_t>(&write_io)) ; write_custom_io, reinterpret_cast<intptr_t>(&write_io)) ;
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot copy GTA data", static_cast<gta::re sult>(r)); throw exception("Cannot copy GTA data", static_cast<gta::re sult>(r));
} }
} }
/** /**
* \brief Copy the complete data. * \brief Copy the complete data.
* \param is Input stream. * \param is Input stream.
* \param write_header Output header. * \param write_header Output header.
* \param os Output stream. * \param os Output stream.
*/ */
void copy_data(std::istream &is, const header &write_header, std::o stream &os) const throw (exception) void copy_data(std::istream &is, const header &write_header, std::o stream &os) const
{ {
istream_io read_io(is); istream_io read_io(is);
ostream_io write_io(os); ostream_io write_io(os);
gta_result_t r = gta_copy_data(_header, gta_result_t r = gta_copy_data(_header,
read_custom_io, reinterpret_cast<intptr_t>(&read_io), read_custom_io, reinterpret_cast<intptr_t>(&read_io),
write_header._header, write_header._header,
write_custom_io, reinterpret_cast<intptr_t>(&write_io)) ; write_custom_io, reinterpret_cast<intptr_t>(&write_io)) ;
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot copy GTA data", static_cast<gta::re sult>(r)); throw exception("Cannot copy GTA data", static_cast<gta::re sult>(r));
} }
} }
/** /**
* \brief Copy the complete data. * \brief Copy the complete data.
* \param fi Input C stream. * \param fi Input C stream.
* \param write_header Output header. * \param write_header Output header.
* \param fo Output C stream. * \param fo Output C stream.
*/ */
void copy_data(FILE *fi, const header &write_header, FILE *fo) cons t throw (exception) void copy_data(FILE *fi, const header &write_header, FILE *fo) cons t
{ {
gta_result_t r = gta_copy_data_stream(_header, fi, write_header ._header, fo); gta_result_t r = gta_copy_data_stream(_header, fi, write_header ._header, fo);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot copy GTA data", static_cast<gta::re sult>(r)); throw exception("Cannot copy GTA data", static_cast<gta::re sult>(r));
} }
} }
/** /**
* \brief Copy the complete data. * \brief Copy the complete data.
* \param fdi Input file descriptor. * \param fdi Input file descriptor.
* \param write_header Output header. * \param write_header Output header.
* \param fdo Output file descriptor. * \param fdo Output file descriptor.
*/ */
void copy_data(int fdi, const header &write_header, int fdo) const throw (exception) void copy_data(int fdi, const header &write_header, int fdo) const
{ {
gta_result_t r = gta_copy_data_fd(_header, fdi, write_header._h eader, fdo); gta_result_t r = gta_copy_data_fd(_header, fdi, write_header._h eader, fdo);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot copy GTA data", static_cast<gta::re sult>(r)); throw exception("Cannot copy GTA data", static_cast<gta::re sult>(r));
} }
} }
/*@}*/ /*@}*/
/** /**
* \name In-Memory Data Access * \name In-Memory Data Access
*/ */
/*@{*/ /*@{*/
/** /**
* \brief Transform a linear index to array indices. * \brief Transform a linear index to array indices.
* \param index The linear index. * \param index The linear index.
* \param indices The array indices. * \param indices The array indices.
*/ */
void linear_index_to_indices(uintmax_t index, uintmax_t *indices) c onst throw () void linear_index_to_indices(uintmax_t index, uintmax_t *indices) c onst
{ {
gta_linear_index_to_indices(_header, index, indices); gta_linear_index_to_indices(_header, index, indices);
} }
/** /**
* \brief Transform array indices to a linear index. * \brief Transform array indices to a linear index.
* \param indices The array indices. * \param indices The array indices.
* \return The linear index. * \return The linear index.
*/ */
uintmax_t indices_to_linear_index(const uintmax_t *indices) const t hrow () uintmax_t indices_to_linear_index(const uintmax_t *indices) const
{ {
return gta_indices_to_linear_index(_header, indices); return gta_indices_to_linear_index(_header, indices);
} }
/** /**
* \brief Get an array element. * \brief Get an array element.
* \param data Data Buffer. * \param data Data Buffer.
* \param indices Indices for each dimension of the array. * \param indices Indices for each dimension of the array.
* \return A pointer to the element. * \return A pointer to the element.
*/ */
const void *element(const void *data, const uintmax_t *indices) con st throw () const void *element(const void *data, const uintmax_t *indices) con st
{ {
return gta_get_element_const(_header, data, indices); return gta_get_element_const(_header, data, indices);
} }
/** /**
* \brief Get an array element. * \brief Get an array element.
* \param data Data Buffer. * \param data Data Buffer.
* \param indices Indices for each dimension of the array. * \param indices Indices for each dimension of the array.
* \return A pointer to the element. * \return A pointer to the element.
*/ */
void *element(void *data, const uintmax_t *indices) const throw () void *element(void *data, const uintmax_t *indices) const
{ {
return gta_get_element(_header, data, indices); return gta_get_element(_header, data, indices);
} }
/** /**
* \brief Get an array element via a linear index. * \brief Get an array element via a linear index.
* \param data Data Buffer. * \param data Data Buffer.
* \param index Index of the element. * \param index Index of the element.
* \return A pointer to the element. * \return A pointer to the element.
* *
* This function not only works for one-dimensional arrays in the o bvious way, * This function not only works for one-dimensional arrays in the o bvious way,
* but also for multidimensional arrays by using \a index as a line ar index to * but also for multidimensional arrays by using \a index as a line ar index to
* the array data. * the array data.
*/ */
const void *element(const void *data, uintmax_t index) const throw () const void *element(const void *data, uintmax_t index) const
{ {
return gta_get_element_linear_const(_header, data, index); return gta_get_element_linear_const(_header, data, index);
} }
/** /**
* \brief Get an array element via a linear index. * \brief Get an array element via a linear index.
* \param data Data Buffer. * \param data Data Buffer.
* \param index Index of the element. * \param index Index of the element.
* \return A pointer to the element. * \return A pointer to the element.
* *
* This function not only works for one-dimensional arrays in the o bvious way, * This function not only works for one-dimensional arrays in the o bvious way,
* but also for multidimensional arrays by using \a index as a line ar index to * but also for multidimensional arrays by using \a index as a line ar index to
* the array data. * the array data.
*/ */
void *element(void *data, uintmax_t index) const throw () void *element(void *data, uintmax_t index) const
{ {
return gta_get_element_linear(_header, data, index); return gta_get_element_linear(_header, data, index);
} }
/** /**
* \brief Get an array element (variant for two-dimen sional arrays). * \brief Get an array element (variant for two-dimen sional arrays).
* \param data Data Buffer. * \param data Data Buffer.
* \param index0 Index of the element in the first dimension . * \param index0 Index of the element in the first dimension .
* \param index1 Index of the element in the second dimensio n. * \param index1 Index of the element in the second dimensio n.
* \return A pointer to the element. * \return A pointer to the element.
*/ */
const void *element(const void *data, uintmax_t index0, uintmax_t i ndex1) const throw () const void *element(const void *data, uintmax_t index0, uintmax_t i ndex1) const
{ {
uintmax_t indices[] = { index0, index1 }; uintmax_t indices[] = { index0, index1 };
return gta_get_element_const(_header, data, indices); return gta_get_element_const(_header, data, indices);
} }
/** /**
* \brief Get an array element (variant for two-dimen sional arrays). * \brief Get an array element (variant for two-dimen sional arrays).
* \param data Data Buffer. * \param data Data Buffer.
* \param index0 Index of the element in the first dimension . * \param index0 Index of the element in the first dimension .
* \param index1 Index of the element in the second dimensio n. * \param index1 Index of the element in the second dimensio n.
* \return A pointer to the element. * \return A pointer to the element.
*/ */
void *element(void *data, uintmax_t index0, uintmax_t index1) const throw () void *element(void *data, uintmax_t index0, uintmax_t index1) const
{ {
uintmax_t indices[] = { index0, index1 }; uintmax_t indices[] = { index0, index1 };
return gta_get_element(_header, data, indices); return gta_get_element(_header, data, indices);
} }
/** /**
* \brief Get an array element (variant for three-dim ensional arrays). * \brief Get an array element (variant for three-dim ensional arrays).
* \param data Data Buffer. * \param data Data Buffer.
* \param index0 Index of the element in the first dimension . * \param index0 Index of the element in the first dimension .
* \param index1 Index of the element in the second dimensio n. * \param index1 Index of the element in the second dimensio n.
* \param index2 Index of the element in the third dimension . * \param index2 Index of the element in the third dimension .
* \return A pointer to the element. * \return A pointer to the element.
*/ */
const void *element(const void *data, uintmax_t index0, uintmax_t i ndex1, uintmax_t index2) const throw () const void *element(const void *data, uintmax_t index0, uintmax_t i ndex1, uintmax_t index2) const
{ {
uintmax_t indices[] = { index0, index1, index2 }; uintmax_t indices[] = { index0, index1, index2 };
return gta_get_element_const(_header, data, indices); return gta_get_element_const(_header, data, indices);
} }
/** /**
* \brief Get an array element (variant for three-dim ensional arrays). * \brief Get an array element (variant for three-dim ensional arrays).
* \param data Data Buffer. * \param data Data Buffer.
* \param index0 Index of the element in the first dimension . * \param index0 Index of the element in the first dimension .
* \param index1 Index of the element in the second dimensio n. * \param index1 Index of the element in the second dimensio n.
* \param index2 Index of the element in the third dimension . * \param index2 Index of the element in the third dimension .
* \return A pointer to the element. * \return A pointer to the element.
*/ */
void *element(void *data, uintmax_t index0, uintmax_t index1, uintm ax_t index2) const throw () void *element(void *data, uintmax_t index0, uintmax_t index1, uintm ax_t index2) const
{ {
uintmax_t indices[] = { index0, index1, index2 }; uintmax_t indices[] = { index0, index1, index2 };
return gta_get_element(_header, data, indices); return gta_get_element(_header, data, indices);
} }
/** /**
* \brief Get an array element (variant for four-dime nsional arrays). * \brief Get an array element (variant for four-dime nsional arrays).
* \param data Data Buffer. * \param data Data Buffer.
* \param index0 Index of the element in the first dimension . * \param index0 Index of the element in the first dimension .
* \param index1 Index of the element in the second dimensio n. * \param index1 Index of the element in the second dimensio n.
* \param index2 Index of the element in the third dimension . * \param index2 Index of the element in the third dimension .
* \param index3 Index of the element in the fourth dimensio n. * \param index3 Index of the element in the fourth dimensio n.
* \return A pointer to the element. * \return A pointer to the element.
*/ */
const void *element(const void *data, uintmax_t index0, uintmax_t i ndex1, uintmax_t index2, uintmax_t index3) const throw () const void *element(const void *data, uintmax_t index0, uintmax_t i ndex1, uintmax_t index2, uintmax_t index3) const
{ {
uintmax_t indices[] = { index0, index1, index2, index3 }; uintmax_t indices[] = { index0, index1, index2, index3 };
return gta_get_element_const(_header, data, indices); return gta_get_element_const(_header, data, indices);
} }
/** /**
* \brief Get an array element (variant for four-dime nsional arrays). * \brief Get an array element (variant for four-dime nsional arrays).
* \param data Data Buffer. * \param data Data Buffer.
* \param index0 Index of the element in the first dimension . * \param index0 Index of the element in the first dimension .
* \param index1 Index of the element in the second dimensio n. * \param index1 Index of the element in the second dimensio n.
* \param index2 Index of the element in the third dimension . * \param index2 Index of the element in the third dimension .
* \param index3 Index of the element in the fourth dimensio n. * \param index3 Index of the element in the fourth dimensio n.
* \return A pointer to the element. * \return A pointer to the element.
*/ */
void *element(void *data, uintmax_t index0, uintmax_t index1, uintm ax_t index2, uintmax_t index3) const throw () void *element(void *data, uintmax_t index0, uintmax_t index1, uintm ax_t index2, uintmax_t index3) const
{ {
uintmax_t indices[] = { index0, index1, index2, index3 }; uintmax_t indices[] = { index0, index1, index2, index3 };
return gta_get_element(_header, data, indices); return gta_get_element(_header, data, indices);
} }
/** /**
* \brief Get a component of an array element. * \brief Get a component of an array element.
* \param element Element. * \param element Element.
* \param i Component index. * \param i Component index.
* \return A pointer to the component. * \return A pointer to the component.
*/ */
const void *component(const void *element, uintmax_t i) const throw () const void *component(const void *element, uintmax_t i) const
{ {
return gta_get_component_const(_header, element, i); return gta_get_component_const(_header, element, i);
} }
/** /**
* \brief Get a component of an array element. * \brief Get a component of an array element.
* \param element Element. * \param element Element.
* \param i Component index. * \param i Component index.
* \return A pointer to the component. * \return A pointer to the component.
*/ */
void *component(void *element, uintmax_t i) const throw () void *component(void *element, uintmax_t i) const
{ {
return gta_get_component(_header, element, i); return gta_get_component(_header, element, i);
} }
/*@}*/ /*@}*/
/** /**
* \name Read and Write Array Elements * \name Read and Write Array Elements
* *
* These functions are intended to be used for filtering a complete array on a per-element basis. * These functions are intended to be used for filtering a complete array on a per-element basis.
skipping to change at line 1717 skipping to change at line 1762
/** /**
* \brief Read array elements. * \brief Read array elements.
* \param state The input/output state. * \param state The input/output state.
* \param io Custom input object. * \param io Custom input object.
* \param n The number of elements to read. * \param n The number of elements to read.
* \param buf The buffer for the elements. * \param buf The buffer for the elements.
* *
* Reads the given number of elements into the given buffer, which must be large enough. * Reads the given number of elements into the given buffer, which must be large enough.
*/ */
void read_elements(io_state &state, custom_io &io, uintmax_t n, voi d *buf) const throw (exception) void read_elements(io_state &state, custom_io &io, uintmax_t n, voi d *buf) const
{ {
gta_result_t r = gta_read_elements(_header, state._state, n, bu f, read_custom_io, reinterpret_cast<intptr_t>(&io)); gta_result_t r = gta_read_elements(_header, state._state, n, bu f, read_custom_io, reinterpret_cast<intptr_t>(&io));
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot read GTA data elements", static_cas t<gta::result>(r)); throw exception("Cannot read GTA data elements", static_cas t<gta::result>(r));
} }
} }
/** /**
* \brief Read array elements. * \brief Read array elements.
* \param state The input/output state. * \param state The input/output state.
* \param is Input stream. * \param is Input stream.
* \param n The number of elements to read. * \param n The number of elements to read.
* \param buf The buffer for the elements. * \param buf The buffer for the elements.
* *
* Reads the given number of elements into the given buffer, which must be large enough. * Reads the given number of elements into the given buffer, which must be large enough.
*/ */
void read_elements(io_state &state, std::istream &is, uintmax_t n, void *buf) const throw (exception) void read_elements(io_state &state, std::istream &is, uintmax_t n, void *buf) const
{ {
istream_io io(is); istream_io io(is);
gta_result_t r = gta_read_elements(_header, state._state, n, bu f, read_custom_io, reinterpret_cast<intptr_t>(&io)); gta_result_t r = gta_read_elements(_header, state._state, n, bu f, read_custom_io, reinterpret_cast<intptr_t>(&io));
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot read GTA data elements", static_cas t<gta::result>(r)); throw exception("Cannot read GTA data elements", static_cas t<gta::result>(r));
} }
} }
/** /**
* \brief Read array elements. * \brief Read array elements.
* \param state The input/output state. * \param state The input/output state.
* \param f Input stream. * \param f Input stream.
* \param n The number of elements to read. * \param n The number of elements to read.
* \param buf The buffer for the elements. * \param buf The buffer for the elements.
* *
* Reads the given number of elements into the given buffer, which must be large enough. * Reads the given number of elements into the given buffer, which must be large enough.
*/ */
void read_elements(io_state &state, FILE *f, uintmax_t n, void *buf ) const throw (exception) void read_elements(io_state &state, FILE *f, uintmax_t n, void *buf ) const
{ {
gta_result_t r = gta_read_elements_from_stream(_header, state._ state, n, buf, f); gta_result_t r = gta_read_elements_from_stream(_header, state._ state, n, buf, f);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot read GTA data elements", static_cas t<gta::result>(r)); throw exception("Cannot read GTA data elements", static_cas t<gta::result>(r));
} }
} }
/** /**
* \brief Read array elements. * \brief Read array elements.
* \param state The input/output state. * \param state The input/output state.
* \param fd Input file descriptor. * \param fd Input file descriptor.
* \param n The number of elements to read. * \param n The number of elements to read.
* \param buf The buffer for the elements. * \param buf The buffer for the elements.
* *
* Reads the given number of elements into the given buffer, which must be large enough. * Reads the given number of elements into the given buffer, which must be large enough.
*/ */
void read_elements(io_state &state, int fd, uintmax_t n, void *buf) const throw (exception) void read_elements(io_state &state, int fd, uintmax_t n, void *buf) const
{ {
gta_result_t r = gta_read_elements_from_fd(_header, state._stat e, n, buf, fd); gta_result_t r = gta_read_elements_from_fd(_header, state._stat e, n, buf, fd);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot read GTA data elements", static_cas t<gta::result>(r)); throw exception("Cannot read GTA data elements", static_cas t<gta::result>(r));
} }
} }
/** /**
* \brief Write array elements. * \brief Write array elements.
* \param state The input/output state. * \param state The input/output state.
* \param io Custom output object. * \param io Custom output object.
* \param n The number of elements to write. * \param n The number of elements to write.
* \param buf The buffer for the elements. * \param buf The buffer for the elements.
* *
* Writes the given number of elements from the given buffer. * Writes the given number of elements from the given buffer.
*/ */
void write_elements(io_state &state, custom_io &io, uintmax_t n, co nst void *buf) const throw (exception) void write_elements(io_state &state, custom_io &io, uintmax_t n, co nst void *buf) const
{ {
gta_result_t r = gta_write_elements(_header, state._state, n, b uf, write_custom_io, reinterpret_cast<intptr_t>(&io)); gta_result_t r = gta_write_elements(_header, state._state, n, b uf, write_custom_io, reinterpret_cast<intptr_t>(&io));
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot write GTA data elements", static_ca st<gta::result>(r)); throw exception("Cannot write GTA data elements", static_ca st<gta::result>(r));
} }
} }
/** /**
* \brief Write array elements. * \brief Write array elements.
* \param state The input/output state. * \param state The input/output state.
* \param os Output stream. * \param os Output stream.
* \param n The number of elements to write. * \param n The number of elements to write.
* \param buf The buffer for the elements. * \param buf The buffer for the elements.
* *
* Writes the given number of elements from the given buffer. * Writes the given number of elements from the given buffer.
*/ */
void write_elements(io_state &state, std::ostream &os, uintmax_t n, const void *buf) const throw (exception) void write_elements(io_state &state, std::ostream &os, uintmax_t n, const void *buf) const
{ {
ostream_io io(os); ostream_io io(os);
gta_result_t r = gta_write_elements(_header, state._state, n, b uf, write_custom_io, reinterpret_cast<intptr_t>(&io)); gta_result_t r = gta_write_elements(_header, state._state, n, b uf, write_custom_io, reinterpret_cast<intptr_t>(&io));
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot write GTA data elements", static_ca st<gta::result>(r)); throw exception("Cannot write GTA data elements", static_ca st<gta::result>(r));
} }
} }
/** /**
* \brief Write array elements. * \brief Write array elements.
* \param state The input/output state. * \param state The input/output state.
* \param f Output stream. * \param f Output stream.
* \param n The number of elements to write. * \param n The number of elements to write.
* \param buf The buffer for the elements. * \param buf The buffer for the elements.
* *
* Writes the given number of elements from the given buffer. * Writes the given number of elements from the given buffer.
*/ */
void write_elements(io_state &state, FILE *f, uintmax_t n, const vo id *buf) const throw (exception) void write_elements(io_state &state, FILE *f, uintmax_t n, const vo id *buf) const
{ {
gta_result_t r = gta_write_elements_to_stream(_header, state._s tate, n, buf, f); gta_result_t r = gta_write_elements_to_stream(_header, state._s tate, n, buf, f);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot write GTA data elements", static_ca st<gta::result>(r)); throw exception("Cannot write GTA data elements", static_ca st<gta::result>(r));
} }
} }
/** /**
* \brief Write array elements. * \brief Write array elements.
* \param state The input/output state. * \param state The input/output state.
* \param fd Output file descriptor. * \param fd Output file descriptor.
* \param n The number of elements to write. * \param n The number of elements to write.
* \param buf The buffer for the elements. * \param buf The buffer for the elements.
* *
* Writes the given number of elements from the given buffer. * Writes the given number of elements from the given buffer.
*/ */
void write_elements(io_state &state, int fd, uintmax_t n, const voi d *buf) const throw (exception) void write_elements(io_state &state, int fd, uintmax_t n, const voi d *buf) const
{ {
gta_result_t r = gta_write_elements_to_fd(_header, state._state , n, buf, fd); gta_result_t r = gta_write_elements_to_fd(_header, state._state , n, buf, fd);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot write GTA data elements", static_ca st<gta::result>(r)); throw exception("Cannot write GTA data elements", static_ca st<gta::result>(r));
} }
} }
/*@}*/ /*@}*/
/** /**
* \name Read and Write Array Blocks * \name Read and Write Array Blocks
* *
* These functions can only be used if the data is not compressed ( see \a header::compression()) * These functions can only be used if the data is not compressed ( see \a header::compression())
* and the input/output is seekable.\n * and the input/output is seekable.\n
skipping to change at line 1884 skipping to change at line 1929
* \param data_offset Offset of the first data byte. * \param data_offset Offset of the first data byte.
* \param lower_coordinates Coordinates of the lower corner ele ment of the block. * \param lower_coordinates Coordinates of the lower corner ele ment of the block.
* \param higher_coordinates Coordinates of the higher corner el ement of the block. * \param higher_coordinates Coordinates of the higher corner el ement of the block.
* \param block Block buffer. * \param block Block buffer.
* *
* Reads the given array block and copies it to the given block buf fer, which must be large enough.\n * Reads the given array block and copies it to the given block buf fer, which must be large enough.\n
* This function modifies the file position indicator of the input. * This function modifies the file position indicator of the input.
*/ */
void read_block(custom_io &io, uintmax_t data_offset, void read_block(custom_io &io, uintmax_t data_offset,
const uintmax_t *lower_coordinates, const uintmax_t *higher _coordinates, const uintmax_t *lower_coordinates, const uintmax_t *higher _coordinates,
void *block) const throw (exception) void *block) const
{ {
gta_result_t r = gta_read_block(_header, data_offset, gta_result_t r = gta_read_block(_header, data_offset,
lower_coordinates, higher_coordinates, block, lower_coordinates, higher_coordinates, block,
read_custom_io, seek_custom_io, reinterpret_cast<intptr _t>(&io)); read_custom_io, seek_custom_io, reinterpret_cast<intptr _t>(&io));
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot read GTA data block", static_cast<g ta::result>(r)); throw exception("Cannot read GTA data block", static_cast<g ta::result>(r));
} }
} }
/** /**
* \brief Read an array block. * \brief Read an array block.
* \param is Input stream. * \param is Input stream.
* \param data_offset Offset of the first data byte. * \param data_offset Offset of the first data byte.
* \param lower_coordinates Coordinates of the lower corner ele ment of the block. * \param lower_coordinates Coordinates of the lower corner ele ment of the block.
* \param higher_coordinates Coordinates of the higher corner el ement of the block. * \param higher_coordinates Coordinates of the higher corner el ement of the block.
* \param block Block buffer. * \param block Block buffer.
* *
* Reads the given array block and copies it to the given block buf fer, which must be large enough.\n * Reads the given array block and copies it to the given block buf fer, which must be large enough.\n
* This function modifies the file position indicator of the input. * This function modifies the file position indicator of the input.
*/ */
void read_block(std::istream &is, uintmax_t data_offset, void read_block(std::istream &is, uintmax_t data_offset,
const uintmax_t *lower_coordinates, const uintmax_t *higher _coordinates, const uintmax_t *lower_coordinates, const uintmax_t *higher _coordinates,
void *block) const throw (exception) void *block) const
{ {
istream_io io(is); istream_io io(is);
gta_result_t r = gta_read_block(_header, data_offset, gta_result_t r = gta_read_block(_header, data_offset,
lower_coordinates, higher_coordinates, block, lower_coordinates, higher_coordinates, block,
read_custom_io, seek_custom_io, reinterpret_cast<intptr _t>(&io)); read_custom_io, seek_custom_io, reinterpret_cast<intptr _t>(&io));
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot read GTA data block", static_cast<g ta::result>(r)); throw exception("Cannot read GTA data block", static_cast<g ta::result>(r));
} }
} }
/** /**
* \brief Read an array block. * \brief Read an array block.
* \param f Input C stream. * \param f Input C stream.
* \param data_offset Offset of the first data byte. * \param data_offset Offset of the first data byte.
* \param lower_coordinates Coordinates of the lower corner ele ment of the block. * \param lower_coordinates Coordinates of the lower corner ele ment of the block.
* \param higher_coordinates Coordinates of the higher corner el ement of the block. * \param higher_coordinates Coordinates of the higher corner el ement of the block.
* \param block Block buffer. * \param block Block buffer.
* *
* Reads the given array block and copies it to the given block buf fer, which must be large enough.\n * Reads the given array block and copies it to the given block buf fer, which must be large enough.\n
* This function modifies the file position indicator of the input. * This function modifies the file position indicator of the input.
*/ */
void read_block(FILE *f, uintmax_t data_offset, void read_block(FILE *f, uintmax_t data_offset,
const uintmax_t *lower_coordinates, const uintmax_t *higher _coordinates, const uintmax_t *lower_coordinates, const uintmax_t *higher _coordinates,
void *block) const throw (exception) void *block) const
{ {
gta_result_t r = gta_read_block_from_stream(_header, data_offse t, gta_result_t r = gta_read_block_from_stream(_header, data_offse t,
lower_coordinates, higher_coordinates, block, f); lower_coordinates, higher_coordinates, block, f);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot read GTA data block", static_cast<g ta::result>(r)); throw exception("Cannot read GTA data block", static_cast<g ta::result>(r));
} }
} }
/** /**
* \brief Read an array block. * \brief Read an array block.
* \param fd Input file descriptor. * \param fd Input file descriptor.
* \param data_offset Offset of the first data byte. * \param data_offset Offset of the first data byte.
* \param lower_coordinates Coordinates of the lower corner ele ment of the block. * \param lower_coordinates Coordinates of the lower corner ele ment of the block.
* \param higher_coordinates Coordinates of the higher corner el ement of the block. * \param higher_coordinates Coordinates of the higher corner el ement of the block.
* \param block Block buffer. * \param block Block buffer.
* *
* Reads the given array block and copies it to the given block buf fer, which must be large enough.\n * Reads the given array block and copies it to the given block buf fer, which must be large enough.\n
* This function modifies the file position indicator of the input. * This function modifies the file position indicator of the input.
*/ */
void read_block(int fd, uintmax_t data_offset, void read_block(int fd, uintmax_t data_offset,
const uintmax_t *lower_coordinates, const uintmax_t *higher _coordinates, const uintmax_t *lower_coordinates, const uintmax_t *higher _coordinates,
void *block) const throw (exception) void *block) const
{ {
gta_result_t r = gta_read_block_from_fd(_header, data_offset, gta_result_t r = gta_read_block_from_fd(_header, data_offset,
lower_coordinates, higher_coordinates, block, fd); lower_coordinates, higher_coordinates, block, fd);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot read GTA data block", static_cast<g ta::result>(r)); throw exception("Cannot read GTA data block", static_cast<g ta::result>(r));
} }
} }
/** /**
* \brief Write an array block. * \brief Write an array block.
* \param io Custom output object. * \param io Custom output object.
* \param data_offset Offset of the first data byte. * \param data_offset Offset of the first data byte.
* \param lower_coordinates Coordinates of the lower corner ele ment of the block. * \param lower_coordinates Coordinates of the lower corner ele ment of the block.
* \param higher_coordinates Coordinates of the higher corner el ement of the block. * \param higher_coordinates Coordinates of the higher corner el ement of the block.
* \param block Block buffer. * \param block Block buffer.
* *
* This function modifies the file position indicator of the output . * This function modifies the file position indicator of the output .
*/ */
void write_block(custom_io &io, uintmax_t data_offset, void write_block(custom_io &io, uintmax_t data_offset,
const uintmax_t *lower_coordinates, const uintmax_t *higher _coordinates, const uintmax_t *lower_coordinates, const uintmax_t *higher _coordinates,
const void *block) const throw (exception) const void *block) const
{ {
gta_result_t r = gta_write_block(_header, data_offset, gta_result_t r = gta_write_block(_header, data_offset,
lower_coordinates, higher_coordinates, block, lower_coordinates, higher_coordinates, block,
write_custom_io, seek_custom_io, reinterpret_cast<intpt r_t>(&io)); write_custom_io, seek_custom_io, reinterpret_cast<intpt r_t>(&io));
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot write GTA data block", static_cast< gta::result>(r)); throw exception("Cannot write GTA data block", static_cast< gta::result>(r));
} }
} }
/** /**
* \brief Write an array block. * \brief Write an array block.
* \param os Output stream. * \param os Output stream.
* \param data_offset Offset of the first data byte. * \param data_offset Offset of the first data byte.
* \param lower_coordinates Coordinates of the lower corner ele ment of the block. * \param lower_coordinates Coordinates of the lower corner ele ment of the block.
* \param higher_coordinates Coordinates of the higher corner el ement of the block. * \param higher_coordinates Coordinates of the higher corner el ement of the block.
* \param block Block buffer. * \param block Block buffer.
* *
* This function modifies the file position indicator of the output . * This function modifies the file position indicator of the output .
*/ */
void write_block(std::ostream &os, uintmax_t data_offset, void write_block(std::ostream &os, uintmax_t data_offset,
const uintmax_t *lower_coordinates, const uintmax_t *higher _coordinates, const uintmax_t *lower_coordinates, const uintmax_t *higher _coordinates,
const void *block) const throw (exception) const void *block) const
{ {
ostream_io io(os); ostream_io io(os);
gta_result_t r = gta_write_block(_header, data_offset, gta_result_t r = gta_write_block(_header, data_offset,
lower_coordinates, higher_coordinates, block, lower_coordinates, higher_coordinates, block,
write_custom_io, seek_custom_io, reinterpret_cast<intpt r_t>(&io)); write_custom_io, seek_custom_io, reinterpret_cast<intpt r_t>(&io));
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot write GTA data block", static_cast< gta::result>(r)); throw exception("Cannot write GTA data block", static_cast< gta::result>(r));
} }
} }
/** /**
* \brief Write an array block. * \brief Write an array block.
* \param f Output C stream. * \param f Output C stream.
* \param data_offset Offset of the first data byte. * \param data_offset Offset of the first data byte.
* \param lower_coordinates Coordinates of the lower corner ele ment of the block. * \param lower_coordinates Coordinates of the lower corner ele ment of the block.
* \param higher_coordinates Coordinates of the higher corner el ement of the block. * \param higher_coordinates Coordinates of the higher corner el ement of the block.
* \param block Block buffer. * \param block Block buffer.
* *
* This function modifies the file position indicator of the output . * This function modifies the file position indicator of the output .
*/ */
void write_block(FILE *f, uintmax_t data_offset, void write_block(FILE *f, uintmax_t data_offset,
const uintmax_t *lower_coordinates, const uintmax_t *higher _coordinates, const uintmax_t *lower_coordinates, const uintmax_t *higher _coordinates,
const void *block) const throw (exception) const void *block) const
{ {
gta_result_t r = gta_write_block_to_stream(_header, data_offset , gta_result_t r = gta_write_block_to_stream(_header, data_offset ,
lower_coordinates, higher_coordinates, block, f); lower_coordinates, higher_coordinates, block, f);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot write GTA data block", static_cast< gta::result>(r)); throw exception("Cannot write GTA data block", static_cast< gta::result>(r));
} }
} }
/** /**
* \brief Write an array block. * \brief Write an array block.
* \param fd Output file descriptor. * \param fd Output file descriptor.
* \param data_offset Offset of the first data byte. * \param data_offset Offset of the first data byte.
* \param lower_coordinates Coordinates of the lower corner ele ment of the block. * \param lower_coordinates Coordinates of the lower corner ele ment of the block.
* \param higher_coordinates Coordinates of the higher corner el ement of the block. * \param higher_coordinates Coordinates of the higher corner el ement of the block.
* \param block Block buffer. * \param block Block buffer.
* *
* This function modifies the file position indicator of the output . * This function modifies the file position indicator of the output .
*/ */
void write_block(int fd, uintmax_t data_offset, void write_block(int fd, uintmax_t data_offset,
const uintmax_t *lower_coordinates, const uintmax_t *higher _coordinates, const uintmax_t *lower_coordinates, const uintmax_t *higher _coordinates,
const void *block) const throw (exception) const void *block) const
{ {
gta_result_t r = gta_write_block_to_fd(_header, data_offset, gta_result_t r = gta_write_block_to_fd(_header, data_offset,
lower_coordinates, higher_coordinates, block, fd); lower_coordinates, higher_coordinates, block, fd);
if (r != GTA_OK) if (r != GTA_OK)
{ {
throw exception("cannot write GTA data block", static_cast< gta::result>(r)); throw exception("Cannot write GTA data block", static_cast< gta::result>(r));
} }
} }
/*@}*/ /*@}*/
}; };
/** /**
* \name Version information * \name Version information
*/ */
 End of changes. 208 change blocks. 
197 lines changed or deleted 245 lines changed or added


 gta_version.h   gta_version.h 
/* /*
* gta_version.h * gta_version.h
* *
* This file is part of libgta, a library that implements the Generic Tagge d * This file is part of libgta, a library that implements the Generic Tagge d
* Array (GTA) file format. * Array (GTA) file format.
* *
* Copyright (C) 2010 Martin Lambers <marlam@marlam.de> * Copyright (C) 2010, 2011
* Martin Lambers <marlam@marlam.de>
* *
* Libgta is free software: you can redistribute it and/or modify it under the * Libgta is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free * terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 2.1 of the License, or (at your opti on) * Software Foundation, either version 2.1 of the License, or (at your opti on)
* any later version. * any later version.
* *
* Libgta is distributed in the hope that it will be useful, but WITHOUT AN Y * Libgta is distributed in the hope that it will be useful, but WITHOUT AN Y
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNES S FOR * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNES S FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details. * details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Libgta. If not, see <http://www.gnu.org/licenses/>. * along with Libgta. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef GTA_VERSION_H #ifndef GTA_VERSION_H
#define GTA_VERSION_H #define GTA_VERSION_H
#define GTA_VERSION "0.9.3" #define GTA_VERSION "0.9.4"
#define GTA_VERSION_MAJOR 0 #define GTA_VERSION_MAJOR 0
#define GTA_VERSION_MINOR 9 #define GTA_VERSION_MINOR 9
#define GTA_VERSION_PATCH 3 #define GTA_VERSION_PATCH 4
#define GTA_VERSION_NUMBER 0x000903 #define GTA_VERSION_NUMBER 0x000904
#endif #endif
 End of changes. 3 change blocks. 
4 lines changed or deleted 5 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/