#ifndef __H_DEFS__
#define __H_DEFS__

/**@file
 * Definitions of different function primaries and other things that may be of
 * use.
 */


/**
 * <tt>BEGIN_DECLS</tt> and <tt>END_DECLS</tt> is are utility macros
 * wrapping <tt>extern "C"</tt> for using C headers with C++ code.
 *
 * @code {.c}
// Foo.h
#ifndef H_FOO
#define H_FOO

BEGIN_DECLS

// Code does here

END_DECLS

#endif
  @endcode
 */
#ifdef __cplusplus
#define BEGIN_DECLS extern "C" {
#else
#define BEGIN_DECLS
#endif /*__cplusplus*/

/**
 * See <tt> BEGIN_DECLS </tt>.
 */
#ifdef __cplusplus
#define END_DECLS }
#else
#define END_DECLS
#endif /* __cplusplus */

BEGIN_DECLS

/**
 * Represents a pointer. Nothing special with it, just a pointer...
 */
typedef void * _pointer;

/**
 * Represents a constant pointer, again nothing special about it.
 */
typedef const void * const_pointer;

/**
 * Represents a for each function.
 * 
 * @param self The data structure that is responsible for "holding" the data,
 *             this may be a \c DynamicArray or a \c LinkedList.
 * @param item the data to be passed to the each iteration.
 * @returns data to be put in a new instance of the data structure, if used with
            a function that does this, like
            <tt>dynamic_array_for_each_with_return</tt>
            or some other data structure like a \c DynamicArray.
 */
typedef void * (* ForEachFunc)(_pointer self, _pointer item, _pointer data);

/**
 * Represents a function to be used when freeing some item in a dynamic array.
 *
 * @param obj The object to be freed.
 */
typedef void * (* FreeFunc)(_pointer obj);

END_DECLS

#endif /* __H_DEFS__ */
