OROCHI
 
Loading...
Searching...
No Matches
GxListClassBase.h
Go to the documentation of this file.
1//===========================================================================
9//===========================================================================
10#pragma once
11
12GX_CORE_NAMESPACE_BEGIN()
13
14//===========================================================================
16//===========================================================================
18{
19 //-------------------------------------------------------------
21 //-------------------------------------------------------------
23public:
24 GX_RTTI_CLASS(GxListClassBase, GxClassBase)
25 // GxClassBase継承クラス用禁止宣言
27
28
29 class GxNodeClassBase;
31 template <class T> class GxIterator;
33 enum class SORT
34 {
35 UP,
36 DOWN,
37#if GX_DEVELOP
38 CLASSNAME_UP,
39 CLASSNAME_DOWN,
40 RTTINAME_UP,
41 RTTINAME_DOWN
42#endif //GX_DEVELOP
43 };
44
46 //-------------------------------------------------------------
48 //-------------------------------------------------------------
50
52 GxListClassBase(void): _pTop(nullptr), _pBottom(nullptr), _count(0), _allocatorType(GxAllocatorList::ALLOCATOR_TYPE::GLOBAL){}
56 ~GxListClassBase(void) override;
57protected:
59 virtual GxNodeClassBase* allocNode(void);
60
62 //-------------------------------------------------------------
64 //-------------------------------------------------------------
66public:
68 GX_FORCE_INLINE GxIterator<GxClassBaseRoot*> begin(void);
70 GX_FORCE_INLINE GxIterator<GxClassBaseRoot*> end(void);
72 constexpr GxNodeClassBase* getTop(void) const { return _pTop; }
74 constexpr GxNodeClassBase* getBottom(void) const { return _pBottom; }
76 GxNodeClassBase* getNode(u32 index) const;
78 constexpr u32 getCount(void) const { return _count; }
80 constexpr void setAllocatorType(GxAllocatorList::ALLOCATOR_TYPE allocatorType){ _allocatorType = allocatorType; }
81
83 //-------------------------------------------------------------
85 //-------------------------------------------------------------
87
89 GxNodeClassBase* addTop(GxClassBaseRoot* pObject);
91 GxNodeClassBase* addBottom(GxClassBaseRoot* pObject);
93 void insert(GxNodeClassBase* pNodeClassBase, GxClassBaseRoot* pObject);
95 void erase(GxNodeClassBase* pNodeClassBase);
97 void eraseAll(void);
99 void sortQuick(GxProperty* pProperty, const SORT sort);
100
101private:
103 template<class T> void sortQuickSub(GxProperty* pProperty, GxNodeClassBase* pTop, GxNodeClassBase* pBottom, SORT sort);
105 template<class T> b32 getCompareResult(T& value0, T& value1, SORT sort);
107 template<class T> void getValue(GxProperty* pProperty, GxClassBaseRoot* pObject, T& value, SORT sort);
108
110 //-------------------------------------------------------------
112 //-------------------------------------------------------------
114protected:
117 u32 _count;
119
121};
122
124template<> b32 GxListClassBase::getCompareResult<GxString>(GxString& value0, GxString& value1, SORT sort);
126template<> void GxListClassBase::getValue<GxString>(GxProperty* pProperty, GxClassBaseRoot* pObject, GxString& value, SORT sort);
127
128//===========================================================================
130//===========================================================================
132{
133 //-------------------------------------------------------------
135 //-------------------------------------------------------------
137public:
139 // GxClassBase継承クラス用禁止宣言
141
142 friend class GxListClassBase;
143 friend class GxListClassBaseReference;
144
146 //-------------------------------------------------------------
148 //-------------------------------------------------------------
150
152 GxNodeClassBase(void) : _pObject(nullptr), _pParent(nullptr), _pPrevious(nullptr), _pNext(nullptr){}
154 ~GxNodeClassBase(void) override {}
155
157 //-------------------------------------------------------------
159 //-------------------------------------------------------------
161
163 constexpr GxListClassBase* getParent(void) const { return _pParent; }
165 constexpr GxNodeClassBase* getPrevious(void) const { return _pPrevious; }
167 constexpr GxNodeClassBase* getNext(void) const { return _pNext; }
169 constexpr GxClassBaseRoot* getObject(void) const { return _pObject; }
170protected:
172 virtual void setObject(GxClassBaseRoot* pObject){ _pObject = pObject; }
173
175 //-------------------------------------------------------------
177 //-------------------------------------------------------------
179
180protected:
183private:
184 GxNodeClassBase* _pPrevious;
185 GxNodeClassBase* _pNext;
186
188};
189
190//===========================================================================
192//===========================================================================
193template<class T> class GxListClassBase::GxIterator
194{
195 //-----------------------------------------------------------
197 //-----------------------------------------------------------
199public :
201 GX_FORCE_INLINE GxIterator(GxListClassBase* pListClassBase) : _pListClassBase(pListClassBase){ _pCurrent = _pListClassBase->getTop(); }
203 GX_FORCE_INLINE GxIterator(const GxListClassBase::GxIterator<T> &i) : _pListClassBase(i._pListClassBase), _pCurrent(i._pCurrent){}
205 virtual ~GxIterator(void){}
206
208 //-----------------------------------------------------------
210 //-----------------------------------------------------------
212
214 GX_FORCE_INLINE const GxListClassBase::GxIterator<T>& operator = (GxListClassBase::GxIterator<T> &i){ _pListClassBase = i._pListClassBase; _pCurrent = i._pCurrent; return this; }
216 GX_FORCE_INLINE T operator*(void) const { return getCurrent(); }
218 GX_FORCE_INLINE GxIterator<T>& operator++(void) { getNext(); return *this; }
220 GX_FORCE_INLINE b32 operator!=(const GxIterator& iterator) const { return getCurrent() != iterator.getCurrent(); }
221
223 //-----------------------------------------------------------
225 //-----------------------------------------------------------
227
229 GX_FORCE_INLINE const T operator[](u32 i) const;
231 GX_FORCE_INLINE T operator[](u32 i);
233 GX_FORCE_INLINE T getTop(void);
235 GX_FORCE_INLINE T getBottom(void);
237 GX_FORCE_INLINE T getPrevious(void);
239 GX_FORCE_INLINE T getCurrent(void) const;
241 GX_FORCE_INLINE T getNext(void);
243 GX_FORCE_INLINE T getFromIndex(u32 index) const { return this[index]; }
245 constexpr GxNodeClassBase* getCurrentNode(void) const { return _pCurrent; }
246
248 //-----------------------------------------------------------
250 //-----------------------------------------------------------
252private:
253 GxListClassBase* _pListClassBase;
254 GxNodeClassBase* _pCurrent;
255
257};
258
259//===========================================================================
261//===========================================================================
263{
264 //-------------------------------------------------------------
266 //-------------------------------------------------------------
268public:
269 // RTTI宣言
271 // GxClassBase継承クラス用禁止宣言
273
274
276
278 //-------------------------------------------------------------
280 //-------------------------------------------------------------
282
287protected:
289 GxNodeClassBase* allocNode(void) override;
290
291private:
293 GxListClassBaseReference(void) : GxListClassBase(GxAllocatorList::ALLOCATOR_TYPE::GLOBAL){}
294
296 //-------------------------------------------------------------
298 //-------------------------------------------------------------
300public:
302 GX_FORCE_INLINE GxNodeClassBaseReference* getTop(void) const;
304 GX_FORCE_INLINE GxNodeClassBaseReference* getBottom(void) const;
306 GX_FORCE_INLINE GxNodeClassBaseReference* getNode(u32 index) const;
307
309};
310
311//===========================================================================
313//===========================================================================
315{
316 //-------------------------------------------------------------
318 //-------------------------------------------------------------
320public:
322 // GxClassBase継承クラス用禁止宣言
324
325 friend class GxListClassBaseReference;
326
328 //-------------------------------------------------------------
330 //-------------------------------------------------------------
332
336 ~GxNodeClassBaseReference(void) override;
337
339 //-------------------------------------------------------------
341 //-------------------------------------------------------------
343
345 GX_FORCE_INLINE GxListClassBaseReference* getParent(void) const;
347 GX_FORCE_INLINE GxNodeClassBaseReference* getPrevious(void) const;
349 GX_FORCE_INLINE GxNodeClassBaseReference* getNext(void) const;
351 GX_FORCE_INLINE GxClassBaseReference* getObject(void) const;
352
354 //-------------------------------------------------------------
356 //-------------------------------------------------------------
358protected:
360 void setObject(GxClassBaseRoot* pObject) override;
361private:
363 void releaseObject(void);
364
366};
367
368#include "GxListClassBase.inl"
369
370GX_CORE_NAMESPACE_END()
#define GX_PROHIBIT_CLASS_BASE(__CLASS__)
GxClassBase継承の禁止宣言
Definition GxBase.h:240
GxClassBase用連結リスト
@ DOWN
リソースIDの下位32bitを元にした降順
@ UP
リソースIDの下位32bitを元にした昇順
メモリアロケータリスト
Definition GxAllocator.h:347
ALLOCATOR_TYPE
アロケータ定義
Definition GxAllocator.h:355
オブジェクト基底クラス
Definition GxBase.h:88
参照オブジェクト基底クラス
Definition GxBase.h:122
基底クラス
Definition GxBase.h:51
イテレータ
Definition GxListClassBase.h:194
GX_FORCE_INLINE GxIterator(GxListClassBase *pListClassBase)
コンストラクタ
Definition GxListClassBase.h:201
GX_FORCE_INLINE const GxListClassBase::GxIterator< T > & operator=(GxListClassBase::GxIterator< T > &i)
代入
Definition GxListClassBase.h:214
GX_FORCE_INLINE T getTop(void)
先頭を取得
Definition GxListClassBase.inl:69
GX_FORCE_INLINE T getCurrent(void) const
現在のオブジェクトを取得
Definition GxListClassBase.inl:117
GX_FORCE_INLINE T operator*(void) const
オブジェクト取得
Definition GxListClassBase.h:216
GX_FORCE_INLINE b32 operator!=(const GxIterator &iterator) const
不一致判定
Definition GxListClassBase.h:220
GX_FORCE_INLINE GxIterator< T > & operator++(void)
インクリメント
Definition GxListClassBase.h:218
GX_FORCE_INLINE T getFromIndex(u32 index) const
指定インデックスのものを取得
Definition GxListClassBase.h:243
virtual ~GxIterator(void)
デストラクタ
Definition GxListClassBase.h:205
GX_FORCE_INLINE GxIterator(const GxListClassBase::GxIterator< T > &i)
コピーコンストラクタ
Definition GxListClassBase.h:203
GX_FORCE_INLINE T getNext(void)
次を取得
Definition GxListClassBase.inl:131
GX_FORCE_INLINE T getPrevious(void)
前を取得
Definition GxListClassBase.inl:99
constexpr GxNodeClassBase * getCurrentNode(void) const
カレントノードを取得
Definition GxListClassBase.h:245
GX_FORCE_INLINE T getBottom(void)
終端を取得
Definition GxListClassBase.inl:84
GX_FORCE_INLINE const T operator[](u32 i) const
const配列
Definition GxListClassBase.inl:38
GxClassBase用連結リストノードクラス
Definition GxListClassBase.h:132
GxClassBaseRoot * _pObject
所有オブジェクト
Definition GxListClassBase.h:181
~GxNodeClassBase(void) override
デストラクタ
Definition GxListClassBase.h:154
virtual void setObject(GxClassBaseRoot *pObject)
オブジェクトを設定
Definition GxListClassBase.h:172
constexpr GxNodeClassBase * getPrevious(void) const
前のノードを取得
Definition GxListClassBase.h:165
constexpr GxClassBaseRoot * getObject(void) const
オブジェクトを取得
Definition GxListClassBase.h:169
GxNodeClassBase(void)
デフォルトコンストラクタ
Definition GxListClassBase.h:152
GxListClassBase * _pParent
親リスト
Definition GxListClassBase.h:182
constexpr GxListClassBase * getParent(void) const
親リストを取得
Definition GxListClassBase.h:163
constexpr GxNodeClassBase * getNext(void) const
次のノードを取得
Definition GxListClassBase.h:167
GxClassBase用連結リストクラス
Definition GxListClassBase.h:18
constexpr u32 getCount(void) const
要素数を取得
Definition GxListClassBase.h:78
GxListClassBase::GxNodeClassBase * _pTop
先頭ノード
Definition GxListClassBase.h:115
constexpr GxNodeClassBase * getTop(void) const
先頭を取得
Definition GxListClassBase.h:72
u32 _count
ノード数
Definition GxListClassBase.h:117
constexpr GxNodeClassBase * getBottom(void) const
終端を取得
Definition GxListClassBase.h:74
constexpr void setAllocatorType(GxAllocatorList::ALLOCATOR_TYPE allocatorType)
アロケータタイプを指定
Definition GxListClassBase.h:80
SORT
ソート方法
Definition GxListClassBase.h:34
GxListClassBase(void)
デフォルトコンストラクタ
Definition GxListClassBase.h:52
GxListClassBase::GxNodeClassBase * _pBottom
終端ノード
Definition GxListClassBase.h:116
GxAllocatorList::ALLOCATOR_TYPE _allocatorType
アロケータ種別
Definition GxListClassBase.h:118
GxClassBaseReference用連結リストノードクラス
Definition GxListClassBase.h:315
GX_FORCE_INLINE GxListClassBaseReference * getParent(void) const
親リストを取得
Definition GxListClassBase.inl:176
void setObject(GxClassBaseRoot *pObject) override
オブジェクトを設定
Definition GxListClassBase.cpp:529
~GxNodeClassBaseReference(void) override
デストラクタ
Definition GxListClassBase.cpp:520
GX_FORCE_INLINE GxNodeClassBaseReference * getNext(void) const
次のノードを取得
Definition GxListClassBase.inl:194
GxNodeClassBaseReference(void)
デフォルトコンストラクタ
Definition GxListClassBase.h:334
GX_FORCE_INLINE GxClassBaseReference * getObject(void) const
オブジェクトを取得
Definition GxListClassBase.inl:203
GX_FORCE_INLINE GxNodeClassBaseReference * getPrevious(void) const
前のノードを取得
Definition GxListClassBase.inl:185
GxClassBaseReference用連結リストクラス
Definition GxListClassBase.h:263
~GxListClassBaseReference(void) override
デストラクタ
Definition GxListClassBase.h:286
GX_FORCE_INLINE GxNodeClassBaseReference * getNode(u32 index) const
指定インデックスのノードを取得
Definition GxListClassBase.inl:167
GX_FORCE_INLINE GxNodeClassBaseReference * getTop(void) const
先頭を取得
Definition GxListClassBase.inl:148
GxListClassBaseReference(GxAllocatorList::ALLOCATOR_TYPE allocatorType)
コンストラクタ
Definition GxListClassBase.h:284
GxNodeClassBase * allocNode(void) override
Nodeのメモリ確保
Definition GxListClassBase.cpp:505
GX_FORCE_INLINE GxNodeClassBaseReference * getBottom(void) const
終端を取得
Definition GxListClassBase.inl:157
プロパティクラス
Definition GxProperty.h:48
文字列型クラス
Definition GxString.h:18
32bitブーリアン
Definition GxDefine.h:173