summaryrefslogtreecommitdiffstats
path: root/private/utils/ulib/inc/list.hxx
blob: da59323436c00f0d321cc5448166c914d3f5165d (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
/*++

Copyright (c) 1991  Microsoft Corporation

Module Name:

	list.hxx

Abstract:

    This class is an implementation of the SEQUENTIAL_CONTAINER
    protocol.  The specific implementation is that of a doubly
    linked list.

Author:

    Norbert P. Kusters (norbertk) 22-Oct-91

Environment:

	ULIB, User Mode

--*/

#if !defined( _LIST_DEFN_ )

#define _LIST_DEFN_

#include "seqcnt.hxx"
#include "membmgr.hxx"


struct OBJECT_LIST_NODE {
    OBJECT_LIST_NODE*   next;
    OBJECT_LIST_NODE*   prev;
    POBJECT             data;
};

DEFINE_POINTER_AND_REFERENCE_TYPES( OBJECT_LIST_NODE );

DECLARE_CLASS( LIST );

class LIST : public SEQUENTIAL_CONTAINER {

    FRIEND class LIST_ITERATOR;

    public:

        ULIB_EXPORT
        DECLARE_CONSTRUCTOR( LIST );

        VIRTUAL
        ULIB_EXPORT
        ~LIST(
            );

        NONVIRTUAL
        ULIB_EXPORT
        BOOLEAN
        Initialize(
            );

        VIRTUAL
        ULONG
        QueryMemberCount(
            ) CONST;

		VIRTUAL
        ULIB_EXPORT
        BOOLEAN
		Put(
            IN OUT  POBJECT Member
			);

		VIRTUAL
		POBJECT
		Remove(
			IN OUT  PITERATOR   Position
			);

		VIRTUAL
        ULIB_EXPORT
        PITERATOR
		QueryIterator(
            ) CONST;

        NONVIRTUAL
        ULIB_EXPORT
        BOOLEAN
        Insert(
            IN OUT  POBJECT     Member,
            IN OUT  PITERATOR   Position
            );

    private:

        POBJECT_LIST_NODE   _head;
        POBJECT_LIST_NODE   _tail;
        ULONG               _count;
        MEM_BLOCK_MGR       _mem_block_mgr;

        NONVIRTUAL
        VOID
        Construct(
            );

        NONVIRTUAL
        VOID
        Destroy(
            );

};


#endif // _LIST_DEFN_