75 m_blockSize = down_cast<size_t>(
_BIT(m_blockShift));
76 m_blockMask = m_blockSize - 1;
86 m_blockSize = 1 << m_blockShift;
87 while ( m_blockSize < bs )
91 if ( m_blockSize == 0 )
94 m_blockSize = 1 << m_blockShift;
97 m_blockMask = m_blockSize - 1;
112 virtual bool Lock(DWORD dwTime = INFINITE)
const
114 return m_sync.
Lock(dwTime);
141 virtual INDEX
Add(
const TYP& t)
143 size_t i = m_totalSize;
144 INDEX bn = i >> m_blockShift;
145 INDEX idx = i & m_blockMask;
146 if ( bn >= m_blocks.GetSize() )
148 TYP* P =
new TYP[m_blockSize];
151 TYP* B = m_blocks[bn];
167 INDEX is = m_totalSize;
168 size_t i = m_totalSize - 1 + size;
169 INDEX bn = i >> m_blockShift;
170 while ( bn >= m_blocks.GetSize() )
172 TYP* P =
new TYP[m_blockSize];
185 loop ( i, min(m_blockSize, size) )
201 m_blocks.RemoveAll();
215 if ( index >= m_totalSize )
219 size_t d = m_totalSize - index;
224 Set(index + i,
At(index + i + 1));
228 if ( m_totalSize == 0 )
230 m_blocks.RemoveAll();
234 INDEX bn = (m_totalSize - 1) >> m_blockShift;
235 if ( bn < m_blocks.GetSize() )
237 m_blocks.SetSize(bn + 1);
258 if ( size == 0 || sz < index + size)
263 size_t z = sz - size - index;
266 Set(index + i,
Get(index + size + i));
281 return m_blocks.GetSize();
296 if ( m_blocks.IsInRange(index ) )
298 _bi.
size = m_blockSize;
299 if ( index == m_blocks.GetSize() - 1 )
301 _bi.
size = (m_totalSize & m_blockMask);
303 _bi.
pData = m_blocks[index];
319 if ( index >= m_totalSize )
323 INDEX bn = index >> m_blockShift;
324 INDEX idx = index & m_blockMask;
325 TYP* B = m_blocks[bn];
337 if ( index >= m_totalSize )
341 INDEX bn = index >> m_blockShift;
342 INDEX idx = index & m_blockMask;
343 TYP* B = m_blocks[bn];
#define loop(VAR, CNT)
loop構文.
virtual size_t GetSize(void) const
[取得] 要素数取得.
virtual size_t RemoveElements(INDEX index, size_t size=0)
[削除] 要素削除.
CBlockLinkVectorT(void)
コンストラクタ.
CBlockLinkVectorT(size_t bs)
コンストラクタ.
virtual bool Remove(INDEX index)
[削除] 要素一つ削除.
virtual bool Lock(DWORD dwTime=INFINITE) const
[排他] ロック
size_t GetBlockCount(void) const
[取得] ブロック数取得.
bool GetBlockInformation(TBlockInformation &_bi, INDEX index) const
[取得] ブロック情報取得.
virtual bool RemoveAll(void)
[削除] 全要素削除 .
virtual size_t AddElements(size_t size, const TYP *P=NULL)
[追加] 複数要素追加.
friend class CBlockListVectorTest
フレンドクラス宣言
virtual INDEX Add(const TYP &t)
[追加] 要素一つ追加.
virtual void Unlock(void) const
[排他] アンロック
virtual const TYP * m_GetConstPointer(INDEX index) const
[取得] 要素アドレス取得
~CBlockLinkVectorT(void)
デストラクタ
virtual TYP * m_GetPointer(INDEX index)
[取得] 要素アドレス取得
virtual bool Lock(DWORD dwTime=INFINITE) const
[排他] ロック
virtual void Unlock(void) const
[排他] アンロック
virtual TYP Get(INDEX index) const
[取得] 要素の取得.
virtual const TYP & At(INDEX index) const
[取得] 要素の参照取得.
virtual bool Set(INDEX index, const TYP &t)
[設定] 要素の設定.
#define EXCLUSIVE(CLS)
簡易排他制御マクロ.
virtual bool SetSize(size_t size)
[操作] サイズ指定