/**************************************************************************
 * Source Id :
 *
 * $Id: cserver.h,v 1.1 2001/04/03 20:10:25 aleksandras Exp $
 *-------------------------------------------------------------------------
 * Project Notes :
 *
 *  Diamond Base
 *  ============
 *      A solid database implementation, spurred on by the continuing
 *  Metal (Lead) Base saga.
 *
 *  Project Team :
 *        A. Davison
 *        K. Lentin
 *        D. Platt
 *
 *	Project Commenced : 05-02-1993
 *
 *-------------------------------------------------------------------------
 *  Module Notes :
 *
 *  Client server interface.  Used to build other multiple user interfaces
 *
 *  Original Author : Darren Platt
 *
 **************************************************************************/

#ifndef CSERV_INCL
#define CSERV_INCL

//
// Definitions for a layer to support client server implementations
//

//
// We need to be able to validate that a given client id is legal
// We also need to be able to ensure that a given relId beint32s to
// the right client.
// Finally we want to be able to find all the relation ids/pointer pairs
// when a given client exits.
// 
// Define a client structure that has a hash table mapping all the
// relation ids onto their associated diaGRel pointers.
//
// Have a global hash table that maps the client ids onto these client
// structures.
//
// If someone wants to create a client, they create one of the following
// structures.  It provides them with a safe mechanism for creating relations
// and destroying them.  When they delete their client instance, it cleans
// up after them.
//

#include <diamond/hash.h>
#include <diamond/diarel.h>
#include <diamond/hash.h>

class DiaClient {

		// Hash table definition mapping relId -> diaGRel pointer
		DiaHash relIdLookup;

	public:

		DiaClient();
		virtual ~DiaClient();

		diaRel *createRel(const char *relName);
		void deleteRel(diaRel *theObject);
		diaRel *findRel(int relId);
};


#endif
