/****************************************************************************
**  SIONLIB     http://www.fz-juelich.de/jsc/sionlib                       **
*****************************************************************************
**  Copyright (c) 2008-2019                                                **
**  Forschungszentrum Juelich, Juelich Supercomputing Centre               **
**                                                                         **
**  See the file COPYRIGHT in the package base directory for details       **
****************************************************************************/

/* *INDENT-OFF* */
/* clang-format off */

/*!
 * \ingroup constants
 * @{
 */

#ifndef SION_SION_CONST_H
#define SION_SION_CONST_H

/* return codes for functions signaling success */
#define SION_SUCCESS 1
#define SION_NOT_SUCCESS 0

/* return codes for functions signaling success (used in for callback functions) */
#define SION_STD_SUCCESS 0
#define SION_STD_NOT_SUCCESS 1

/* return codes for functions returning identifier (sid)  */
#define SION_SMALLEST_VALID_ID 0
#define SION_ID_UNDEF -1
#define SION_ID_NOT_VALID -1
#define SION_UNKNOWN -1
#define SION_AUTOMATIC -1

/* return codes for functions returning size information */
#define SION_SIZE_NOT_VALID -1

/* return codes for functions wrapping fwrite/fread */
#define SION_ANSI_SIZE_NOT_VALID 0

/* SION version information */
/// \brief the major version number
#define SION_VERSION_MAJOR 2
/// \brief the minor version number
#define SION_VERSION_MINOR 0
/// \brief the patch level
#define SION_VERSION_PATCH 0
/// \brief alias for `SION_VERSION_MAJOR`
#define SION_MAIN_VERSION  SION_VERSION_MAJOR
/// \brief alias for `SION_VERSION_MINOR`
#define SION_SUB_VERSION SION_VERSION_MINOR
/// \brief alias for `SION_VERSION_PATCH`
#define SION_VERSION_PATCHLEVEL SION_VERSION_PATCH

/* file format version history:
   3 -> startpointer are calculated by chunksize
        and fsblksize, --> alignment
   4 -> chunksize will be expanded for aligning
        up to sionlib version 1.4
   5 -> able to store key value data
   6 -> remove metadata block at end of file */
#define SION_FILEFORMAT_VERSION 6

#ifndef SVN_REV
/* include Makefile.svnrev in Makefile and add
     CFLAGS += -DSVN_REV='"$(SVN_REV)"'
   to enable SVN_REV */
#define SVN_REV "Unknown"
#endif
#define SION_SVN_VERSION SVN_REV

#define SION_LVERSION_PREFIX ""

/* SION constants */
/** \brief Alias for the current rank */
#define SION_CURRENT_RANK -101
/** \brief Alias for the current block */
#define SION_CURRENT_BLK -102
/** \brief Alias for the current block */
#define SION_CURRENT_CHUNK -102
/** \brief Alias for the current block */
#define SION_CURRENT_BLOCK -102
/** \brief Alias for the current position in the current block */
#define SION_CURRENT_POS -103
/** \brief Alias for the flag to specify in sion_seek an absolute position in bytestream */
#define SION_ABSOLUTE_POS -104
/** \brief Flag in sion_seek for a position relative to end */
#define SION_END_POS -105

/* for sion_dup */
/** \brief dup meta data for all ranks&keys */
#define SION_DUP_ALL -201
/** \brief dup meta data only for one rank and all keys */
#define SION_DUP_RANK -202
/** \brief dup meta data only for one rank and one key */
#define SION_DUP_RANK_KEY -203

/* for key value */
/** \brief no Key-Value Pairs in Chunks */
#define SION_KEYVAL_NONE 50
/** \brief use inline records to store key-value */
#define SION_KEYVAL_INLINE 51
/** \brief use meta data block to store keys/len */
#define SION_KEYVAL_META 52
/** \brief use hash data structure to store key-value */
#define SION_KEYVAL_HASH 53
/** \brief type UNKNOWN */
#define SION_KEYVAL_UNKNOWN 54
/** \brief no Key-Value Pairs in Chunks */
#define SION_KEYVAL_NOTSET 55

/* for callback routines of generic interface */
/** \brief a 32 bit signed integer */
#define _SION_INT32 10
/** \brief a 64 bit signed integer */
#define _SION_INT64 11
/** \brief a character */
#define _SION_CHAR 12

/* role of task, for sion_get_io_info  */
#define SION_ROLE_NONE 0
#define SION_ROLE_COLLECTOR 1
#define SION_ROLE_SENDER 2
#define SION_ROLE_WRITER 4
#define SION_ROLE_NOWRITER 8
#define SION_ROLE_READER 16
#define SION_ROLE_NOREADER 32
#define SION_ROLE_COLLECTOR_READER 64

/* flag for for sion_get_io_info_spec  */
#define SION_GET_IO_INFO_FLAG_NONE 0

#endif

/** @} */

/* clang-format on */
/* *INDENT-ON* */
