/* %Z%%M% %I% %E% */

/*
 * Copyright (c) 1992, 1995 by Wayne C. Gramlich.
 * All rights reserved.
 *
 * Permission to use, copy, modify, distribute, and sell this software
 * for any purpose is hereby granted without fee provided that the above
 * copyright notice and this permission are retained.  The author makes
 * no representations about the suitability of this software for any purpose.
 * It is provided "as is" without express or implied warranty.
 */

/* This file defines the object data structures: */

#ifndef OBJECT_DEFS_H
#define OBJECT_DEFS_H

#ifndef HEAP_TYPES_H
#include "heap_types.h"
#endif

#ifndef MSG_TYPES_H
#include "msg_types.h"
#endif

#ifndef OBJECT_EXPORTS_H
#include "object_exports.h"
#endif

#ifndef TABLE_TYPES_H
#include "table_types.h"
#endif

#ifndef TYPE_TYPES_H
#include "type_types.h"
#endif

struct Object_struct {
	Str		name;		/* Object name (key */
	Type_ref	type_ref;	/* Object type (key */
	Type_def	type_def;	/* Type definition */
	Vec(Object_need) static_needs;	/* Needed static types */
	Object_entry	object_entry;	/* Corresponding object entry */
	Vec(Object_need) parameter_needs; /* Needed parameterized types */
};

struct Object_need_struct {
	Str		name;
	Type_ref	type_ref;
	Str		field_name;
};

struct Object_entry_struct {
	Str		name;		/* Object name (key */
	Type_ref	type_ref;	/* Object type (key */
	Type_ref	actual_type_ref; /* Actual object type */
	int		deleted;	/* 1 => deleted */
	Vec(Object_ref)	object_refs;	/* List of associated Object_ref's */
	int		defined;	/* 1 => defined in this module */
};

struct Object_ref_struct {
	Str		name;		/* Object name (key */
	Type_ref	type_ref;	/* Object type name (key */
	Type_ref	actual_type_ref; /* Actual type of object reference */
	int		deleted;	/* 1 => deleted */
	Object_entry	object_entry;	/* Associated object entry */
	int		used;		/* 1 => object actually used */
};

struct Object_table_struct {
	Heap		heap;
	Object_entry	entry_key;
	Table(Object_entry, Object_entry) entry_table;
	Msg		msg;
	Vec(Object_entry) object_entrys;
	Vec(Object)	objects;
	Object_ref	ref_key;
	Table(Object_ref, Object_ref) ref_table;
	Type_tables	type_tables;
};

#endif /* OBJECT_DEFS_H */
