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

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

#include <DurabilityArray.h>

Inheritance diagram for OpenDDS::DCPS::DurabilityArray< T >:
Inheritance graph
[legend]
Collaboration diagram for OpenDDS::DCPS::DurabilityArray< T >:
Collaboration graph
[legend]

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

00043     : ACE_Array_Base<T> (size, allocator)
00044   {}

template<typename T>
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   {}

template<typename T>
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   }

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

Definition at line 59 of file DurabilityArray.h.

00060   {}


Member Function Documentation

template<typename T>
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   }

Here is the call graph for this function:

template<typename T>
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   }

Here is the call graph for this function:

template<typename T>
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   }

Here is the caller graph for this function:


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1