#ifdef __PRIVATE__
//#
//#	File:		CMSU.idl
//#
//#	Contains:	Definition of CMStorageUnit
//#
//#	Written by:	Vincent Lo
//#
//#	Copyright:	c 1994 by Apple Computer, Inc., all rights reserved.
//#
//#	Change History (most recent first):
//#
//#		 <8>	  9/1/94	VL		1183174: Removed Clone and GetClonedIDs.
//#		 <7>	 8/26/94	VL		1183174: Removed CloneTo.
//#		 <6>	 8/11/94	VL		1180299: Added CreateCursor.
//#		 <5>	 7/26/94	VL		Removed helper functions for promise
//#									resolution.
//#		 <4>	  7/5/94	VL		Fixed inout. Added a few calls to get/set
//#									value, property.
//#		 <3>	 6/22/94	VL		Added functionprefix.
//#		 <2>	 6/15/94	RR		ODHeap -> ODMemoryHeap
//#		 <1>	  6/8/94	VL		first checked in
//#
//#	To Do:
//#
#else
//#	Copyright:	c 1993-1994 by Apple Computer, Inc., all rights reserved.
#endif

#ifndef _CMSU_
#define _CMSU_

#ifndef _STORAGEU_
#include "StorageU.idl"
#endif

//==============================================================================
// Classes defined in this interface
//==============================================================================
interface   CMStorageUnit;

//==============================================================================
// Classes used by this interface
//==============================================================================
interface	CMDraft;

//=====================================================================================
// Implementation Types
//=====================================================================================

#ifdef __PRIVATE__
typedef somToken CMContainer;
typedef somToken AEHashTable;
typedef somToken CMValue;
typedef somToken CMProperty;
typedef somToken CMObject;
typedef somToken CMObjectID;
typedef somToken CMType;
typedef somToken ODMemoryHeapID;
typedef somToken PromiseResolver;
#endif

//==============================================================================
// CMStorageUnit
//==============================================================================

interface CMStorageUnit :  ODStorageUnit
{
#ifdef __PRIVATE__

	void		SetChangedFromPrevFlag(in ODBoolean changed);
	
	CMContainer	GetCMContainer();

	void				CleanupAndFail(in ODError	err);
	
	ODStorageUnitRef 	GetStorageUnitRef(in ODStorageUnitID embeddedSUID,
											in ODBoolean strong);
											
	ODStorageUnitRef	GetNextStorageUnitRef();
	
	ODStorageUnitRef 	SetStorageUnitRef(in ODStorageUnitID embeddedSUID,
											in ODStorageUnitRef ref);

// Private by convention

	ODMemoryHeapID		GetHeap();
	
	ODID		GetObjectID();
		
	CMValue		GetCurValue();
	
	void		SetCurValue(in CMValue curValue);
	
	CMProperty	GetCurProperty();

	CMType		GetCurType();

	void		SetCurType(in CMType curType);

	CMObject	GetObject();

#endif

#ifdef __SOMIDL__
	implementation
	{
	  	functionprefix = CMStorageUnit;
		
		override:
			somInit,
			somUninit,
			IncrementRefCount,
			Release,
			Purge,
			InitStorageUnit,
			GetDraft,
			GetSession,
			Exists,
			ExistsWithCursor,
			CountProperties,
			CountValues,
			Focus,
			FocusWithCursor,
			Externalize,
			Internalize,
			GetID,
			GetName,
			SetName,
			AddProperty,
			AddValue,
			Remove,
			CopyTo,
			CloneInto,
			CreateView,
			CreateCursor,
			CreateCursorWithFocus,
			GetProperty,
			GetType,
			SetType,
			SetOffset,
			GetOffset,
			GetValue,
			GetULongValue,
			SetValue,
			SetULongValue,
			InsertValue,
			DeleteValue,
			GetSize,
			IsValidStorageUnitRef,
			GetStrongStorageUnitRef,
			GetWeakStorageUnitRef,
			IsStrongStorageUnitRef,
			IsWeakStorageUnitRef,
			RemoveStorageUnitRef,
			GetIDFromStorageUnitRef,
			CreateStorageUnitRefIterator,
			GetGenerationNumber,
			IncrementGenerationNumber,
			IsPromiseValue,
			SetPromiseValue,
			GetPromiseValue,
			ClearAllPromises,
			ResolveAllPromises,
			Lock,
			Unlock;
		releaseorder:
			SetChangedFromPrevFlag,
			GetCMContainer,
			CleanupAndFail,
			GetStorageUnitRef,
			GetNextStorageUnitRef,
			SetStorageUnitRef,
			GetHeap,
			GetObjectID,
			GetCurValue,
			SetCurValue,
			GetCurProperty,
			GetCurType,
			SetCurType,
			GetObject;
			
	#ifdef __PRIVATE__
		passthru C_xh =
			""
			"#include <CMAPI.h>"
			"#include <ODMemory.h>"
			"class AEHashTable;"
			"class PromiseResolver;"
			"";

		CMContainer			fCMContainer;
		CMObject			fObject;
		CMDraft				fDraft;
		ODStorageUnitID		fID;	
		CMObjectID			fObjectID;
		CMProperty			fCurProperty;
		ODBoolean			fHasPropertyLooped;
		ODValueIndex		fCurValueIndex;
		CMValue				fCurValue;
		ODValueType			fCurValueType;
		ODULong				fOffset;
		CMType				fCurType;
		ODBoolean			fHasValueLooped;
		
		ODULong				fCurrentKey;
		ODULong				fLockCount;
		
		ODULong				fCurrentSURef;
		
		ODMemoryHeapID		fHeap;

		PromiseResolver*	fPromiseResolver;

	#endif
	};
#endif
};

#endif  // _CMSU_

