Quantum Fog
0.9.3
Main Page
Related Pages
Classes
Files
File List
Legacy
QFog2-MachO
QFogSource
Ansi_General
L_LIST.h
1
//******************************************
2
// Purpose: To define a singly-linked list.
3
// The list will dwell in the heap.
4
//******************************************
5
#pragma once
6
7
8
//******************************************
9
template
<
class
TYPE>
10
class
DIR_DATA
//dir_data = directed data
11
{
12
public
:
13
// data
14
TYPE its_data;
15
DIR_DATA<TYPE>
* its_next_p;
16
17
DIR_DATA
();
18
DIR_DATA
(
const
TYPE & data,
DIR_DATA<TYPE>
* next_p)
19
{its_data = data; its_next_p=next_p;}
20
DIR_DATA
(
const
DIR_DATA<TYPE>
& source);
21
};
22
23
// The class DIR_DATA, which will be used only by the class L_LIST,
24
// has only some of the four horsemen, only those that will be used
25
// by the class L_LIST. In particular, the assigner will not be used.
26
// Also, there is no need for an explicit destructor as
27
// DIR_DATA never calls "new".
28
29
30
//******************************************
31
template
<
class
TYPE>
32
class
L_LIST
33
{
34
private
:
35
DIR_DATA<TYPE>
* its_first_p;
36
DIR_DATA<TYPE>
* its_last_p;
37
USHORT its_len;
// len = length
38
public
:
39
VOID clear();
40
VOID copy(
const
L_LIST<TYPE>
& prev_list);
41
L_LIST
();
42
L_LIST
(
const
L_LIST<TYPE>
& s );
43
L_LIST<TYPE>
& operator=(
const
L_LIST<TYPE>
& rhs);
44
virtual
~
L_LIST
();
45
46
DIR_DATA<TYPE>
* get_first_p()
const
;
47
DIR_DATA<TYPE>
* get_last_p()
const
;
48
const
USHORT get_len()
const
;
49
BOOLEAN has_this(
const
TYPE & target)
const
;
50
TYPE & operator[] (USHORT loc)
const
;
51
52
VOID insert_first(
const
TYPE & data);
53
VOID insert_last(
const
TYPE & data);
54
55
BOOLEAN extract_first( TYPE & data);
56
BOOLEAN extract_first();
57
BOOLEAN extract_last();
58
BOOLEAN extract_target(
const
TYPE & target);
59
BOOLEAN extract_target(
DIR_DATA<TYPE>
* target_p);
60
61
62
};
63
DIR_DATA
Definition:
L_LIST.h:10
L_LIST
Definition:
L_LIST.h:32
Generated by
1.8.11