~ubuntu-branches/ubuntu/breezy/ace/breezy

« back to all changes in this revision

Viewing changes to TAO/orbsvcs/orbsvcs/Event/EC_Filter.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad, Benjamin Montgomery, Adam Conrad
  • Date: 2005-09-18 22:51:38 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge) (0.1.2 woody)
  • Revision ID: james.westby@ubuntu.com-20050918225138-seav22q6fyylb536
Tags: 5.4.7-3ubuntu1
[ Benjamin Montgomery ]
* Added a patch for amd64 and powerpc that disables the compiler
  option -fvisibility-inlines-hidden

[ Adam Conrad ]
* Added DPATCH_OPTION_CPP=1 to debian/patches/00options to make
  Benjamin's above changes work correctly with dpatch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- C++ -*- */
2
 
/**
3
 
 *  @file   EC_Filter.h
4
 
 *
5
 
 *  EC_Filter.h,v 1.22 2003/10/28 18:34:18 bala Exp
6
 
 *
7
 
 *  @author Carlos O'Ryan (coryan@cs.wustl.edu)
8
 
 *
9
 
 * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and
10
 
 * other members of the DOC group. More details can be found in:
11
 
 *
12
 
 * http://doc.ece.uci.edu/~coryan/EC/index.html
13
 
 */
14
 
 
15
 
#ifndef TAO_EC_FILTER_H
16
 
#define TAO_EC_FILTER_H
17
 
 
18
 
#include /**/ "ace/pre.h"
19
 
 
20
 
#include "orbsvcs/RtecEventCommC.h"
21
 
 
22
 
#include /**/ "event_export.h"
23
 
 
24
 
#if !defined (ACE_LACKS_PRAGMA_ONCE)
25
 
# pragma once
26
 
#endif /* ACE_LACKS_PRAGMA_ONCE */
27
 
 
28
 
class TAO_EC_QOS_Info;
29
 
 
30
 
/**
31
 
 * @class TAO_EC_Filter
32
 
 *
33
 
 * @brief Abstract base class for the filter hierarchy.
34
 
 *
35
 
 * The per-consumer filtering mechanisms.
36
 
 * The EC needs to filter data passed to the consumers, so it can
37
 
 * correctly satisfy its subscription requirements.
38
 
 * This filtering can include correlations, sequences, timeouts,
39
 
 * etc. each consumer can request different filtering criteria.
40
 
 * Different filtering objects are associated with each consumer,
41
 
 * the filters are organized in a hierarchical structure,
42
 
 * corresponding to the subscription "expression" that the events
43
 
 * must satisfy.
44
 
 * The hierarchy is constructed using the "Builder" pattern.
45
 
 *
46
 
 * <H2>Memory Management</H2>
47
 
 * It does *not* assume ownership of its parent.
48
 
 */
49
 
class TAO_RTEvent_Export TAO_EC_Filter
50
 
