#ifndef H_ED_CNT_20030711133132
#define H_ED_CNT_20030711133132

#ifdef __cplusplus
extern "C"
{
#endif

/* ---------------------------------------------------------------------
   (c) ED 2003
   Project      : CLIB
   Function     : Counter with saturation and max memory
   Module       : CNT
   File         : cnt.h
   Created      : 11-07-2003
   Modified     : 11-07-2003
   --------------------------------------------------------------------- */

/* ---------------------------------------------------------------------
   Log

   0.0 11-07-2003 Created
   1.0 11-07-2003 Initial version

   --------------------------------------------------------------------- */
#include "ed/inc/types.h"

/* macros ============================================================== */

/* constants =========================================================== */

   typedef enum
   {
      CNT_OK,

#define ITEM(n_, s_)\
   CNT_ERR_##n_,

#include "ed/inc/cnt_err.itm"

#undef ITEM

      CNT_ERR_NB
   }
   cnt_err_e;

/* types =============================================================== */

/* structures ========================================================== */

   typedef struct
   {
      ulong count;
      ulong mem_max;            /* memoire du max */

      ulong cnt_max;            /* valeur max */
      uint full:1;
      uint empty:1;
   }
   cnt_s;

/* functions =========================================================== */

/* Identification */
   char const *cnt_sid (void);
   char const *cnt_sver (void);

/* Initialisation */
   cnt_err_e cnt_init (cnt_s * this, ulong max);

/* Input functions */
   cnt_err_e cnt_inc (cnt_s * this);
   cnt_err_e cnt_dec (cnt_s * this);
   cnt_err_e cnt_rst (cnt_s * this);

#ifdef __cplusplus
}
#endif

/* ---------------------------------------------------------------------
   Generated by NEW (c) ED 2.1
   Powered by C-code generator (c) ED 2003 1.0
   --------------------------------------------------------------------- */

#endif                          /* guard */
