/*
 *  Copyright 1992 Science Applications International Corporation.
 */

/*
 * NAME    
 *	gdi_doi.h
 *
 * SYNOPSIS
 *      Contains defines and function prototypes for the Generic Database
 *	Interface support of the Dynamic Object Interface
 *
 * DESCRIPTION
 *
 *
 * DIAGNOSTICS
 *
 *
 * FILES
 *
 *
 * SEE ALSO
 *
 *
 * AUTHOR
 *	B. MacRitchie, June 26, 1992
 *
 *
 * MODIFICATIONS
 *
 */

/*
 *	SccsId:  @(#)gdi_doi.h	1.2 10/9/92 SAIC
 */

#ifndef _GDI_DOI_H_
#define _GDI_DOI_H_

#include "libgendb.h"

extern dbConstr GDI_GOBJ;


/*
 * definition of Gobj Tuple
 */

typedef	union 
{
     double	double_val;
     long	long_val;
     char	char_val;
     char	*string;
     void	*ptr;
} gobjValue;

typedef	struct
{
     char	name [GDI_MAX_NAME];
     char	dbtype_s [GDI_MAX_TYPE];
     int	ctype;
     int	length;
     int	is_null;
     gobjValue	value;
} gobjCol;

typedef	struct
{
     int	n_columns;
     gobjCol	*col;
} GObj;


/*
 * macros and prototypes for accessing a Gobj
 */

#define GDI_GOBJ_NUM_COLUMNS(gobj)		((gobj)->n_columns)
#define GDI_GOBJ_NAME(gobj, col_num)		((gobj)->col[col_num].name)
#define GDI_GOBJ_DBTYPE_S(gobj, col_num)	((gobj)->col[col_num].dbtype_s)
#define GDI_GOBJ_CTYPE(gobj, col_num)		((gobj)->col[col_num].ctype)
#define GDI_GOBJ_LENGTH(gobj, col_num)		((gobj)->col[col_num].length)
#define GDI_GOBJ_IS_NULL(gobj, col_num)		((gobj)->col[col_num].is_null)
#define GDI_GOBJ_VALUE(gobj, col_num)		(&((gobj)->col[col_num].value))

#define GDI_GOBJ_VALUE_INT(value)		((int)((value)->long_val))
#define GDI_GOBJ_VALUE_LONG(value)		((long)((value)->long_val))
#define GDI_GOBJ_VALUE_FLOAT(value)		((float)((value)->double_val))
#define GDI_GOBJ_VALUE_DOUBLE(value)		((double)((value)->double_val))
#define GDI_GOBJ_VALUE_CHAR(value)		((char)((value)->char_val))
#define GDI_GOBJ_VALUE_STRING(value)		((char*)((value)->string))
#define GDI_GOBJ_VALUE_PTR(value)		((void*)((value)->ptr))


#endif






