Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

gslib::static_container::vector< Value, MaxSize > Class Template Reference

現在、データは、4 byte アラインしか保障されません。 SIMD 用データなど 4 byte ではアラインが足りない場合は、今後拡張するので、 言ってください。 やり方としては、buffer_ をアライン分余分にとって、 実行時に this を見て、必要オフセットを設定しバッファを利用する予定です。 More...

#include <vector.h>

Inheritance diagram for gslib::static_container::vector< Value, MaxSize >:

Inheritance graph
[legend]
Collaboration diagram for gslib::static_container::vector< Value, MaxSize >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef boost::call_traits<
Value >::param_type 
param_type
typedef pointer iterator
typedef const_pointer const_iterator

Public Member Functions

 BOOST_STATIC_CONSTANT (size_type, const_max=MaxSize)
 最大サイズ

size_type size () const
 サイズ取得

iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
void push_back (param_type v)
 末尾に対する要素追加

void pop_back ()
 末尾要素削除

 vector ()
 デフォルトコンストラクタ

 vector (size_type s)
 各要素に対しては、デフォルトコンストラクタを呼び出す

 vector (size_type s, param_type v)
 各要素に対しては、コピーコンストラクタを呼び出す

 vector (const vector &other)
 コピーコンストラクタ

 ~vector ()
vectoroperator= (const vector &other)
 代入演算子

template<typename InputIt> void assign (InputIt first, InputIt last)
 代入

void erase (iterator it)
 it を削除します

void erase (iterator first, iterator last)
 現在、非常に重い動作です。 要望があれば高速化します。

void clear ()
 空ベクトル化

Value & operator[] (size_type i)
const Value & operator[] (size_type i) const
bool empty () const
reference at (size_type i)
param_type at (size_type i) const
reference front ()
param_type front () const
reference back ()
param_type back () const
void swap (vector &other)
 置換

void assign (param_type value)

Static Public Member Functions

size_type max_size ()
 最大サイズ取得

size_type capaciry ()
 容量取得


Private Member Functions

pointer top ()
 実装用。 先頭要素のアドレスを得る

const_pointer top () const
 実装用。 先頭要素のアドレスを得る


Static Private Member Functions

void destruct (reference v)

Private Attributes

size_type size_
uint8_t buffer_ [MaxSize *sizeof(Value)]

Detailed Description

template<typename Value, size_t MaxSize>
class gslib::static_container::vector< Value, MaxSize >

現在、データは、4 byte アラインしか保障されません。 SIMD 用データなど 4 byte ではアラインが足りない場合は、今後拡張するので、 言ってください。 やり方としては、buffer_ をアライン分余分にとって、 実行時に this を見て、必要オフセットを設定しバッファを利用する予定です。

Definition at line 85 of file vector.h.


Member Typedef Documentation

template<typename Value, size_t MaxSize>
typedef const_pointer gslib::static_container::vector< Value, MaxSize >::const_iterator
 

Definition at line 90 of file vector.h.

template<typename Value, size_t MaxSize>
typedef pointer gslib::static_container::vector< Value, MaxSize >::iterator
 

Definition at line 89 of file vector.h.

template<typename Value, size_t MaxSize>
typedef boost::call_traits< Value >::param_type gslib::static_container::vector< Value, MaxSize >::param_type
 

Definition at line 88 of file vector.h.


Constructor & Destructor Documentation

template<typename Value, size_t MaxSize>
gslib::static_container::vector< Value, MaxSize >::vector  )  [inline]
 

デフォルトコンストラクタ

Definition at line 141 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::size_.

00141                      : size_( 0 ) {
00142             }

template<typename Value, size_t MaxSize>
gslib::static_container::vector< Value, MaxSize >::vector size_type  s  )  [inline]
 

各要素に対しては、デフォルトコンストラクタを呼び出す

Definition at line 148 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::max_size(), gslib::static_container::vector< Value, MaxSize >::size_, and STATIC_VECTOR_FOREACH.

00148                                   : size_( s ) {
00149                 BOOST_ASSERT( s <= max_size() );
00150                 STATIC_VECTOR_FOREACH( new( it ) Value() )
00151             }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
gslib::static_container::vector< Value, MaxSize >::vector size_type  s,
param_type  v
[inline]
 

各要素に対しては、コピーコンストラクタを呼び出す

