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

# gslib::static_container::lodge_list< Value > Class Template Reference

list_node_pool からノードを借りてリンクリストをつなげていく。 利用が終わったら、list_node_pool にノードを返す。 More...

`#include <lodge_list.h>`

Inheritance diagram for gslib::static_container::lodge_list< Value >:

[legend]
Collaboration diagram for gslib::static_container::lodge_list< Value >:

[legend]
List of all members.

## Public Types
typedef list_link | link
typedef list_node< Value > | node
typedef abstruct_list_node_pool< Value > | pool
typedef boost::call_traits< Value >::param_type | param_type
## Public Member Functions
| lodge_list (pool &ioPool)
| lodge_list (const lodge_list &other)
| ~lodge_list ()
lodge_list & | operator= (const lodge_list &other)
iterator | begin ()
iterator | end ()
const_iterator | begin () const
const_iterator | end () const
reference | push_back ()
Value * | allocate (iterator pos=end())
| ノードは、pos の直前に連結される
void | insert (iterator pos, param_type v)
| prev = pos - 1 とすると、元々 prev, pos と接続されていたものが、prev, v, pos の順に接続される。
template<typename It> void | insert (iterator pos, It first, It last)
| prev = pos - 1 とすると、元々 prev, pos と接続されていたものが、prev, v, pos の順に接続される。
void | push_front (param_type v)
| 先頭に追加
void | push_back (param_type v)
| 末尾に追加
void | erase (iterator pos)
| pos で示される要素を削除
void | erase (iterator first, iterator last)
| 区間 [ first, last ) を削除
void | clear ()
| クリア（全要素削除）
void | pop_front ()
| 先頭を削除
void | pop_back ()
| 末尾を削除
void | remove (const Value &value)
| 値 value を持つ要素を削除する
template<typename Pred> void | remove_if (Pred pred)
| pred( *it ) が true を返すときに it を削除する
size_type | size () const
| サイズ取得
bool | empty () const
| 空かどうか？
reference | front ()
| 先頭を取得
param_type | front () const
| 先頭を取得
reference | back ()
| 末尾を取得
param_type | back () const
| 末尾を取得
## Private Member Functions
void | init ()
## Static Private Member Functions
void | destruct (Value &v)
## Private Attributes
link | end_
pool * | pool_

## Detailed Description

### template<typename Value>
class gslib::static_container::lodge_list< Value >

list_node_pool からノードを借りてリンクリストをつなげていく。 利用が終わったら、list_node_pool にノードを返す。

lodge_list 利用中に list_node_pool を破棄してはならない。

http://www.alc.co.jp/ で、 lodge = 【自動-1】 泊まる、宿泊｛しゅくはく｝する、下宿｛げしゅく｝する とあったので、命名したが、もっと良い名前があれば、随時募集。

Definition at line 80 of file lodge_list.h.

## Member Typedef Documentation

template<typename Value>
typedef list_link gslib::static_container::lodge_list< Value >::link

| Definition at line 82 of file lodge_list.h.

template<typename Value>
typedef list_node< Value > gslib::static_container::lodge_list< Value >::node

| Definition at line 83 of file lodge_list.h.

template<typename Value>
typedef boost::call_traits< Value >::param_type gslib::static_container::lodge_list< Value >::param_type

| Definition at line 87 of file lodge_list.h.

template<typename Value>
typedef abstruct_list_node_pool< Value > gslib::static_container::lodge_list< Value >::pool

| Reimplemented in gslib::static_container::list< Value, MaxSize >, and gslib::static_container::list< std::pair< Key, Value >, MaxSize >. Definition at line 85 of file lodge_list.h.

## Constructor & Destructor Documentation

template<typename Value>
gslib::static_container::lodge_list< Value >::lodge_list | ( | pool & | ioPool | ) | `[inline]`

| Definition at line 230 of file lodge_list.h.
    00230                                        : pool_( &ioPool ) {
    00231                 init();
    00232             }

template<typename Value>
gslib::static_container::lodge_list< Value >::lodge_list | ( | const lodge_list< Value > & | other | ) | `[inline]`

| Definition at line 233 of file lodge_list.h.
    00233                                                   : pool_( other.pool_ ) {
    00234                 init();
    00235                 insert( begin(), other.begin(), other.end() );
    00236             }

