-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChain.h
70 lines (51 loc) · 1.67 KB
/
Chain.h
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
#ifndef _SIMPLE_CHAIN_H
#define _SIMPLE_CHAIN_H
////////////////////////////////////////////////////////////////////////////////
//
// General including files
//
// Including the files for the system.
//
// These including files are generally used in different operation system.
//
////////////////////////////////////////////////////////////////////////////////
typedef struct tagChainNode
{
//Next
struct tagChainNode* lpNext;
//Previous
struct tagChainNode* lpPrevious;
//Data
_OBJECT lpObject;
}
ChainNode;
typedef struct tagSimpleChain
{
//Capacity
_UINT32 nCapacity;
//Count
_UINT32 nCount;
//Root Node
ChainNode nodeRoot;
}
SimpleChain;
////////////////////////////////////////////////////////////////////////////////
//
// General functions
//
////////////////////////////////////////////////////////////////////////////////
extern void InitializeChain(SimpleChain* pChain);
extern void UninitializeChain(SimpleChain* pChain);
extern void RemoveChainObjects(SimpleChain* pChain);
extern void DeleteChainObjects(SimpleChain* pChain);
extern _BOOL IsChainFull(SimpleChain* pChain);
extern _BOOL IsChainEmpty(SimpleChain* pChain);
extern ChainNode* FindChainNode(SimpleChain* pChain,_OBJECT lpObject);
extern _BOOL InsertChainObject(SimpleChain* pChain,_OBJECT lpObject);
extern _BOOL RemoveChainObject(SimpleChain* pChain,_OBJECT lpObject);
extern _OBJECT RemoveChainHead(SimpleChain* pChain);
extern _OBJECT RemoveChainTail(SimpleChain* pChain);
extern _OBJECT GetNextChainObject(SimpleChain* pChain);
extern _OBJECT GetPreviousChainObject(SimpleChain* pChain);
////////////////////////////////////////////////////////////////////////////////
#endif //End of the header file.