Definition at line 156 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::max_size(), gslib::static_container::vector< Value, MaxSize >::size_, and STATIC_VECTOR_FOREACH.

00156                                                 : size_( s ) {
00157                 BOOST_ASSERT( s <= max_size() );
00158                 STATIC_VECTOR_FOREACH( new( it ) Value( v ) )
00159             }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
gslib::static_container::vector< Value, MaxSize >::vector const vector< Value, MaxSize > &  other  )  [inline]
 

コピーコンストラクタ

Definition at line 161 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::begin(), gslib::static_container::vector< Value, MaxSize >::size_, and STATIC_VECTOR_FOREACH.

00161                                           : size_( other.size_ ) {
00162                 const_iterator otherIt = other.begin();
00163                 STATIC_VECTOR_FOREACH( new( it ) Value( *( otherIt++ ) ) )
00164             }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
gslib::static_container::vector< Value, MaxSize >::~vector  )  [inline]
 

Definition at line 166 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::clear().

00166                       {
00167                 clear();
00168             }

Here is the call graph for this function:


Member Function Documentation

template<typename Value, size_t MaxSize>
void gslib::static_container::vector< Value, MaxSize >::assign param_type  value  )  [inline]
 

Definition at line 241 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::begin(), and gslib::static_container::vector< Value, MaxSize >::size().

00241                                              {
00242                 std::fill_n( begin(), size(), value );
00243             }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
template<typename InputIt>
void gslib::static_container::vector< Value, MaxSize >::assign InputIt  first,
InputIt  last
[inline]
 

代入

Definition at line 179 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::begin(), gslib::static_container::vector< Value, MaxSize >::clear(), and gslib::static_container::vector< Value, MaxSize >::size_.

Referenced by gslib::static_container::vector< Value, MaxSize >::operator=().

00179                                                        {
00180                 clear();
00181                 iterator dest = begin();
00182                 for ( InputIt src = first; src != last; ++src, ++dest ) {
00183                     new( dest ) Value( *src );
00184                     ++size_;
00185                 }
00186             }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
param_type gslib::static_container::vector< Value, MaxSize >::at size_type  i  )  const [inline]
 

Definition at line 227 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::operator[]().

00227 { return operator [] ( i ); }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
reference gslib::static_container::vector< Value, MaxSize >::at size_type  i  )  [inline]
 

Definition at line 226 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::operator[]().

00226 { return operator [] ( i ); }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
param_type gslib::static_container::vector< Value, MaxSize >::back  )  const [inline]
 

Definition at line 233 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::end().

00233 { return *( end() - 1 ); }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
reference gslib::static_container::vector< Value, MaxSize >::back  )  [inline]
 

Definition at line 232 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::end().

00232 { return *( end() - 1 ); }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
const_iterator gslib::static_container::vector< Value, MaxSize >::begin  )  const [inline]
 

Definition at line 122 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::top().

00122 { return reinterpret_cast< const_iterator >( top() ); }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
iterator gslib::static_container::vector< Value, MaxSize >::begin  )  [inline]
 

Definition at line 121 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::top().

Referenced by gslib::static_container::vector< Value, MaxSize >::assign(), gslib::static_container::vector< Value, MaxSize >::clear(), gslib::static_container::vector< Value, MaxSize >::end(), gslib::static_container::vector< Value, MaxSize >::front(), gslib::static_container::vector< Value, MaxSize >::operator=(), gslib::static_container::vector< Value, MaxSize >::operator[](), gslib::static_container::vector< Value, MaxSize >::swap(), and gslib::static_container::vector< Value, MaxSize >::vector().

00121 { return reinterpret_cast< iterator >( top() ); }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
gslib::static_container::vector< Value, MaxSize >::BOOST_STATIC_CONSTANT size_type  ,
const_max  = MaxSize
 

最大サイズ

template<typename Value, size_t MaxSize>
size_type gslib::static_container::vector< Value, MaxSize >::capaciry  )  [inline, static]
 

容量取得

Definition at line 116 of file vector.h.

00116 { return const_max; }

template<typename Value, size_t MaxSize>
void gslib::static_container::vector< Value, MaxSize >::clear  )  [inline]
 

空ベクトル化

Definition at line 208 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::begin(), gslib::static_container::vector< Value, MaxSize >::destruct(), gslib::static_container::vector< Value, MaxSize >::end(), and gslib::static_container::vector< Value, MaxSize >::size_.

