99 lines
1.5 KiB
C++
99 lines
1.5 KiB
C++
#ifndef _COM_DLLSERVER_HPP_
|
|
#define _COM_DLLSERVER_HPP_
|
|
#ifndef _COMMON_WINDOWS_HPP_
|
|
#include <common/windows.hpp>
|
|
#endif
|
|
|
|
class DLLServer
|
|
{
|
|
public:
|
|
DLLServer(void);
|
|
virtual ~DLLServer();
|
|
void setInstance(HINSTANCE hInstance);
|
|
HINSTANCE getInstance(void)const;
|
|
ULONG getRefCount(void)const;
|
|
ULONG getLockCount(void)const;
|
|
void lock(void);
|
|
void unlock(void);
|
|
void up(void);
|
|
void down(void);
|
|
|
|
private:
|
|
DLLServer(const DLLServer &someDLLServer);
|
|
DLLServer &operator=(const DLLServer &someDLLServer);
|
|
|
|
HINSTANCE mhInstance;
|
|
ULONG mRefCount;
|
|
ULONG mLockCount;
|
|
};
|
|
|
|
inline
|
|
DLLServer::DLLServer(void)
|
|
: mhInstance(0), mRefCount(0), mLockCount(0)
|
|
{
|
|
}
|
|
|
|
inline
|
|
DLLServer::DLLServer(const DLLServer &/*someDLLServer*/)
|
|
{ // private implementation
|
|
}
|
|
|
|
inline
|
|
DLLServer &DLLServer::operator=(const DLLServer &/*someDLLServer*/)
|
|
{ // private implementation
|
|
return *this;
|
|
}
|
|
|
|
inline
|
|
DLLServer::~DLLServer()
|
|
{
|
|
}
|
|
|
|
inline
|
|
void DLLServer::lock(void)
|
|
{
|
|
::InterlockedIncrement((LONG*)&mLockCount);
|
|
}
|
|
|
|
inline
|
|
void DLLServer::unlock(void)
|
|
{
|
|
::InterlockedDecrement((LONG*)&mLockCount);
|
|
}
|
|
|
|
inline
|
|
void DLLServer::up(void)
|
|
{
|
|
::InterlockedIncrement((LONG*)&mRefCount);
|
|
}
|
|
|
|
inline
|
|
void DLLServer::down(void)
|
|
{
|
|
::InterlockedDecrement((LONG*)&mRefCount);
|
|
}
|
|
|
|
inline
|
|
void DLLServer::setInstance(HINSTANCE hInstance)
|
|
{
|
|
mhInstance=hInstance;
|
|
}
|
|
|
|
inline
|
|
HINSTANCE DLLServer::getInstance(void)const
|
|
{
|
|
return mhInstance;
|
|
}
|
|
|
|
inline
|
|
ULONG DLLServer::getRefCount(void)const
|
|
{
|
|
return mRefCount;
|
|
}
|
|
|
|
inline
|
|
ULONG DLLServer::getLockCount(void)const
|
|
{
|
|
return mLockCount;
|
|
}
|
|
#endif |