Array class that provides a means to reset the underlying ACE_Allocator
.
More...
#include <DurabilityArray.h>
Public Member Functions | |
DurabilityArray (size_t size, ACE_Allocator *allocator) | |
DurabilityArray (size_t size, T const &default_value, ACE_Allocator *allocator) | |
DurabilityArray (DurabilityArray< T > const &rhs) | |
~DurabilityArray () | |
void | operator= (DurabilityArray< T > const &rhs) |
void | set_allocator (ACE_Allocator *allocator) |
Reset allocator. | |
void | swap (DurabilityArray< T > &rhs) |
Array 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_Array_Base
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_Array_Base
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. increasing the size of the array).
Definition at line 38 of file DurabilityArray.h.
OpenDDS::DCPS::DurabilityArray< T >::DurabilityArray | ( | size_t | size, | |
ACE_Allocator * | allocator | |||
) | [inline] |
Definition at line 41 of file DurabilityArray.h.
00043 : ACE_Array_Base<T> (size, allocator) 00044 {}
OpenDDS::DCPS::DurabilityArray< T >::DurabilityArray | ( | size_t | size, | |
T const & | default_value, | |||
ACE_Allocator * | allocator | |||
) | [inline] |
Definition at line 46 of file DurabilityArray.h.
00049 : ACE_Array_Base<T> (size, default_value, allocator) 00050 {}
OpenDDS::DCPS::DurabilityArray< T >::DurabilityArray | ( | DurabilityArray< T > const & | rhs | ) | [inline] |
Definition at line 52 of file DurabilityArray.h.
References ACE_Array_Base< T >::array_.
00053 : ACE_Array_Base<T> (rhs.size(), rhs.allocator_) 00054 { 00055 for (size_t i = 0; i < this->size_; ++i) 00056 this->array_[i] = rhs.array_[i]; 00057 }
OpenDDS::DCPS::DurabilityArray< T >::~DurabilityArray | ( | ) | [inline] |
Definition at line 59 of file DurabilityArray.h.
void OpenDDS::DCPS::DurabilityArray< T >::operator= | ( | DurabilityArray< T > const & | rhs | ) | [inline] |
Reimplemented from ACE_Array_Base< T >.
Definition at line 62 of file DurabilityArray.h.
References OpenDDS::DCPS::DurabilityArray< T >::swap().
00063 { 00064 DurabilityArray tmp(rhs); 00065 this->swap(rhs); 00066 }
void OpenDDS::DCPS::DurabilityArray< T >::set_allocator | ( | ACE_Allocator * | allocator | ) | [inline] |
Reset allocator.
Definition at line 69 of file DurabilityArray.h.
References ACE_Array_Base< T >::allocator_, and ACE_Allocator::instance().
00070 { 00071 if (allocator == 0) 00072 allocator = ACE_Allocator::instance(); 00073 00074 this->allocator_ = allocator; 00075 }
void OpenDDS::DCPS::DurabilityArray< T >::swap | ( | DurabilityArray< T > & | rhs | ) | [inline] |
Reimplemented from ACE_Array_Base< T >.
Definition at line 77 of file DurabilityArray.h.
References ACE_Array_Base< T >::allocator_, ACE_Array_Base< T >::array_, ACE_Array_Base< T >::cur_size_, and ACE_Array_Base< T >::max_size_.
Referenced by OpenDDS::DCPS::DurabilityArray< T >::operator=().
00078 { 00079 std::swap(this->max_size_, rhs.max_size_); 00080 std::swap(this->cur_size_, rhs.current_size_); 00081 std::swap(this->array_, rhs.array_); 00082 std::swap(this->allocator_, rhs.allocator_); 00083 }