summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Notify/Delivery_Request.cpp
blob: 8df40fe1a130342fff89bcc1bc989bd5f1afe692 (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
// $Id$

#include "orbsvcs/Notify/Delivery_Request.h"

#if ! defined (__ACE_INLINE__)
#include "orbsvcs/Notify/Delivery_Request.inl"
#endif /* __ACE_INLINE__ */

#include "orbsvcs/Notify/Routing_Slip.h"

#include "tao/debug.h"
#include "tao/corba.h"

//#define DEBUG_LEVEL 9
#ifndef DEBUG_LEVEL
# define DEBUG_LEVEL TAO_debug_level
#endif //DEBUG_LEVEL

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

namespace TAO_Notify
{

///////////////////
// Delivery_Request
Delivery_Request::Delivery_Request (const Routing_Slip_Ptr & routing_slip, size_t request_id)
  : routing_slip_ (routing_slip)
  , request_id_ (request_id)
  , delivery_type_ (0)
{
  if (DEBUG_LEVEL > 8) ACE_DEBUG ((LM_DEBUG,
      ACE_TEXT ("(%P|%t) Delivery_Request:: constructor\n")
      ));
}

Delivery_Request::~Delivery_Request ()
{
  if (DEBUG_LEVEL > 8) ACE_DEBUG ((LM_DEBUG,
      ACE_TEXT ("(%P|%t) Delivery_Request:: destructor\n")
      ));
}

// DO NOT INLINE THIS.  It uses the Routing_Slip_Ptr which cannot be declared at
// the time Delivery_Request.inl is compiled.
void
Delivery_Request::complete ()
{
  routing_slip_->delivery_request_complete (this->request_id_);
}

// DO NOT INLINE THIS.  It uses the Routing_Slip_Ptr which cannot be declared at
// the time Delivery_Request.inl is compiled.
const TAO_Notify_Event::Ptr &
Delivery_Request::event () const
{
  return this->routing_slip_->event ();
}

void
Delivery_Request::marshal (TAO_OutputCDR & cdr)
{
  if (this->delivery_type_ != 0)
  {
    cdr.write_octet (this->delivery_type_);
    size_t dest_count = this->destination_id_.size ();
    cdr.write_ulong (dest_count);
    for (size_t ndest = 0; ndest < dest_count; ++ ndest)
    {
      cdr.write_ulong (this->destination_id_ [ndest]);
    }
  }
}

unsigned long
Delivery_Request::sequence () const
{
  return this->routing_slip_->sequence ();
}


bool
Delivery_Request::should_retry () const
{
  return this->routing_slip_->should_retry ();
}

void
Delivery_Request::dispatch (
  TAO_Notify_ProxySupplier * proxy_supplier,
  bool filter)
{
  this->routing_slip_->dispatch (proxy_supplier, filter);
}

const Routing_Slip_Ptr &
Delivery_Request::routing_slip () const
{
  return this->routing_slip_;
}

} // namespace

TAO_END_VERSIONED_NAMESPACE_DECL