SourceForge.jp

クラス テンプレートdkutil::buffer_base< T, A >

#include <dkutilBuffer.h>

dkutil::buffer_base< T, A >のコラボレーション図

Collaboration graph
[凡例]
すべてのメンバ一覧

Public 型

typedef char value_type
typedef size_t size_type
typedef ptrdiff_t difference_type
typedef size_t size_type
typedef T * pointer
typedef T & reference
typedef const T & const_reference
typedef const T * const_pointer

Public メソッド

 buffer_base ()
 buffer_base (size_type size)
 buffer_base (const buffer_base &data)
 こぷぃ〜こんすとらくたぁ〜。 私って結構これ、忘れるんですよ。

virtual ~buffer_base ()
void clear ()
 メモリ領域からなにからすべてを消し去る。

int reserve (size_type num)
 今までのバッファをすべて開放して、確保しなおす、前のバッファの内容は破棄される。

int resize (size_type size)
 reserve()のwrapper

bool SetBuff (const T *data, size_type num)
 バッファにコピーする。numがcapacity()より大きければこの関数は失敗する

bool SetString (size_type buffsize, const char *str,...)
 もちろんNULL文字も考慮されている

bool SetString (const char *str,...)
bool isValid () const
bool empty () const
size_type size () const
 既に使用済みのTの1個分の領域の数を得ます。( std::vectorと同じ^^;

size_type capacity () const
 内部で確保しているTの1個分の領域の数を得ます。( std::vectorと同じ^^;

size_type byte_size () const
 size() * sizeof(T)よってbyte単位のサイズが得れる。

size_type byte_capacity () const
 capacity() * sizeof(T)よって、byte単位のサイズが得れる。

pointer data ()
 危険な香りの data()... 内部のポインタ配列を戴くので非常に危険。使用に注意

const_pointer data () const
reference at (size_type s)
 std::vectorのatと同じです。

const_reference at (size_type s) const
reference operator[] (size_type s)
 at()のWrapperです。

const_reference operator[] (size_type s) const

Protected メソッド

void SetEmpty (bool e)
void SetSize (size_type s)
void SetCapacity (size_type c)

フレンド

bool operator== (buffer_base< T, A > t1, buffer_base< T, A > t2)

説明

template<typename T, typename A = std::allocator<T>>
class dkutil::buffer_base< T, A >

いわいるバッファー クラス。boost::arrayやstd::vectorでは出来ないと思われるmemcpy系処理を担う 前まで、std::vectorを継承していたが、 vectorはmemcpy的な事をするのに非常に時間がかかるため、断念。

覚え書き:
規格:


型定義

template<typename T, typename A = std::allocator<T>>
typedef const T* dkutil::buffer_base< T, A >::const_pointer
 

template<typename T, typename A = std::allocator<T>>
typedef const T& dkutil::buffer_base< T, A >::const_reference
 

template<typename T, typename A = std::allocator<T>>
typedef ptrdiff_t dkutil::buffer_base< T, A >::difference_type
 

template<typename T, typename A = std::allocator<T>>
typedef T* dkutil::buffer_base< T, A >::pointer
 

template<typename T, typename A = std::allocator<T>>
typedef T& dkutil::buffer_base< T, A >::reference
 

template<typename T, typename A = std::allocator<T>>
typedef size_t dkutil::buffer_base< T, A >::size_type
 

template<typename T, typename A = std::allocator<T>>
typedef size_t dkutil::buffer_base< T, A >::size_type
 

template<typename T, typename A = std::allocator<T>>
typedef char dkutil::buffer_base< T, A >::value_type
 


コンストラクタとデストラクタ

template<typename T, typename A = std::allocator<T>>
dkutil::buffer_base< T, A >::buffer_base  )  [inline]
 

template<typename T, typename A = std::allocator<T>>
dkutil::buffer_base< T, A >::buffer_base size_type  size  )  [inline]
 

template<typename T, typename A = std::allocator<T>>
dkutil::buffer_base< T, A >::buffer_base const buffer_base< T, A > &  data  )  [inline]
 

こぷぃ〜こんすとらくたぁ〜。 私って結構これ、忘れるんですよ。

template<typename T, typename A = std::allocator<T>>
virtual dkutil::buffer_base< T, A >::~buffer_base  )  [inline, virtual]
 


関数

template<typename T, typename A = std::allocator<T>>
const_reference dkutil::buffer_base< T, A >::at size_type  s  )  const [inline]
 

