/****************************************************************** 
 *
 * indexclass.h --
 *
 *     Interface to index-file that goes with a log file.
 *
 *
 * $Author: mstoufer $
 * $Source: /home/g2/src/projects/NetLogger/src/nlv/indexclass.h,v $
 * $RCSfile: indexclass.h,v $
 * $Revision: 1.1.1.1 $
 * $Locker:  $
 * $Date: 2000/12/05 19:52:32 $
 *
 ****************************************************************** 
 */
#ifndef NLV_INDEX_INCLUDED
#define NLV_INDEX_INCLUDED

#include <unistd.h>
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <sys/times.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <math.h>
#include <pthread.h>
#include <tcl.h>
#include "errclass.h"
#include "util.h"
#include "structs.h"
#include "fileclass.h"

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

#define T Nlv_ix
typedef struct T *T;

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

T      Nlv_ixNew();
int    Nlv_ixInit( T, double ival, double d_ival, char *fname );
int    Nlv_ixOpen( T, char *logfile );
void   Nlv_ixCleanup( void *this );
void   Nlv_ixSetStart( T, double time );
void   Nlv_ixSetIncrement( T, double s );
long   Nlv_ixGetPosition( T, double time );
long   Nlv_ixGetLastPosition( T this );
int    Nlv_ixNeedsAppend( T this, double t );
int    Nlv_ixAppend( T, long pos );
int    Nlv_ixWasStale( T );
double Nlv_ixGetLastTime( T );
long   Nlv_ixGetIncrement( T );
void * Nlv_ixRun( void * args );
void   Nlv_ixStop( T );
char  *Nlv_ixIndexTimeAddr( T t);
/* showing where the indexer is right now */
double Nlv_ixGetShowPos( T );
/* thread scheduling functions */
pthread_attr_t * Nlv_ixGetTattr( T );
void   Nlv_ixIncreasePriority( T );
void   Nlv_ixNormalPriority( T );
/* density arr functions */
long   Nlv_ixDGetHighest( T );
double Nlv_ixDTimeAtIndex( T, int index );
int    Nlv_ixDIndexAtTime( T, double reltime );
long   Nlv_ixDGetCount( T, int index );
long   Nlv_ixDGetTime( T, int index );
int    Nlv_ixDGetSize( T, double t );
void   Nlv_ixDSetWinHighest ( T, double t1, double t2 );
long   Nlv_ixDGetWinHighest( T );
/* jump time */
double Nlv_ixGetJumpTime( T );
void Nlv_ixClearJumpTime( T );

#undef T
#endif
