blob: 6bdf5c084965f94fb50ab056ec986693cde2bb7c (
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
/* -*- C++ -*- */
// $Id$
#ifndef TAO_NOTIFY_DELIVERY_REQUEST_H
#define TAO_NOTIFY_DELIVERY_REQUEST_H
#include /**/ "ace/pre.h"
#include "notify_serv_export.h"
#include "Topology_Object.h"
#include "Event.h"
#include <ace/Vector_T.h>
#include <ace/Bound_Ptr.h>
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
// Forward declarations of referenced classes
class TAO_Notify_EventChannelFactory;
namespace TAO_Notify
{
// Forward declarations of TAO_Notify classes/pointers/collections declared
// in this header
class Delivery_Request;
/// A reference-counted smart pointer to a Delivery_Request.
typedef ACE_Strong_Bound_Ptr<Delivery_Request, TAO_SYNCH_MUTEX> Delivery_Request_Ptr;
typedef ACE_Unbounded_Queue<Delivery_Request_Ptr> Delivery_Request_Queue;
// Forward declarations of TAO_Notify classes/pointers/collections referenced
// in this header
class Routing_Slip;
typedef ACE_Strong_Bound_Ptr<Routing_Slip, TAO_SYNCH_MUTEX> Routing_Slip_Ptr;
/// \brief Represents a request to deliver an event to a particular destination.
///
/// A Routing Slip contains a collection of Delivery Requests.
/// A Delivery Request is associated with a Delivery Method. Delivery Methods
/// should be lightweight objects because they are copied, queued, and otherwise
/// passed around while they are waiting to be executed. The Delivery Request is
/// more stable.
class TAO_Notify_Serv_Export Delivery_Request
{
public:
/// Normal constructor
/// \param routing_slip the routing slip that owns this Delivery Request.
/// \param request_id an id that identifies this Delivery Request to the Routing Slip.
Delivery_Request (const Routing_Slip_Ptr & routing_slip, size_t request_id);
/// \brief A static "factory" method for use during restart.
///
/// \param routing_slip. The routing slip to which the new Delivery Request should be attached.
/// \param request_id The id used to identify this Delivery Request to the Routing Slip.
/// \param ecf The EventChannelFactory responsible for reloading this Delivery Method.
/// \param cdr A CDR stream from which the peristent information for this Delivery Requect can be retrieved.
/// \return a pointer to the newly-allocated Delivery Request
static Delivery_Request_Ptr create (
const Routing_Slip_Ptr & routing_slip,
size_t request_id,
TAO_Notify_EventChannelFactory & ecf,
TAO_InputCDR & cdr);
/// a normal destructor.
~Delivery_Request ();
/// \brief A method to indicate the delivery is complete.
///
/// To be called by the delivery method associated with this delivery request.
void complete ();
/// \brief An accessor method for the event associated with the Routing Slip that owns this Delivery request.
const TAO_Notify_Event_var & event () const;
/// \brief An accessor method for the routing slip that owns this request.
const Routing_Slip_Ptr & routing_slip ()const;
/// \brief Capture Delivery Type for the Delivery Method
///
/// Called by the delivery method to capture information that should be persisted.
void set_delivery_type (ACE_CDR::Octet type);
/// \brief Capture destination ID for the Delivery Request.
///
/// Called by the delivery method to capture information that should be persisted.
void set_destination_id (IdVec & destination_id);
/// \brief Marshal peristent information for this delivery request and its delivery methods into a CDR stream.
///
/// Called during persistent event storage.
void marshal (TAO_OutputCDR & cdr);
/// expose routing slip method
unsigned long sequence () const;
/// expose routing slip method
bool should_retry () const;
// Meaningless, but needed by ACE_Vector on some platforms (gcc2.x LynxOS)
bool operator == (const Delivery_Request & rhs) const;
// Meaningless, but needed by ACE_Vector on some platforms
bool operator != (const Delivery_Request & rhs) const;
private:
/// No null constructor.
Delivery_Request ();
/// No copy constructor.
Delivery_Request (const Delivery_Request & rhs);
/// no assignment operator
Delivery_Request & operator = (const Delivery_Request & rhs);
private:
Routing_Slip_Ptr routing_slip_;
size_t request_id_;
ACE_CDR::Octet delivery_type_;
IdVec destination_id_;
};
} // namespace
#if defined (__ACE_INLINE__)
#include "Delivery_Request.inl"
#endif /* __ACE_INLINE__ */
#include /**/ "ace/post.h"
#endif /* TAO_NOTIFY_DELIVERY_REQUEST_H */
|