/**************************************************************************
 * Source Id :
 *
 * $Id: dclient.h,v 1.1 2001/04/03 20:10:26 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 :
 *     Defines a multi diamondBase object in the client for the
 *     multi-db
 *  Original Author : daz.
 *
 **************************************************************************/

#ifndef __DB_DCLIENT_H__
#define __DB_DCLIENT_H__

#include <diamond/defs.h>
#include <diamond/dcdefs.h>
#include <diamond/dberr.h>
#include <diamond/bucket.h>
#include <diamond/nserver.h>

// Message ids for communication between clients and server

// Dummy class defintion - the
// single user version allows data to be registered with the
// dbObjs - but we aren't premitting this in the multi user
// version. But, it's a defined part of the diamondBase interface
// unfortunately, so we must provide it.

class dbObjData {
	public:
};

//
// We don't really want to have a name server, but we need it to
// keep the structs laid out the same way.
//

class diamondBase  : public TNameServer
{
	public:
		enum transId {ti_add,ti_del,ti_begin,ti_end,ti_get,ti_put,ti_extract,
			ti_seekFirst,ti_first,ti_next,ti_prev,ti_seekLast,ti_last,
			ti_peekNext,ti_peekPrev,ti_seek,ti_find,ti_stats,ti_write};

		char* verStr(void);
		char* version(bool full = false);
		diamondBase(char* name = 0);
		dbError detach(const int32 refId);
//		dbError attach(const char* name, object* resBuffer, int32& refId,
//			dbObjData *&);

			dbError attach(dbString& name, DIA_object* resBuffer, int32& refId, 
				dbObjData* & objData);


		dbError trans(const int32 refId, const transId id, const int32 idx=0);
		int32 intTrans(const int32 refId, const transId id, const int32 idx=0);
		~diamondBase();

		bool resizeMem(int32 newSize);

	private:
		int32	msqId; // Id for connection to server
		int32	shmId; // Id for memory transfer to server
		int32	ftokVal; // value from ftok
		int32	sendChannel;
		int32	recChannel;
		void	sendLong(int32);
		bool	sendMess(void *,int32 len,int32 chan=-1);
		bool	recMess(void *,int32 len);
		char	*transArea; // Data transfer area to server.
};

#endif

///////////////////////////////////////////////////////////////////////////
// Revision History:
//
// $Log: dclient.h,v $
// Revision 1.1  2001/04/03 20:10:26  aleksandras
// big one 3.1 (comments later)
//
// Revision 1.11  1996/02/02  14:37:02  dmb
// fixed some compilation errors.
//
// Revision 1.10  1996/01/30  21:44:58  dmb
// -> int32.
//
// Revision 1.9  1994/12/13  06:59:51  kevinl
// prototype, removed default in function definition
//
// Revision 1.8  1994/09/30  07:38:37  darrenp
// Changed to include TNameserver into diamondBase class.
//
// Revision 1.7  1994/09/09  08:50:46  darrenp
// Updates to new version of engine for 0.3 release.
//
// Revision 1.6  1994/02/03  05:54:19  kevinl
// Moved include files to diamond/ and fixed HAVE_MALLOC_H
//
// Revision 1.5  1993/10/13  10:26:28  daz
// *** empty log message ***
//
// Revision 1.4  1993/07/21  14:25:42  daz
// *** empty log message ***
//
// Revision 1.3  1993/07/04  16:08:03  daz
// *** empty log message ***
//
// Revision 1.2  1993/07/04  13:42:19  daz
// *** empty log message ***
//
// Revision 1.1  1993/07/04  02:21:13  daz
// Initial revision
//
///////////////////////////////////////////////////////////////////////////
