OpenDDS::DCPS::DurabilityArray< T > Class Template Reference

Array class that provides a means to reset the underlying ACE_Allocator. More...

#include <DurabilityArray.h>

List of all members.

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)


Detailed Description

template<typename T>
class OpenDDS::DCPS::DurabilityArray< T >

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 36 of file DurabilityArray.h.


Constructor & Destructor Documentation

template<typename T>
OpenDDS::DCPS::DurabilityArray< T >::DurabilityArray ( size_t  size,
ACE_Allocator allocator 
) [inline]

Definition at line 39 of file DurabilityArray.h.

00041     : ACE_Array_Base<T> (size, allocator)
00042   {}

template<typename T>
OpenDDS::DCPS::DurabilityArray< T >::DurabilityArray ( size_t  size,
T const &  default_value,
ACE_Allocator allocator 
) [inline]

Definition at line 44 of file DurabilityArray.h.

00047     : ACE_Array_Base<T> (size, default_value, allocator)
00048   {}

template<typename T>
OpenDDS::DCPS::DurabilityArray< T >::DurabilityArray ( DurabilityArray< T > const &  rhs  )  [inline]

Definition at line 50 of file DurabilityArray.h.

00051     : ACE_Array_Base<T> (rhs.size(), rhs.allocator_)
00052   {
00053     for (size_t i = 0; i < this->size_; ++i)
00054       this->array_[i] = rhs.array_[i];
00055   }

template<typename T>
OpenDDS::DCPS::DurabilityArray< T >::~DurabilityArray (  )  [inline]

Definition at line 57 of file DurabilityArray.h.

00058   {}


Member Function Documentation

template<typename T>
void OpenDDS::DCPS::DurabilityArray< T >::operator= ( DurabilityArray< T > const &  rhs  )  [inline]

Definition at line 60 of file DurabilityArray.h.

References OpenDDS::DCPS::DurabilityArray< T >::swap().

00061   {
00062     DurabilityArray tmp(rhs);
00063     this->swap(rhs);
00064   }

template<typename T>
void OpenDDS::DCPS::DurabilityArray< T >::set_allocator ( ACE_Allocator allocator  )  [inline]

Reset allocator.

Definition at line 67 of file DurabilityArray.h.

References allocator_.

00068   {
00069     if (allocator == 0)
00070       allocator = ACE_Allocator::instance();
00071 
00072     this->allocator_ = allocator;
00073   }

template<typename T>
void OpenDDS::DCPS::DurabilityArray< T >::swap ( DurabilityArray< T > &  rhs  )  [inline]

Definition at line 75 of file DurabilityArray.h.

References OpenDDS::DCPS::swap().

Referenced by OpenDDS::DCPS::DurabilityArray< T >::operator=().

00076   {
00077     std::swap(this->max_size_, rhs.max_size_);
00078     std::swap(this->cur_size_, rhs.current_size_);
00079     std::swap(this->array_, rhs.array_);
00080     std::swap(this->allocator_, rhs.allocator_);
00081   }


The documentation for this class was generated from the following file:
Generated on Fri Feb 12 20:06:17 2016 for OpenDDS by  doxygen 1.4.7