/****************************************************************** 
 *
 * keysclass.h --
 *
 *     Store keys and keyset information. Hide details of
 *     algorithm to find a key from its name.
 *
 *
 * $Author: mstoufer $
 * $Source: /home/g2/src/projects/NetLogger/src/nlv/keysclass.h,v $
 * $RCSfile: keysclass.h,v $
 * $Revision: 1.1.1.1 $
 * $Locker:  $
 * $Date: 2000/12/05 19:52:32 $
 *
 ****************************************************************** 
 */
#ifndef NLV_KEYS_INCLUDED
#define NLV_KEYS_INCLUDED

#include <string.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <tcl.h>
#include "structs.h"


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

#define T Nlv_ky
typedef struct T *T;

#define NLV_MAX_ALIAS 8

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

T              Nlv_kyNew( );
void           Nlv_kyFromFile( T, char *fname );
int            Nlv_kytoFile( T, char *clname );
Nlv_Key       *Nlv_kyGetKey( T, char *name );
Nlv_KeySet    *Nlv_kyGetKeySet( T, char *nm );
void           Nlv_kyKeysToTcl( T );
void           Nlv_kyKeysFromTcl( T );
void           Nlv_kyClearKeys( T );

int            Nlv_kyGetNumKeys( T );
int            Nlv_kyGetNumKeySets( T );
Tcl_HashTable *Nlv_kyGetKeySetTbl( T );
Tcl_HashTable *Nlv_kyGetKeyTbl( T );
char          *Nlv_kyGetHostAlias( T, char *nm );
int            Nlv_kyGetCalcShow( T, Nlv_KeySet *ks, char *calcName );
void           Nlv_kySetTitle( T, char* newTitle );

Nlv_KeySet   * Nlv_kyAddKeySet( T,
				char *setName,
				int   gtype,
				int   index,
				int numids,
				char **ids,
				int    numhosts,
				char **hosts,
			        int    numanns,
			        char **anns,
				char  *valField,
				double vMin,
				double vMax,
				Nlv_CalcParam *ksCalcParams,
				int ksCalcParamNum,
                                int rotateClients,
                                int timeordered,
				int autoscale );
void          Nlv_kyAddKey( T this,
			    Nlv_KeySet* inSet,
			    char *keyName );
void          Nlv_kyAddUserCalc( T, Nlv_KeySet *ks,
				 char *str,
				 Nlv_CalcVar *vars );
void          Nlv_kyAddHostalias( T,
				  int n,
				  char **strlist,
				  char *alias_target );
#undef T
#endif