template<typename Value>
gslib::static_container::lodge_list< Value >::~lodge_list | ( |  | ) | `[inline]`

| Definition at line 237 of file lodge_list.h.
    00237                           {
    00238                 clear();
    00239             }

## Member Function Documentation

template<typename Value>
Value* gslib::static_container::lodge_list< Value >::allocate | ( | iterator | pos = end() | ) | `[inline]`

| ノードは、pos の直前に連結される Definition at line 273 of file lodge_list.h. Referenced by gslib::static_container::lodge_list< std::pair< Key, Value > >::insert().
    00273                                                     {
    00274                 node* n = pool_->allocate();
    00275                 BOOST_ASSERT( 0 != n );
    00276                 iterator prev = pos;
    00277                 --prev;
    00278                 prev.setNext( n );
    00279                 pos.setPrev( n );
    00280                 n->next = pos.getNode();
    00281                 n->prev = prev.getNode();
    00282                 return &n->value;
    00283             }

template<typename Value>
param_type gslib::static_container::lodge_list< Value >::back | ( |  | ) | const`[inline]`

| 末尾を取得 Definition at line 393 of file lodge_list.h.
    00393                                     {
    00394                 return *( --end() );
    00395             }

template<typename Value>
reference gslib::static_container::lodge_list< Value >::back | ( |  | ) | `[inline]`

| 末尾を取得 Definition at line 389 of file lodge_list.h.
    00389                              {
    00390                 return *( --end() );
    00391             }

template<typename Value>
const_iterator gslib::static_container::lodge_list< Value >::begin | ( |  | ) | const`[inline]`

| Definition at line 256 of file lodge_list.h.
    00256                                          {
    00257                 return const_iterator( end_.next );
    00258             }

template<typename Value>
iterator gslib::static_container::lodge_list< Value >::begin | ( |  | ) | `[inline]`

| Definition at line 250 of file lodge_list.h. Referenced by gslib::static_container::lodge_list< std::pair< Key, Value > >::clear(), gslib::static_container::lodge_list< std::pair< Key, Value > >::front(), gslib::static_container::list< std::pair< Key, Value >, MaxSize >::list(), gslib::static_container::lodge_list< std::pair< Key, Value > >::lodge_list(), gslib::static_container::lodge_list< std::pair< Key, Value > >::operator=(), gslib::static_container::list< std::pair< Key, Value >, MaxSize >::operator=(), gslib::static_container::lodge_list< std::pair< Key, Value > >::pop_front(), gslib::static_container::lodge_list< std::pair< Key, Value > >::push_front(), gslib::static_container::lodge_list< std::pair< Key, Value > >::remove_if(), and gslib::static_container::lodge_list< std::pair< Key, Value > >::size().
    00250                              {
    00251                 return iterator( end_.next );
    00252             }

template<typename Value>
void gslib::static_container::lodge_list< Value >::clear | ( |  | ) | `[inline]`

| クリア（全要素削除） Definition at line 336 of file lodge_list.h. Referenced by gslib::static_container::lodge_list< std::pair< Key, Value > >::operator=(), gslib::static_container::list< std::pair< Key, Value >, MaxSize >::operator=(), and gslib::static_container::lodge_list< std::pair< Key, Value > >::~lodge_list().
    00336                          {
    00337                 erase( begin(), end() );
    00338             }

template<typename Value>
void gslib::static_container::lodge_list< Value >::destruct | ( | Value & | v | ) | `[inline, static, private]`

| Definition at line 89 of file lodge_list.h. Referenced by gslib::static_container::lodge_list< std::pair< Key, Value > >::erase().
    00089                                              {
    00090                 static_container::destruct< Value >( v );
    00091             }

template<typename Value>
bool gslib::static_container::lodge_list< Value >::empty | ( |  | ) | const`[inline]`

| 空かどうか？ Definition at line 376 of file lodge_list.h.
    00376                                {
    00377                 return end_.next == &end_;
    00378             }

template<typename Value>
const_iterator gslib::static_container::lodge_list< Value >::end | ( |  | ) | const`[inline]`

