Last change
on this file since 8045 was 3456, checked in by davidr, 25 years ago |
OLE32/NEW: Work-in-progress on adding apartment handling
|
File size:
948 bytes
|
Line | |
---|
1 | /* $Id: oTls.h,v 1.1 2000-04-27 22:21:36 davidr Exp $ */
|
---|
2 | /*
|
---|
3 | * Wrapper for the WIN32 TLS functions...
|
---|
4 | *
|
---|
5 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
6 | *
|
---|
7 | */
|
---|
8 |
|
---|
9 | #ifndef OTLS_INCLUDED
|
---|
10 | #define OTLS_INCLUDED 1
|
---|
11 |
|
---|
12 | template <class VARPTR>
|
---|
13 | class oTlsValue
|
---|
14 | {
|
---|
15 | private:
|
---|
16 | DWORD m_Index;
|
---|
17 |
|
---|
18 | protected:
|
---|
19 |
|
---|
20 | public:
|
---|
21 | oTlsValue(VARPTR const defVal = 0) : m_Index(TlsAlloc())
|
---|
22 | { dprintf(("OTLS: TlsAlloc %d", m_Index)); SetValue(defVal); }
|
---|
23 |
|
---|
24 | virtual ~oTlsValue()
|
---|
25 | { dprintf(("OTLS: TlsFree %d", m_Index)); TlsFree(m_Index); }
|
---|
26 |
|
---|
27 | VARPTR const GetValue(void ) const
|
---|
28 | { return (VARPTR const)TlsGetValue(m_Index); }
|
---|
29 |
|
---|
30 | void SetValue(VARPTR const newVal )
|
---|
31 | { TlsSetValue(m_Index, (LPVOID)newVal); }
|
---|
32 |
|
---|
33 | operator VARPTR const () const
|
---|
34 | { return GetValue(); }
|
---|
35 |
|
---|
36 | VARPTR const operator -> () const
|
---|
37 | { return GetValue(); }
|
---|
38 |
|
---|
39 | oTlsValue<VARPTR> operator = (VARPTR const newVal)
|
---|
40 | { SetValue(newVal); return *this; };
|
---|
41 |
|
---|
42 | };
|
---|
43 |
|
---|
44 |
|
---|
45 | #endif /* OTLS_INCLUDED */
|
---|
Note:
See
TracBrowser
for help on using the repository browser.