/* @(#)Z 1.4 com/src/storage/idl/StorageU.idl, odstorage, od96nt, odnt9712d 97/03/21 16:48:53 (96/10/29 09:33:16) */


#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 
{
	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      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, out ODByteArray value);

	void      SetValue(in ODByteArray value);

	void      InsertValue(in ODByteArray value);

	void      DeleteValue(in ODULong length);

	ODULong    GetSize();

	ODBoolean    IsValidStorageUnitRef(in ODStorageUnitRef aRef);

	void GetStrongStorageUnitRef(in ODStorageUnitID embeddedSUID, out ODStorageUnitRef strongRef);

	void GetWeakStorageUnitRef(in ODStorageUnitID embeddedSUID, out ODStorageUnitRef weakRef);

	ODBoolean    IsStrongStorageUnitRef(in ODStorageUnitRef ref);

	ODBoolean    IsWeakStorageUnitRef(in ODStorageUnitRef ref);

	ODStorageUnit   RemoveStorageUnitRef(in ODStorageUnitRef aRef);

	ODStorageUnitID  GetIDFromStorageUnitRef(in ODStorageUnitRef aRef);

	ODStorageUnitRefIterator  CreateStorageUnitRefIterator();

	void 	SetStorageUnitRef(in ODStorageUnitID embeddedSUID,
											in ODStorageUnitRef ref);

	ODULong      GetGenerationNumber();

	ODULong      IncrementGenerationNumber();

	ODBoolean  IsPromiseValue();

	void    SetPromiseValue(in ODValueType valueType, 
							in ODULong offset,
							in ODByteArray value, 
				  			in ODPart sourcePart);

	ODULong  GetPromiseValue(in ODValueType valueType,
							in ODULong offset,
							in ODULong length,
							out ODByteArray value,
							out ODPart sourcePart);

	void    ClearAllPromises();

	void	ResolveAllPromises();

	ODStorageUnitKey  Lock(in ODStorageUnitKey key);

	void        Unlock(in ODStorageUnitKey key);
#ifdef __SOMIDL__
  implementation
  {
	majorversion = 1; minorversion = 0;
  	functionprefix = ODStorageUnit;
    override:
		somUninit,
		Acquire,
        Release,
        Purge;
    releaseorder:
		reserved1,
        GetDraft,
        GetSession,
        Exists,
        ExistsWithCursor,
        CountProperties,
        CountValues,
        Focus,
        FocusWithCursor,
        Externalize,
        Internalize,
        GetID,
        GetName,
        SetName,
        AddProperty,
        AddValue,
        Remove,
        CloneInto,
        CreateView,
        CreateCursor,
		CreateCursorWithFocus,
		GetProperty,
        GetType,
        SetType,
        SetOffset,
        GetOffset,
        GetValue,
        SetValue,
        InsertValue,
        DeleteValue,
        GetSize,
        IsValidStorageUnitRef,
        GetStrongStorageUnitRef,
        GetWeakStorageUnitRef,
        IsStrongStorageUnitRef,
        IsWeakStorageUnitRef,
        RemoveStorageUnitRef,
        GetIDFromStorageUnitRef,
        CreateStorageUnitRefIterator,
 		SetStorageUnitRef,
		GetGenerationNumber,
        IncrementGenerationNumber,
        IsPromiseValue,
        SetPromiseValue,
        GetPromiseValue,
        ClearAllPromises,
        ResolveAllPromises,
        Lock,
        Unlock;
  };
#endif
};

#endif  // _STORAGEU_