| Definition at line 259 of file lodge_list.h.
    00259                                        {
    00260                 return const_iterator( &end_ );
    00261             }

template<typename Value>
iterator gslib::static_container::lodge_list< Value >::end | ( |  | ) | `[inline]`

| Definition at line 253 of file lodge_list.h. Referenced by gslib::static_container::lodge_list< std::pair< Key, Value > >::back(), gslib::static_container::lodge_list< std::pair< Key, Value > >::clear(), gslib::static_container::list< std::pair< Key, Value >, MaxSize >::list(), gslib::static_container::lodge_list< std::pair< Key, Value > >::lodge_list(), gslib::static_container::lodge_list< std::pair< Key, Value > >::operator=(), gslib::static_container::list< std::pair< Key, Value >, MaxSize >::operator=(), gslib::static_container::lodge_list< std::pair< Key, Value > >::pop_back(), gslib::static_container::lodge_list< std::pair< Key, Value > >::push_back(), gslib::static_container::lodge_list< std::pair< Key, Value > >::remove_if(), and gslib::static_container::lodge_list< std::pair< Key, Value > >::size().
    00253                            {
    00254                 return iterator( &end_ );
    00255             }

template<typename Value>
void gslib::static_container::lodge_list< Value >::erase | ( | iterator | first,
|  | iterator | last
| ) | `[inline]`

| 区間 [ first, last ) を削除 Definition at line 328 of file lodge_list.h.
    00328                                                         {
    00329                 //  解放
    00330                 std::for_each( first, last, destruct );
    00331                 //  node を pool に返す
    00332                 pool_->deallocate( first.getNode(), last.getNode() );
    00333             }

template<typename Value>
void gslib::static_container::lodge_list< Value >::erase | ( | iterator | pos | ) | `[inline]`

| pos で示される要素を削除 Definition at line 319 of file lodge_list.h. Referenced by gslib::static_container::lodge_list< std::pair< Key, Value > >::clear(), gslib::static_container::lodge_list< std::pair< Key, Value > >::pop_back(), gslib::static_container::lodge_list< std::pair< Key, Value > >::pop_front(), and gslib::static_container::lodge_list< std::pair< Key, Value > >::remove_if().
    00319                                        {
    00320                 //  解放
    00321                 destruct( *pos );
    00322
    00323                 //  node を pool に返す
    00324                 pool_->deallocate( pos.getNode() );
    00325             }

template<typename Value>
param_type gslib::static_container::lodge_list< Value >::front | ( |  | ) | const`[inline]`

| 先頭を取得 Definition at line 385 of file lodge_list.h.
    00385                                      {
    00386                 return *begin();
    00387             }

template<typename Value>
reference gslib::static_container::lodge_list< Value >::front | ( |  | ) | `[inline]`

| 先頭を取得 Definition at line 381 of file lodge_list.h.
    00381                               {
    00382                 return *begin();
    00383             }

template<typename Value>
void gslib::static_container::lodge_list< Value >::init | ( |  | ) | `[inline, private]`

| Definition at line 224 of file lodge_list.h. Referenced by gslib::static_container::lodge_list< std::pair< Key, Value > >::lodge_list().
    00224                         {
    00225                 end_.next = &end_;
    00226                 end_.prev = &end_;
    00227             }

template<typename Value>
template<typename It>
void gslib::static_container::lodge_list< Value >::insert | ( | iterator | pos,
|  | It | first,
|  | It | last
| ) | `[inline]`

| prev = pos - 1 とすると、元々 prev, pos と接続されていたものが、prev, v, pos の順に接続される。 Definition at line 300 of file lodge_list.h.
    00300                                                            {
    00301                 for ( ; first != last; ++first ) {
    00302                     Value* val = allocate( pos );
    00303                     //  コンストラクタ呼び出し
    00304                     new( val ) Value( *first );
    00305                 }
    00306             }

template<typename Value>
void gslib::static_container::lodge_list< Value >::insert | ( | iterator | pos,
|  | param_type | v
| ) | `[inline]`

