Queue class that provides a means to reset the underlying ACE_Allocator
.
More...
#include <DurabilityQueue.h>
Public Member Functions | |
DurabilityQueue (ACE_Allocator *allocator) | |
DurabilityQueue (DurabilityQueue< T > const &rhs) | |
~DurabilityQueue () | |
void | operator= (DurabilityQueue< T > const &rhs) |
void | set_allocator (ACE_Allocator *allocator) |
Reset allocator. | |
void | swap (DurabilityQueue< T > &rhs) |
typedef | OPENDDS_VECTOR (OPENDDS_STRING) fs_path_t |
Public Attributes | |
fs_path_t | fs_path_ |
Queue class that provides a means to reset the underlying ACE_Allocator
.
This class only exists to provide a means to reset the allocator used by the ACE_Unbounded_Queue
base class. It has a specific use case, namely to correctly support instances created by a persistent allocator. The allocator address may change between process runs, meaning the allocator address stored in the persistent ACE_Unbounded_Queue
instance will be invalid. Use the set_allocator()
method to reset the allocator address before performing any operations that will require use of the allocator (e.g. enqueuing new items).
Definition at line 38 of file DurabilityQueue.h.
OpenDDS::DCPS::DurabilityQueue< T >::DurabilityQueue | ( | ACE_Allocator * | allocator | ) | [inline] |
Definition at line 41 of file DurabilityQueue.h.
00042 : ACE_Unbounded_Queue<T> (allocator) 00043 {}
OpenDDS::DCPS::DurabilityQueue< T >::DurabilityQueue | ( | DurabilityQueue< T > const & | rhs | ) | [inline] |
Definition at line 45 of file DurabilityQueue.h.
References ACE_Unbounded_Queue< T >::delete_nodes(), ACE_Unbounded_Queue< T >::enqueue_tail(), ACE_Unbounded_Queue< T >::head_, and ACE_Node< T, C >::next_.
00046 : ACE_Unbounded_Queue<T> (rhs.allocator_) 00047 , fs_path_(rhs.fs_path_) 00048 { 00049 // Copied from ACE_Unbounded_Queue<>::copy_nodes(). 00050 for (ACE_Node<T> *curr = rhs.head_->next_; 00051 curr != rhs.head_; 00052 curr = curr->next_) 00053 if (this->enqueue_tail(curr->item_) == -1) 00054 this->delete_nodes(); 00055 }
OpenDDS::DCPS::DurabilityQueue< T >::~DurabilityQueue | ( | ) | [inline] |
Definition at line 57 of file DurabilityQueue.h.
typedef OpenDDS::DCPS::DurabilityQueue< T >::OPENDDS_VECTOR | ( | OPENDDS_STRING | ) |
void OpenDDS::DCPS::DurabilityQueue< T >::operator= | ( | DurabilityQueue< T > const & | rhs | ) | [inline] |
Reimplemented from ACE_Unbounded_Queue< T >.
Definition at line 59 of file DurabilityQueue.h.
References OpenDDS::DCPS::DurabilityQueue< T >::swap().
00059 { 00060 DurabilityQueue tmp(rhs); 00061 this->swap(rhs); 00062 }
void OpenDDS::DCPS::DurabilityQueue< T >::set_allocator | ( | ACE_Allocator * | allocator | ) | [inline] |
Reset allocator.
Definition at line 65 of file DurabilityQueue.h.
References ACE_Unbounded_Queue< T >::allocator_, and ACE_Allocator::instance().
00065 { 00066 if (allocator == 0) 00067 allocator = ACE_Allocator::instance(); 00068 00069 this->allocator_ = allocator; 00070 }
void OpenDDS::DCPS::DurabilityQueue< T >::swap | ( | DurabilityQueue< T > & | rhs | ) | [inline] |
Definition at line 72 of file DurabilityQueue.h.
References ACE_Unbounded_Queue< T >::allocator_, ACE_Unbounded_Queue< T >::cur_size_, OpenDDS::DCPS::DurabilityQueue< T >::fs_path_, and ACE_Unbounded_Queue< T >::head_.
Referenced by OpenDDS::DCPS::DurabilityQueue< T >::operator=().
00072 { 00073 std::swap(this->head_, rhs.head_); 00074 std::swap(this->cur_size_, rhs.current_size_); 00075 std::swap(this->allocator_, rhs.allocator_); 00076 std::swap(this->fs_path_, rhs.fs_path_); 00077 }
fs_path_t OpenDDS::DCPS::DurabilityQueue< T >::fs_path_ |
Definition at line 81 of file DurabilityQueue.h.
Referenced by OpenDDS::DCPS::DurabilityQueue< T >::swap().