NT4/private/ole32/stg/ref/seekptr.hxx
2020-09-30 17:12:29 +02:00

114 lines
2.4 KiB
C++

//+--------------------------------------------------------------
//
// Microsoft Windows
// Copyright (C) Microsoft Corporation, 1992 - 1992.
//
// File: seekptr.hxx
//
// Contents: CSeekPointer header
//
// Classes: CSeekPointer
//
//---------------------------------------------------------------
#ifndef __SEEKPTR_HXX__
#define __SEEKPTR_HXX__
//+--------------------------------------------------------------
//
// Class: CSeekPointer
//
// Purpose: Contains a seek pointer to share between exposed
// streams
//
// Interface: See below.
//
//---------------------------------------------------------------
class CSeekPointer
{
public:
inline CSeekPointer(ULONG ulPos);
inline ~CSeekPointer(void);
inline ULONG GetPos(void) const;
inline void SetPos(ULONG ulPos);
inline void vAddRef(void);
void vRelease(void);
private:
ULONG _ulPos;
LONG _cReferences;
};
//+--------------------------------------------------------------
//
// Member: CSeekPointer::CSeekPointer, public
//
// Synopsis: Ctor
//
// Arguments: [ulPos] - Initial position
//
//---------------------------------------------------------------
inline CSeekPointer::CSeekPointer(ULONG ulPos)
{
_ulPos = ulPos;
_cReferences = 1;
}
//+--------------------------------------------------------------
//
// Member: CSeekPointer::~CSeekPointer, public
//
// Synopsis: Dtor
//
//---------------------------------------------------------------
inline CSeekPointer::~CSeekPointer(void)
{
olAssert(_cReferences == 0);
}
//+--------------------------------------------------------------
//
// Member: CSeekPointer::GetPos, public
//
// Synopsis: Returns _ulPos
//
//---------------------------------------------------------------
inline ULONG CSeekPointer::GetPos(void) const
{
return _ulPos;
}
//+--------------------------------------------------------------
//
// Member: CSeekPointer::SetPos, public
//
// Synopsis: Assigns _ulPos
//
//---------------------------------------------------------------
inline void CSeekPointer::SetPos(ULONG ulPos)
{
_ulPos = ulPos;
}
//+--------------------------------------------------------------
//
// Member: CSeekPointer::AddRef, public
//
// Synopsis: Increments _cReferences
//
//---------------------------------------------------------------
inline void CSeekPointer::vAddRef(void)
{
AtomicInc(&_cReferences);
}
#endif // #ifndef __SEEKPTR_HXX__