| prev = pos - 1 とすると、元々 prev, pos と接続されていたものが、prev, v, pos の順に接続される。 Definition at line 289 of file lodge_list.h. Referenced by gslib::static_container::list< std::pair< Key, Value >, MaxSize >::list(), gslib::static_container::lodge_list< std::pair< Key, Value > >::lodge_list(), gslib::static_container::lodge_list< std::pair< Key, Value > >::operator=(), gslib::static_container::list< std::pair< Key, Value >, MaxSize >::operator=(), gslib::static_container::lodge_list< std::pair< Key, Value > >::push_back(), and gslib::static_container::lodge_list< std::pair< Key, Value > >::push_front().
    00289                                                       {
    00290                 Value* val = allocate( pos );
    00291                 //  コンストラクタ呼び出し
    00292                 new( val ) Value( v );
    00293             }

template<typename Value>
lodge_list& gslib::static_container::lodge_list< Value >::operator= | ( | const lodge_list< Value > & | other | ) | `[inline]`

| Definition at line 241 of file lodge_list.h.
    00241                                                                {
    00242                 if ( this != &other ) {
    00243                     clear();
    00244                     pool_ = other.pool_;
    00245                     insert( begin(), other.begin(), other.end() );
    00246                 }
    00247                 return *this;
    00248             }

template<typename Value>
void gslib::static_container::lodge_list< Value >::pop_back | ( |  | ) | `[inline]`

| 末尾を削除 Definition at line 346 of file lodge_list.h.
    00346                             {
    00347                 erase( --end() );
    00348             }

template<typename Value>
void gslib::static_container::lodge_list< Value >::pop_front | ( |  | ) | `[inline]`

| 先頭を削除 Definition at line 341 of file lodge_list.h.
    00341                              {
    00342                 erase( begin() );
    00343             }

template<typename Value>
void gslib::static_container::lodge_list< Value >::push_back | ( | param_type | v | ) | `[inline]`

| 末尾に追加 Definition at line 314 of file lodge_list.h.
    00314                                            {
    00315                 insert( end(), v );
    00316             }

template<typename Value>
reference gslib::static_container::lodge_list< Value >::push_back | ( |  | ) | `[inline]`

| Definition at line 263 of file lodge_list.h.
    00263                                   {
    00264                 node* n = pool_->allocate();
    00265                 BOOST_ASSERT( 0 != n );
    00266                 return new( &n->value ) Value();
    00267             }

template<typename Value>
void gslib::static_container::lodge_list< Value >::push_front | ( | param_type | v | ) | `[inline]`

| 先頭に追加 Definition at line 309 of file lodge_list.h.
    00309                                             {
    00310                 return insert( begin(), v );
    00311             }

template<typename Value>
void gslib::static_container::lodge_list< Value >::remove | ( | const Value & | value | ) | `[inline]`

| 値 value を持つ要素を削除する Definition at line 351 of file lodge_list.h.
    00351                                               {
    00352                 remove_if( std::bind2nd( std::equal_to< value_type >(), value ) );
    00353             }

template<typename Value>
template<typename Pred>
void gslib::static_container::lodge_list< Value >::remove_if | ( | Pred | pred | ) | `[inline]`

| pred( *it ) が true を返すときに it を削除する Definition at line 360 of file lodge_list.h. Referenced by gslib::static_container::lodge_list< std::pair< Key, Value > >::remove().
    00360                                         {
    00361                 for ( iterator it = begin(); end() != it; ) {
    00362                     if ( pred( *it ) ) {
    00363                         erase( it++ );
    00364                     } else {
    00365                         ++it;
    00366                     }
    00367                 }
    00368             }

template<typename Value>
size_type gslib::static_container::lodge_list< Value >::size | ( |  | ) | const`[inline]`

| サイズ取得 Definition at line 371 of file lodge_list.h.
    00371                                    {
    00372                 return static_cast< size_type >( std::distance( begin(), end() ) );
    00373             }

## Member Data Documentation

template<typename Value>
link gslib::static_container::lodge_list< Value >::end_`[private]`

| Definition at line 221 of file lodge_list.h.

template<typename Value>
pool* gslib::static_container::lodge_list< Value >::pool_`[private]`

| Definition at line 222 of file lodge_list.h. Referenced by gslib::static_container::lodge_list< std::pair< Key, Value > >::operator=().

The documentation for this class was generated from the following file:

- lodge_list.h