Referenced by gslib::static_container::vector< Value, MaxSize >::assign(), and gslib::static_container::vector< Value, MaxSize >::~vector().

00208                          {
00209                 for ( iterator it = begin(); it != end(); ++it ) {
00210                     destruct( *it );
00211                 }
00212                 size_ = 0;
00213             }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
void gslib::static_container::vector< Value, MaxSize >::destruct reference  v  )  [inline, static, private]
 

Definition at line 95 of file vector.h.

Referenced by gslib::static_container::vector< Value, MaxSize >::clear(), and gslib::static_container::vector< Value, MaxSize >::pop_back().

00095                                                 {
00096                 static_container::destruct< Value >( v );
00097             }

template<typename Value, size_t MaxSize>
bool gslib::static_container::vector< Value, MaxSize >::empty  )  const [inline]
 

Definition at line 223 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::size().

Referenced by gslib::static_container::vector< Value, MaxSize >::pop_back().

00223                                {
00224                 return 0 == size();
00225             }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
const_iterator gslib::static_container::vector< Value, MaxSize >::end  )  const [inline]
 

Definition at line 124 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::begin(), and gslib::static_container::vector< Value, MaxSize >::size().

00124 { return begin() + size(); }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
iterator gslib::static_container::vector< Value, MaxSize >::end  )  [inline]
 

Definition at line 123 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::begin(), and gslib::static_container::vector< Value, MaxSize >::size().

Referenced by gslib::static_container::vector< Value, MaxSize >::back(), gslib::static_container::vector< Value, MaxSize >::clear(), gslib::static_container::vector< Value, MaxSize >::erase(), gslib::static_container::vector< Value, MaxSize >::operator=(), and gslib::static_container::vector< Value, MaxSize >::swap().

00123 { return begin() + size(); }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
void gslib::static_container::vector< Value, MaxSize >::erase iterator  first,
iterator  last
[inline]
 

現在、非常に重い動作です。 要望があれば高速化します。

Definition at line 199 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::end(), and gslib::static_container::vector< Value, MaxSize >::pop_back().

00199                                                         {
00200                 difference_type sizeDiff = std::distance( first, last );
00201                 rotate( first, last, end() );
00202                 for ( size_type i = 0; i < sizeDiff; ++i ) {
00203                     pop_back();
00204                 }
00205             }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
void gslib::static_container::vector< Value, MaxSize >::erase iterator  it  )  [inline]
 

it を削除します

Definition at line 189 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::end(), and gslib::static_container::vector< Value, MaxSize >::pop_back().

00189                                       {
00190                 rotate( it, it + 1, end() );
00191                 pop_back();
00192             }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
param_type gslib::static_container::vector< Value, MaxSize >::front  )  const [inline]
 

Definition at line 231 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::begin().

00231 { return *begin(); }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
reference gslib::static_container::vector< Value, MaxSize >::front  )  [inline]
 

Definition at line 230 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::begin().

00230 { return *begin(); }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
size_type gslib::static_container::vector< Value, MaxSize >::max_size  )  [inline, static]
 

最大サイズ取得

Definition at line 113 of file vector.h.

Referenced by gslib::static_container::vector< Value, MaxSize >::push_back(), and gslib::static_container::vector< Value, MaxSize >::vector().

00113 { return const_max; }

template<typename Value, size_t MaxSize>
vector& gslib::static_container::vector< Value, MaxSize >::operator= const vector< Value, MaxSize > &  other  )  [inline]
 

代入演算子

Definition at line 170 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::assign(), gslib::static_container::vector< Value, MaxSize >::begin(), and gslib::static_container::vector< Value, MaxSize >::end().

00170                                                        {
00171                 if ( this != &other ) {
00172                     assign( other.begin(), other.end() );
00173                 }
00174                 return *this;
00175             }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
const Value& gslib::static_container::vector< Value, MaxSize >::operator[] size_type  i  )  const [inline]
 

Definition at line 219 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::begin(), and gslib::static_container::vector< Value, MaxSize >::size().

00219                                                            {
00220                 PYD_ASSERT( i < size() );
00221                 return *( begin() + i );
00222             }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
Value& gslib::static_container::vector< Value, MaxSize >::operator[] size_type  i  )  [inline]
 

