#ifdef __PRIVATE__
//#	File:		StorageU.idl
//#
//#	Contains:	Definition of ODStorageUnit.
//#
//#	Written by:	Vincent Lo
//#
//#	Copyright:	c 1993-1994 by Apple Computer, Inc., all rights reserved.
//#
//#	Change History (most recent first):
//#
//#		 <5>	 8/26/94	VL		1183174: Removed CloneTo.
//#		 <4>	 8/11/94	VL		1180299: Added CreateCursor and modified
//#									CreateView.
//#		 <3>	  7/5/94	VL		Fixed in/out.
//#		 <2>	 6/21/94	VL		Added functionprefix.
//#		 <1>	  6/8/94	VL		first checked in
//#
//#	To Do:
//#
#else
//#	Copyright:	c 1993-1994 by Apple Computer, Inc., all rights reserved.
#endif

#ifndef _STORAGEU_
#define _STORAGEU_

#ifndef _REFCTOBJ_
#include "RefCtObj.idl"
#endif

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

//==============================================================================
// Classes used by this interface
//==============================================================================
interface   ODDraft;
interface   ODSession;
interface   ODPart;
interface   ODStorageUnitCursor;
interface   ODStorageUnitView;
interface   ODStorageUnitRefIterator;

//==============================================================================
// ODStorageUnit
//==============================================================================

interface ODStorageUnit :  ODRefCntObject
{
	void InitStorageUnit(in ODDraft draft,
						in ODStorageUnitID suid);
	
	ODDraft		GetDraft();
	
	ODSession	GetSession();
	
	ODBoolean	Exists(in ODPropertyName propertyName,
					in ODValueType valueType,
					in ODValueIndex valueIndex);
	
	ODBoolean  ExistsWithCursor(in ODStorageUnitCursor cursor);
	
	ODULong  CountProperties();
	
	ODULong  CountValues();
	
	ODStorageUnit   Focus(in ODPropertyName propertyName,
							in ODPositionCode propertyPosCode,
							in ODValueType valueType,
							in ODValueIndex valueIndex,
							in ODPositionCode  valuePosCode);
	
	ODStorageUnit   FocusWithCursor(in ODStorageUnitCursor cursor);
		
	ODStorageUnit   Externalize();
	
	ODStorageUnit   Internalize();
	
	ODID      GetID();
	
	ODStorageUnitName GetName();
	
	void SetName(in ODStorageUnitName name);
	
	ODStorageUnit   AddProperty(in ODPropertyName propertyName);
	
	ODStorageUnit  AddValue(in ODValueType type);
	
	ODStorageUnit   Remove();
	
	void      CopyTo(in ODStorageUnit toSU);
	
	void      CloneInto(in ODDraftKey key,
						in ODStorageUnit destStorageUnit,
						in ODID scopeID);
	
	ODStorageUnitView   CreateView();
	
	ODStorageUnitCursor	CreateCursorWithFocus();
	
	ODStorageUnitCursor CreateCursor(in ODPropertyName propertyName,
									in ODValueType valueType,
									in ODValueIndex valueIndex);
	
	ODPropertyName  GetProperty();
	
	ODValueType  GetType();
	
	void      SetType(in ODValueType valueType);
	
	void      SetOffset(in ODULong offset);
	
	ODULong    GetOffset();
	
	ODULong    GetValue(in ODULong length,
						in ODValue value);

	ODULong    GetULongValue(in ODULong length,
							 in ODValue value);
	
	void      SetValue(in ODULong length,
					   in ODValue value);

	void      SetULongValue(in ODULong length,
						    in ODValue value);
	
	void      InsertValue(in ODULong length,
							in ODValue value);
	
	void      DeleteValue(in ODULong length);
	
	ODULong    GetSize();
	
	ODBoolean    IsValidStorageUnitRef(in ODStorageUnitRef aRef);
	
	ODStorageUnitRef  GetStrongStorageUnitRef(in ODStorageUnitID embeddedSUID);
	
	ODStorageUnitRef  GetWeakStorageUnitRef(in ODStorageUnitID embeddedSUID);
	
	ODBoolean    IsStrongStorageUnitRef(in ODStorageUnitRef ref);
	
	ODBoolean    IsWeakStorageUnitRef(in ODStorageUnitRef ref);
	
	ODStorageUnit   RemoveStorageUnitRef(in ODStorageUnitRef aRef);
	
	ODStorageUnitID  GetIDFromStorageUnitRef(in ODStorageUnitRef aRef);
	
	ODStorageUnitRefIterator  CreateStorageUnitRefIterator();
	
	ODULong      GetGenerationNumber();
	
	ODULong      IncrementGenerationNumber();
	
	ODBoolean  IsPromiseValue();
	
	void    SetPromiseValue(in ODValueType valueType,
							in ODULong offset,
							in ODULong length,
							in ODValue value,
				  			in ODPart sourcePart);
	
	ODULong  GetPromiseValue(in ODValueType valueType,
							in ODULong offset,
							in ODULong length,
							in ODValue value,
							out ODPart sourcePart);
	
	void    ClearAllPromises();
	
	void	ResolveAllPromises();
	
	ODStorageUnitKey  Lock(in ODStorageUnitKey key);
	
	void        Unlock(in ODStorageUnitKey key);
#ifdef __SOMIDL__
  implementation
  {
  	functionprefix = ODStorageUnit;
    override:
		somInit,
		somUninit,
		IncrementRefCount,
        Release,
        Purge;
    releaseorder:
        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;
  };
#endif
};

#endif  // _STORAGEU_