{
51
 
public:
52
 
  /// constructor...
53
 
  TAO_EC_Filter (void);
54
 
 
55
 
  /// destructor...
56
 
  virtual ~TAO_EC_Filter (void);
57
 
 
58
 
  /// Obtain the parent of this filter.
59
 
  TAO_EC_Filter* parent (void) const;
60
 
 
61
 
  /// Become the parent of @a child.
62
 
  void adopt_child (TAO_EC_Filter* child);
63
 
 
64
 
  /// Matches two event headers.
65
 
  /// @todo Should we strategize the algorithm used to match headers?
66
 
  static int matches (const RtecEventComm::EventHeader& rhs,
67
 
                      const RtecEventComm::EventHeader& lhs);
68
 
 
69
 
  typedef TAO_EC_Filter* value_type;
70
 
  typedef TAO_EC_Filter* const const_value_type;
71
 
  typedef const_value_type* ChildrenIterator;
72
 
 
73
 
  /**
74
 
   * STL-like iterators
75
 
   * Filters follow the Composite pattern. All filters expose the same
76
 
   * interface as if they all had children, but for simple filters the
77
 
   * iterators return an empty range.
78
 
   */
79
 
  virtual ChildrenIterator begin (void) const;
80
 
  virtual ChildrenIterator end (void) const;
81
 
  virtual int size (void) const;
82
 
 
83
 
  /**
84
 
   * Filter this event, returns 1 if the event is accepted, 0
85
 
   * otherwise.
86
 
   * Notice that there are two versions of the method, if the event is
87
 
   * not const then filter can take ownership of the event.
88
 
   *
89
 
   * @attention There seems to be a disparity in interfaces: Supplier
90
 
   * always push event sets of size 1 to the EC_ProxyPushSupplier, and
91
 
   * EC_Filters do not implement handling of sets of more than 1
92
 
   * event.  Then, why is this not enforced by the interface by having
93
 
   * EC_ProxyPushSupplier take an event rather than a set?
94
 
   */
95
 
  virtual int filter (const RtecEventComm::EventSet& event,
96
 
                      TAO_EC_QOS_Info& qos_info
97
 
                      ACE_ENV_ARG_DECL) = 0;
98
 
  virtual int filter_nocopy (RtecEventComm::EventSet& event,
99
 
                             TAO_EC_QOS_Info& qos_info
100
 
                             ACE_ENV_ARG_DECL) = 0;
101
 
 
102
 
  /**
103
 
   * This is called by the children when they accept an event and
104
 
   * which to pass it up.
105
 
   * Notice that there are two versions of the method, if the event is
106
 
   * not const then filter can take ownership of the event.
107
 
   */
108
 
  virtual void push (const RtecEventComm::EventSet& event,
109
 
                     TAO_EC_QOS_Info& qos_info
110
 
                     ACE_ENV_ARG_DECL) = 0;
111
 
  virtual void push_nocopy (RtecEventComm::EventSet& event,
112
 
                            TAO_EC_QOS_Info& qos_info
113
 
                            ACE_ENV_ARG_DECL) = 0;
114
 
 
115
 
  /// Clear any saved state, must reset and assume no events have been
116
 
  /// received.
117
 
  virtual void clear (void) = 0;
118
 
 
119
 
  /// Returns the maximum size of the events pushed by this filter.
120
 
  virtual CORBA::ULong max_event_size (void) const = 0;
121
 
 
122
 
  /**
123
 
   * Returns 0 if an event with that header could never be accepted.
124
 
   * This can used by the suppliers to filter out consumers that
125
 
   * couldn't possibly be interested in their events.
126
 
   * The rt_info and
127
 
   */
128
 
  virtual int can_match (const RtecEventComm::EventHeader& header) const = 0;
129
 
 
130
 
  /**
131
 
   * This is used for computing the scheduling dependencies:
132
 
   *
133
 
   * Leaf filters check if the header could be matched, similar to the
134
 
   * can_match() method; if it does they return 1, and 0 otherwise.
135
 
   * Intermediate nodes always return 0.
136
 
   *
137
 
   * This is used to build precise dependencies between the suppliers
138
 
   * and the leaf of the filters that accept that event.  Notice that
139
 
   * only the nodes doing scheduling recurse through the list, so in
140
 
   * configurations that do no require scheduling the recursion stops
141
 
   * fairly soon.
142
 
   */
143
 
  virtual int add_dependencies (const RtecEventComm::EventHeader& header,
144
 
                                const TAO_EC_QOS_Info& qos_info
145
 
                                ACE_ENV_ARG_DECL) = 0;
146
 
 
147
 
  /**
148
 
   * Obtain the QOS information for this filter, the default
149
 
   * implementation returns an invalid QOS.  Only the filters that
150
 
   * support scheduling information implement this method.
151
 
   * @return Returns 0 on success and -1 on failure
152
 
   */
153
 
  virtual void get_qos_info (TAO_EC_QOS_Info& qos_info
154
 
                             ACE_ENV_ARG_DECL);
155
 
 
156
 
private:
157
 
  /// The parent...
158
 
  TAO_EC_Filter* parent_;
159
 
};
160
 
 
161
 
// ****************************************************************
162
 
 
163
 
/**
164
 
 * @class TAO_EC_Null_Filter
165
 
 *
166
 
 * @brief A null filter
167
 
 *
168
 
 * This filter accepts any kind of event, it is useful for the
169
 
 * implementation:
170
 
 * a) Consumers that accept all events
171
 
 * b) Consumers that trust the filtering done at the Supplier
172
 
 * layer.
173
 
 * c) Event Channels that don't do filtering (such as CosEC
174
 
 * backends)
175
 
 */
176
 
class TAO_RTEvent_Export TAO_EC_Null_Filter : public TAO_EC_Filter
177
 
{
178
 
public:
179
 
  /// Constructor.
180
 
  TAO_EC_Null_Filter (void);
181
 
 
182
 
  // = The TAO_EC_Filter methods, please check the documentation in
183
 
  // TAO_EC_Filter.
184
 
  virtual int filter (const RtecEventComm::EventSet& event,
185
 
                      TAO_EC_QOS_Info& qos_info
186
 
                      ACE_ENV_ARG_DECL);
187
 
  virtual int filter_nocopy (RtecEventComm::EventSet& event,
188
 
                             TAO_EC_QOS_Info& qos_info
189
 
                             ACE_ENV_ARG_DECL);
190
 
  virtual void push (const RtecEventComm::EventSet& event,
191
 
                     TAO_EC_QOS_Info& qos_info
192
 
                     ACE_ENV_ARG_DECL);
193
 
  virtual void push_nocopy (RtecEventComm::EventSet& event,
194
 
                            TAO_EC_QOS_Info& qos_info
195
 
                            ACE_ENV_ARG_DECL);
196
 
  virtual void clear (void);
197
 
  virtual CORBA::ULong max_event_size (void) const;
198
 
  virtual int can_match (const RtecEventComm::EventHeader& header) const;
199
 
  virtual int add_dependencies (const RtecEventComm::EventHeader& header,
200
 
                                const TAO_EC_QOS_Info &qos_info
201
 
                                ACE_ENV_ARG_DECL);
202
 
};
203
 
 
204
 
// ****************************************************************
205
 
 
206
 
// @@ Add more types of filters like:
207
 
// - Events in a sequence.
208
 
// - Events in a sequence with timeouts.
209
 
// - Conjunction with timeout [as opposed to disjunction of
210
 
//     conjunction and a timeout]
211
 
// - etc.
212
 
 
213
 
// ****************************************************************
214
 
 
215
 
#if defined (__ACE_INLINE__)
216
 
#include "EC_Filter.i"
217
 
#endif /* __ACE_INLINE__ */
218
 
 
219
 
#include /**/ "ace/post.h"
220
 
 
221
 
#endif /* TAO_EC_FILTER_H */