summaryrefslogtreecommitdiffstats
path: root/private/ole32/stg/ref/h/entry.hxx
blob: 7ed08b4aafe68fbdd1f3873a01ef7a0020b77db6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
//+--------------------------------------------------------------
//
//  Microsoft Windows
//  Copyright (C) Microsoft Corporation, 1992 - 1992.
//
//  File:	entry.hxx
//
//  Contents:	Entry management classes
//
//  Classes:	PEntry
//		CDirectEntry
//		CTransactedEntry
//
//---------------------------------------------------------------

#ifndef __ENTRY_HXX__
#define __ENTRY_HXX__

#include <msf.hxx>

//+--------------------------------------------------------------
//
//  Class:	PEntry (en)
//
//  Purpose:	Entry management
//
//  Interface:	See below
//
//---------------------------------------------------------------

#define ROOT_LUID		1
#define MINISTREAM_LUID		2
#define ITERATOR_LUID		3
#define LUID_BASE		4

class PEntry
{
public:
    inline DFLUID GetLuid(void);
    virtual SCODE GetTime(WHICHTIME wt, TIME_T *ptm) = 0;
    virtual SCODE SetTime(WHICHTIME wt, TIME_T tm) = 0;

    SCODE CopyTimesFrom(PEntry *penFrom);

    static inline DFLUID GetNewLuid(void);

protected:
    PEntry(DFLUID dl);

private:
    static DFLUID _dlBase;

    const DFLUID _dl;
};

//+--------------------------------------------------------------
//
//  Member:	PEntry::GetNewLuid, public
//
//  Synopsis:	Returns a new luid
//
//---------------------------------------------------------------

inline DFLUID PEntry::GetNewLuid(void)
{
    DFLUID dl = _dlBase;
    AtomicInc((long *)&_dlBase);
    return dl;
}

//+--------------------------------------------------------------
//
//  Member:	PEntry::PEntry, protected
//
//  Synopsis:	Constructor, sets luid
//
//---------------------------------------------------------------

inline PEntry::PEntry(DFLUID dl)
: _dl(dl)
{
}

//+--------------------------------------------------------------
//
//  Member:	PEntry::GetLuid, public
//
//  Synopsis:	Returns the luid
//
//---------------------------------------------------------------

inline DFLUID PEntry::GetLuid(void)
{
    return _dl;
}

//+--------------------------------------------------------------
//
//  Class:	CTransactedEntry (ten)
//
//  Purpose:	Transacted entry management
//
//  Interface:	See below
//
//---------------------------------------------------------------

class CTransactedEntry
{
public:
    inline void GetTime(WHICHTIME wt, TIME_T *ptm);
    inline void SetTime(WHICHTIME wt, TIME_T tm);

private:
    TIME_T _tt[3];
};

//+--------------------------------------------------------------
//
//  Member:	CTransactedEntry::GetTime, public
//
//  Synopsis:	Returns the time
//
//---------------------------------------------------------------

inline void CTransactedEntry::GetTime(WHICHTIME wt, TIME_T *ptm)
{
    msfAssert(wt >= 0 && wt < 3);
    *ptm = _tt[wt];
}

//+--------------------------------------------------------------
//
//  Member:	CTransactedEntry::SetTime, public
//
//  Synopsis:	Sets the time
//
//---------------------------------------------------------------

inline void CTransactedEntry::SetTime(WHICHTIME wt, TIME_T tm)
{
    msfAssert(wt >= 0 && wt < 3);
    _tt[wt] = tm;
}




#endif // #ifndef __ENTRY_HXX__