Definition at line 215 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::begin(), and gslib::static_container::vector< Value, MaxSize >::size().

Referenced by gslib::static_container::vector< Value, MaxSize >::at().

00215                                                {
00216                 PYD_ASSERT( i < size() );
00217                 return *( begin() + i );
00218             }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
void gslib::static_container::vector< Value, MaxSize >::pop_back  )  [inline]
 

末尾要素削除

Definition at line 134 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::destruct(), gslib::static_container::vector< Value, MaxSize >::empty(), gslib::static_container::vector< Value, MaxSize >::size(), gslib::static_container::vector< Value, MaxSize >::size_, and gslib::static_container::vector< Value, MaxSize >::top().

Referenced by gslib::static_container::vector< Value, MaxSize >::erase().

00134                             {
00135                 BOOST_ASSERT( false == empty() );
00136                 --size_;
00137                 destruct( top()[ size() ] );
00138             }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
void gslib::static_container::vector< Value, MaxSize >::push_back param_type  v  )  [inline]
 

末尾に対する要素追加

Definition at line 127 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::max_size(), gslib::static_container::vector< Value, MaxSize >::size(), gslib::static_container::vector< Value, MaxSize >::size_, and gslib::static_container::vector< Value, MaxSize >::top().

00127                                            {
00128                 BOOST_ASSERT( size() < max_size() );
00129                 new( &top()[ size() ] ) Value( v );
00130                 ++size_;
00131             }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
size_type gslib::static_container::vector< Value, MaxSize >::size  )  const [inline]
 

サイズ取得

Definition at line 119 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::size_.

Referenced by gslib::static_container::vector< Value, MaxSize >::assign(), gslib::static_container::vector< Value, MaxSize >::empty(), gslib::static_container::vector< Value, MaxSize >::end(), gslib::static_container::vector< Value, MaxSize >::operator[](), gslib::static_container::vector< Value, MaxSize >::pop_back(), and gslib::static_container::vector< Value, MaxSize >::push_back().

00119 { return size_; }

template<typename Value, size_t MaxSize>
void gslib::static_container::vector< Value, MaxSize >::swap vector< Value, MaxSize > &  other  )  [inline]
 

置換

Definition at line 236 of file vector.h.

References gslib::static_container::vector< Value, MaxSize >::begin(), and gslib::static_container::vector< Value, MaxSize >::end().

00236                                        {
00237                 std::swap_ranges( begin(), end(), other.begin() );
00238             }

Here is the call graph for this function:

template<typename Value, size_t MaxSize>
const_pointer gslib::static_container::vector< Value, MaxSize >::top  )  const [inline, private]
 

実装用。 先頭要素のアドレスを得る

Definition at line 105 of file vector.h.

00105                                         {
00106                 return reinterpret_cast< const_pointer >( buffer_ );
00107             }

template<typename Value, size_t MaxSize>
pointer gslib::static_container::vector< Value, MaxSize >::top  )  [inline, private]
 

実装用。 先頭要素のアドレスを得る

Definition at line 100 of file vector.h.

Referenced by gslib::static_container::vector< Value, MaxSize >::begin(), gslib::static_container::vector< Value, MaxSize >::pop_back(), and gslib::static_container::vector< Value, MaxSize >::push_back().

00100                           {
00101                 return reinterpret_cast< pointer >( buffer_ );
00102             }


Member Data Documentation

template<typename Value, size_t MaxSize>
uint8_t gslib::static_container::vector< Value, MaxSize >::buffer_[ MaxSize * sizeof( Value ) ] [private]
 

Definition at line 93 of file vector.h.

template<typename Value, size_t MaxSize>
size_type gslib::static_container::vector< Value, MaxSize >::size_ [private]
 

Definition at line 92 of file vector.h.

Referenced by gslib::static_container::vector< Value, MaxSize >::assign(), gslib::static_container::vector< Value, MaxSize >::clear(), gslib::static_container::vector< Value, MaxSize >::pop_back(), gslib::static_container::vector< Value, MaxSize >::push_back(), gslib::static_container::vector< Value, MaxSize >::size(), and gslib::static_container::vector< Value, MaxSize >::vector().


The documentation for this class was generated from the following file:
Generated on Sat Nov 27 15:03:11 2004 for static_container by doxygen 1.3.6