template<typename T, typename A = std::allocator<T>>
reference dkutil::buffer_base< T, A >::at size_type  s  )  [inline]
 

std::vectorのatと同じです。

template<typename T, typename A = std::allocator<T>>
size_type dkutil::buffer_base< T, A >::byte_capacity  )  const [inline]
 

capacity() * sizeof(T)よって、byte単位のサイズが得れる。

template<typename T, typename A = std::allocator<T>>
size_type dkutil::buffer_base< T, A >::byte_size  )  const [inline]
 

size() * sizeof(T)よってbyte単位のサイズが得れる。

template<typename T, typename A = std::allocator<T>>
size_type dkutil::buffer_base< T, A >::capacity  )  const [inline]
 

内部で確保しているTの1個分の領域の数を得ます。( std::vectorと同じ^^;

template<typename T, typename A = std::allocator<T>>
void dkutil::buffer_base< T, A >::clear  )  [inline]
 

メモリ領域からなにからすべてを消し去る。

template<typename T, typename A = std::allocator<T>>
const_pointer dkutil::buffer_base< T, A >::data  )  const [inline]
 

template<typename T, typename A = std::allocator<T>>
pointer dkutil::buffer_base< T, A >::data  )  [inline]
 

危険な香りの data()... 内部のポインタ配列を戴くので非常に危険。使用に注意

template<typename T, typename A = std::allocator<T>>
bool dkutil::buffer_base< T, A >::empty  )  const [inline]
 

template<typename T, typename A = std::allocator<T>>
bool dkutil::buffer_base< T, A >::isValid  )  const [inline]
 

template<typename T, typename A = std::allocator<T>>
const_reference dkutil::buffer_base< T, A >::operator[] size_type  s  )  const [inline]
 

template<typename T, typename A = std::allocator<T>>
reference dkutil::buffer_base< T, A >::operator[] size_type  s  )  [inline]
 

at()のWrapperです。

template<typename T, typename A = std::allocator<T>>
int dkutil::buffer_base< T, A >::reserve size_type  num  )  [inline]
 

今までのバッファをすべて開放して、確保しなおす、前のバッファの内容は破棄される。

template<typename T, typename A = std::allocator<T>>
int dkutil::buffer_base< T, A >::resize size_type  size  )  [inline]
 

reserve()のwrapper

template<typename T, typename A = std::allocator<T>>
bool dkutil::buffer_base< T, A >::SetBuff const T *  data,
size_type  num
[inline]
 

バッファにコピーする。numがcapacity()より大きければこの関数は失敗する

引数:
data[in] コピーするデータ
num[in] dataの数
戻り値:
false == 失敗

template<typename T, typename A = std::allocator<T>>
void dkutil::buffer_base< T, A >::SetCapacity size_type  c  )  [inline, protected]
 

template<typename T, typename A = std::allocator<T>>
void dkutil::buffer_base< T, A >::SetEmpty bool  e  )  [inline, protected]
 

template<typename T, typename A = std::allocator<T>>
void dkutil::buffer_base< T, A >::SetSize size_type  s  )  [inline, protected]
 

template<typename T, typename A = std::allocator<T>>
bool dkutil::buffer_base< T, A >::SetString const char *  str,
... 
[inline]
 

template<typename T, typename A = std::allocator<T>>
bool dkutil::buffer_base< T, A >::SetString size_type  buffsize,
const char *  str,
... 
[inline]
 

もちろんNULL文字も考慮されている

引数:
buffsize[in] 内部で使用するバッファのサイズ
str[in] 文字列
例外:
sizeof(T) != sizeof(char) だったら std::logic_errorを投げる。
戻り値:
もし、capacity()内に収まらなかったら、収まらないぶんは切り捨てられる。(その時の戻り値はfalse

template<typename T, typename A = std::allocator<T>>
size_type dkutil::buffer_base< T, A >::size  )  const [inline]
 

既に使用済みのTの1個分の領域の数を得ます。( std::vectorと同じ^^;


フレンドと関連する関数

template<typename T, typename A = std::allocator<T>>
bool operator== buffer_base< T, A >  t1,
buffer_base< T, A >  t2
[friend]
 


このクラスの説明は次のファイルから生成されました:
dkutil 1.02リリース前 d金魚専用マニュアルバージョンに対してSun Dec 28 21:23:11 2003に生成されました。 doxygen 1.3.5