/****************************************************************** 
 *
 * clusterclass.h
 *
 *     Interface for cluster.
 *
 *
 * Created: 15 July 1998
 * $Author: mstoufer $
 * $Date: 2000/12/05 19:52:33 $
 * $Id: clusterclass.h,v 1.1.1.1 2000/12/05 19:52:33 mstoufer Exp $
 *
 *
 ****************************************************************** 
 */

#include <stdio.h>
#include <math.h>
#include "structs.h"  /* program-wide structures, definitions */
#include "errclass.h" /* error-reporting                      */

#ifndef NLV_CLUSTER_INCLUDED
#define NLV_CLUSTER_INCLUDED

/*========= CONSTANTS =================================================*/

#define NLV_MAX_CLUSTERLINES 32
#define NLV_MAX_POINTS 64
#define NLV_MAX_CLIENTS 32

/*========= DATA =====================================================*/

extern Nlv_err eobj; /* Error reporting object, from "main.c" */

struct Nlv_cr;
#define T Nlv_cr
typedef struct T *T;
typedef struct clusterData {
  double time;
  Nlv_LData *arr[ NLV_MAX_CLUSTERLINES ];
} clusterData;

typedef struct clusterNode {
  clusterData data;
  int         size;
  int         isFull;
  int         client;
  struct clusterNode * prevCl, * nextCl;
  struct clusterNode * nextQ;
} clusterNode;

/*========= FUNCTIONS ================================================*/

T             Nlv_crNew();
void          Nlv_crAddData( T, int client, Nlv_LData *d );
void          Nlv_crScan( T, double scanTime );
clusterNode * Nlv_crRemoveFull( T );
double        Nlv_crGetEpsilon( T );
int           Nlv_crGetMaxCluster( T );
void          Nlv_crSetEpsilon( T, double epsil );
void          Nlv_crSetMaxCluster( T, int max );

#undef T
#endif
