1 /*---------------------------------------------------------------------------*
2 Project: Horizon
3 File: fnd_DetailList.h
4
5 Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
6
7 These coded instructions, statements, and computer programs contain
8 proprietary information of Nintendo of America Inc. and/or Nintendo
9 Company Ltd., and are protected by Federal copyright law. They may
10 not be disclosed to third parties or copied or duplicated in any form,
11 in whole or in part, without the prior written consent of Nintendo.
12
13 $Rev: 12449 $
14 *---------------------------------------------------------------------------*/
15
16 #ifndef NN_FND_DETAIL_FND_DETAIL_LIST_H_
17 #define NN_FND_DETAIL_FND_DETAIL_LIST_H_
18
19 #include <stddef.h>
20 #include <nn/types.h>
21 #include <nn/assert.h>
22 #include <nn/fnd/detail/fnd_DetailHeapHead.h>
23
24 #ifdef __cplusplus
25
26 namespace nn { namespace fnd { namespace detail {
27 /// @cond
28
29 /*---------------------------------------------------------------------------*
30 Name: NN_OS_INIT_LIST
31
32 Description: リスト構造体を初期化するためのマクロです。実際の初期化には、
33 NNSFndInitList()関数により行われます。
34
35 このマクロでは、指定された構造体名とNNSFndLink型メンバ変数名
36 から、offsetofマクロを使ってオフセットを求め、NNSFndInitList
37 関数に渡しています。
38
39 Arguments: list: リンク構造体へのポインタ。
40 structName: リストに繋げたいオブジェクトの構造体名。
41 linkName: このオブジェクトのリンクに使用されるNNSFndLink型
42 のメンバ変数名。
43
44 Returns: なし。
45 *---------------------------------------------------------------------------*/
46
47 #define NN_OS_INIT_LIST(list, structName, linkName) \
48 InitList(list, offsetof(structName, linkName))
49
50
51 /*---------------------------------------------------------------------------*
52 関数プロトタイプ。
53
54 *---------------------------------------------------------------------------*/
55
56 void InitList(
57 NNSFndList* list,
58 u16 offset);
59
60 void AppendListObject(
61 NNSFndList* list,
62 void* object);
63
64 void PrependListObject(
65 NNSFndList* list,
66 void* object);
67
68 void InsertListObject(
69 NNSFndList* list,
70 void* target,
71 void* object);
72
73 void RemoveListObject(
74 NNSFndList* list,
75 void* object);
76
77 void* GetNextListObject(
78 const NNSFndList* list,
79 const void* object);
80
81 void* GetPrevListObject(
82 const NNSFndList* list,
83 const void* object);
84
85 void* GetNthListObject(
86 const NNSFndList* list,
87 u16 index);
88
89
90 /*---------------------------------------------------------------------------*
91 Name: GetListSize
92
93 Description: 引数で指定されたリストに登録されているオブジェクトの数を
94 取得します。
95
96 Arguments: list リスト構造体へのポインタ。
97
98 Returns: 指定されたリストに登録されているオブジェクトの数を返します。
99 *---------------------------------------------------------------------------*/
100 inline u16
GetListSize(const NNSFndList * list)101 GetListSize( const NNSFndList* list )
102 {
103 NN_TASSERT_( list );
104
105 return list->numObjects;
106 }
107
108 /* NN_OS_LIST_H_ */
109 /// @endcond
110 }}} // namespace nn::os
111
112 #endif // __cplusplus
113
114 #endif
115
116