summaryrefslogtreecommitdiff
path: root/TAO/tao/Queued_Message.cpp
blob: 8b4b73072c9fc35e54bb3559bab3bad35577d38c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// $Id$

#include "tao/Queued_Message.h"

ACE_RCSID (tao,
           Queued_Message,
           "$Id$")


TAO_BEGIN_VERSIONED_NAMESPACE_DECL

TAO_Queued_Message::TAO_Queued_Message (TAO_ORB_Core *oc,
                                        ACE_Allocator *alloc,
                                        bool is_heap_allocated)
  : allocator_ (alloc)
  , is_heap_created_ (is_heap_allocated)
  , orb_core_ (oc)
  , next_ (0)
  , prev_ (0)
{
}

TAO_Queued_Message::~TAO_Queued_Message (void)
{
}

TAO_Queued_Message *
TAO_Queued_Message::next (void) const
{
  return this->next_;
}

TAO_Queued_Message *
TAO_Queued_Message::prev (void) const
{
  return this->prev_;
}

void
TAO_Queued_Message::remove_from_list (TAO_Queued_Message *&head,
                                      TAO_Queued_Message *&tail)
{
  if (this->prev_ != 0)
    {
      this->prev_->next_ = this->next_;
    }
  else if(head == this)
    {
      head = this->next_;
    }

  if (this->next_ != 0)
    {
      this->next_->prev_ = this->prev_;
    }
  else if(tail == this)
    {
      tail = this->prev_;
    }

  this->next_ = 0;
  this->prev_ = 0;
}

void
TAO_Queued_Message::push_back (TAO_Queued_Message *&head,
                               TAO_Queued_Message *&tail)
{
  if (tail == 0)
    {
      tail = this;
      head = this;
      this->next_ = 0;
      this->prev_ = 0;
    }
  else
    {
      tail->next_ = this;
      this->prev_ = tail;
      this->next_ = 0;
      tail = this;
    }
}

void
TAO_Queued_Message::push_front (TAO_Queued_Message *&head,
                                TAO_Queued_Message *&tail)
{
  if (head == 0)
    {
      tail = this;
      head = this;
      this->next_ = 0;
      this->prev_ = 0;
    }
  else
    {
      head->prev_ = this;
      this->next_ = head;
      this->prev_ = 0;
      head = this;
    }
}

TAO_END_VERSIONED_NAMESPACE_DECL