OpenDDS  Snapshot(2023/04/07-19:43)
Public Member Functions | Public Attributes | List of all members
OpenDDS::DCPS::DurabilityQueue< T > Class Template Reference

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

#include <DurabilityQueue.h>

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

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. More...
 
void swap (DurabilityQueue< T > &rhs)
 
typedef OPENDDS_VECTOR (OPENDDS_STRING) fs_path_t
 
- Public Member Functions inherited from ACE_Unbounded_Queue< T >
 ACE_Unbounded_Queue (ACE_Allocator *alloc=0)
 
 ACE_Unbounded_Queue (const ACE_Unbounded_Queue< T > &)
 
void operator= (const ACE_Unbounded_Queue< T > &)
 
 ~ACE_Unbounded_Queue (void)
 
bool is_empty (void) const
 
bool is_full (void) const
 
int enqueue_tail (const T &new_item)
 
int enqueue_head (const T &new_item)
 
int dequeue_head (T &item)
 
void reset (void)
 
int get (T *&item, size_t slot=0) const
 
int set (const T &item, size_t slot)
 
size_t size (void) const
 
void dump (void) const
 
ACE_Unbounded_Queue_Iterator< T > begin (void)
 
ACE_Unbounded_Queue_Iterator< T > end (void)
 

Public Attributes

fs_path_t fs_path_
 
- Public Attributes inherited from ACE_Unbounded_Queue< T >
 ACE_ALLOC_HOOK_DECLARE
 

Additional Inherited Members

- Public Types inherited from ACE_Unbounded_Queue< T >
typedef ACE_Unbounded_Queue_Iterator< T > ITERATOR
 
typedef ACE_Unbounded_Queue_Const_Iterator< T > CONST_ITERATOR
 
- Protected Member Functions inherited from ACE_Unbounded_Queue< T >
void delete_nodes (void)
 
void copy_nodes (const ACE_Unbounded_Queue< T > &)
 
- Protected Attributes inherited from ACE_Unbounded_Queue< T >
ACE_Node< T > * head_
 
size_t cur_size_
 
ACE_Allocatorallocator_
 

Detailed Description

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

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.

Constructor & Destructor Documentation

◆ DurabilityQueue() [1/2]

template<typename T>
OpenDDS::DCPS::DurabilityQueue< T >::DurabilityQueue ( ACE_Allocator allocator)
inline

Definition at line 41 of file DurabilityQueue.h.

42  : ACE_Unbounded_Queue<T> (allocator)
43  {}

◆ DurabilityQueue() [2/2]

template<typename T>
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 >::next_.

46  : ACE_Unbounded_Queue<T> (rhs.allocator_)
47  , fs_path_(rhs.fs_path_)
48  {
49  // Copied from ACE_Unbounded_Queue<>::copy_nodes().
50  for (ACE_Node<T> *curr = rhs.head_->next_;
51  curr != rhs.head_;
52  curr = curr->next_)
53  if (this->enqueue_tail(curr->item_) == -1)
54  this->delete_nodes();
55  }
ACE_Node< T, void > * next_
int enqueue_tail(const T &new_item)
void delete_nodes(void)

◆ ~DurabilityQueue()

template<typename T>
OpenDDS::DCPS::DurabilityQueue< T >::~DurabilityQueue ( )
inline

Definition at line 57 of file DurabilityQueue.h.

57 {}

Member Function Documentation

◆ OPENDDS_VECTOR()

template<typename T>
typedef OpenDDS::DCPS::DurabilityQueue< T >::OPENDDS_VECTOR ( OPENDDS_STRING  )

◆ operator=()

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

Definition at line 59 of file DurabilityQueue.h.

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

59  {
60  DurabilityQueue tmp(rhs);
61  this->swap(rhs);
62  }
DurabilityQueue(ACE_Allocator *allocator)
void swap(DurabilityQueue< T > &rhs)

◆ set_allocator()

template<typename T>
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().

65  {
66  if (allocator == 0)
67  allocator = ACE_Allocator::instance();
68 
69  this->allocator_ = allocator;
70  }
static ACE_Allocator * instance(void)
ACE_Allocator * allocator_

◆ swap()

template<typename T>
void OpenDDS::DCPS::DurabilityQueue< T >::swap ( DurabilityQueue< T > &  rhs)
inline

Member Data Documentation

◆ fs_path_

template<typename T>
fs_path_t OpenDDS::DCPS::DurabilityQueue< T >::fs_path_

Definition at line 81 of file DurabilityQueue.h.

Referenced by OpenDDS::DCPS::DurabilityQueue< T >::swap().


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