8 #ifndef _FVARRAYALLOCATOR_H_INCLUDED_ 9 #define _FVARRAYALLOCATOR_H_INCLUDED_ 19 #pragma pack(push,_FVCL_PACKING) 63 virtual reference
SetItem( size_type uiIndex, const_reference _Val )
72 virtual reference
GetItem( size_type uiIndex )
const 80 virtual pointer
GetBuffer( size_type uiIndex = 0 )
const 125 if( pNewTable == NULL )
return false;
128 for( iCnt=0 ; iCnt<this->
m_uiCount ; iCnt++ )
129 pNewTable[iCnt] = this->
m_pTable[iCnt];
139 virtual bool Erase( size_type uiS, size_type uiE )
141 if( this->
m_pTable == NULL )
return false;
144 if( uiE < uiS )
return false;
146 size_type iCnt, jCnt;
147 for( iCnt=uiS, jCnt=1 ; iCnt<this->
m_uiCount ; iCnt++, jCnt++ )
149 size_type uiP = uiE+jCnt;
150 if( uiP < this->m_uiCount )
153 this->m_uiCount -= (uiE-uiS+1);
158 virtual bool Insert( size_type uiPos, size_type uiSize, const_reference _Val )
160 if( this->
m_pTable == NULL )
return false;
161 if( this->
m_uiCount <= uiPos )
return false;
162 if( uiSize == 0 ) uiSize = 1;
163 if( this->m_uiCapacity < this->
m_uiCount+uiSize )
166 size_type uiLen = this->
m_uiCount - uiPos;
168 for( iCnt=1 ; iCnt<=uiLen ; iCnt++ )
170 for( iCnt=uiPos ; iCnt<uiPos+uiSize ; iCnt++ )
179 if( this->
m_pTable == NULL )
return false;
192 if( this->m_uiCapacity <= this->
m_uiCount )
201 virtual bool Resize( size_type uiSize, const_pointer pVal=NULL )
213 TYPE *pNewTable =
new TYPE[uiSize];
214 if( pNewTable == NULL )
return false;
216 for( size_type iCnt=0 ; iCnt<uiSize ; iCnt++ )
217 pNewTable[iCnt] = this->
m_pTable[iCnt];
222 this->m_uiCount = uiSize;
224 else if( this->m_uiCount < uiSize )
230 for( size_type iCnt=this->m_uiCount ; iCnt<uiSize ; iCnt++ )
231 this->
m_pTable[iCnt] = static_cast<const_reference>(*pVal);
232 this->m_uiCount = uiSize;
240 if( !(0 <= uiPos && uiPos < this->
m_uiCount) )
244 INT iPos2 = iPos1 + order;
248 iPos2 = (
INT)this->m_uiCount - 1;
250 INT inc = (iPos1<iPos2) ? 1 : -1;
252 for(
INT i=iPos1 ; i!=iPos2 ; i+=inc )
260 virtual bool SwapItem( size_type uiPos1, size_type uiPos2 )
262 if( ! (uiPos1 < this->
m_uiCount) )
return false;
263 if( ! (uiPos2 < this->m_uiCount) )
return false;
281 #endif // _FVARRAYALLOCATOR_H_INCLUDED_ virtual bool PopBack()
配列末端からの要素の取り出し
Definition: FvArrayAllocator.h:177
size_type m_uiInitial
配列の初期容量
Definition: FvAllocator.h:112
TYPE * pointer
ポインタ型
Definition: FvAllocator.h:38
size_type m_uiIncrease
配列の増分
Definition: FvAllocator.h:113
配列確保テンプレートクラスの基本クラス
Definition: FvAllocator.h:34
FVCLのネームスペース
Definition: EVCbasicDeclare.txt:9
領域確保不可例外クラス
Definition: FveBadAllocException.h:18
virtual ~CFvArrayAllocator()
デストラクタ
Definition: FvArrayAllocator.h:52
virtual bool SwapItem(size_type uiPos1, size_type uiPos2)
配列要素の位置入れ替え
Definition: FvArrayAllocator.h:260
virtual bool Reserve(size_type uiIncrease)
配列容量の追加
Definition: FvArrayAllocator.h:117
const INT FAILED_TO_ALLOCATE
メモリの確保に失敗しました。
Definition: FvErrors.h:15
const INT INVALID_PARAMETER
パラメータが無効です。
Definition: FvErrors.h:24
virtual bool Allocate()
配列の確保
Definition: FvArrayAllocator.h:88
int INT
整数型(32ビット)
Definition: FvDefs.h:36
virtual bool PushBack(const_reference _Val)
配列への要素の追加
Definition: FvArrayAllocator.h:186
virtual reference SetItem(size_type uiIndex, const_reference _Val)
配列への要素の設定
Definition: FvArrayAllocator.h:63
CFvArrayAllocator(size_type uiInitial, size_type uiIncrease)
コンストラクタ
Definition: FvArrayAllocator.h:44
UINT size_type
サイズ型
Definition: FvAllocator.h:42
size_type m_uiCapacity
配列の許容量
Definition: FvAllocator.h:111
virtual reference GetItem(size_type uiIndex) const
配列の要素の取得
Definition: FvArrayAllocator.h:72
const TYPE * const_pointer
ポインタ型(const付き)
Definition: FvAllocator.h:39
size_type m_uiCount
配列内の要素数
Definition: FvAllocator.h:110
const TYPE & const_reference
参照型(const付き)
Definition: FvAllocator.h:41
アクセス違反例外クラス
Definition: FveBadAccessException.h:18
TYPE & reference
参照型
Definition: FvAllocator.h:40
virtual bool Insert(size_type uiPos, size_type uiSize, const_reference _Val)
配列への要素の挿入
Definition: FvArrayAllocator.h:158
virtual bool Resize(size_type uiSize, const_pointer pVal=NULL)
配列の再確保
Definition: FvArrayAllocator.h:201
virtual bool ChangeOrder(size_type uiPos, INT order)
配列要素の順序入れ替え
Definition: FvArrayAllocator.h:238
unsigned int UINT
整数型(32ビット)[符号なし]
Definition: FvDefs.h:37
virtual bool Erase(size_type uiS, size_type uiE)
配列要素の削除
Definition: FvArrayAllocator.h:139
pointer m_pTable
配列
Definition: FvArrayAllocator.h:274
virtual void Clear()
配列の開放
Definition: FvArrayAllocator.h:105
virtual pointer GetBuffer(size_type uiIndex=0) const
配列の要素へのアドレス取得
Definition: FvArrayAllocator.h:80
配列確保テンプレートクラス(連続型)
Definition: FvArrayAllocator.h:32