summaryrefslogtreecommitdiff
path: root/apps/Gateway/Gateway/Event_Forwarding_Discriminator.h
blob: 9b7531c1f46d6bc94206f8f15aa4861f51d0d09c (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
/* -*- C++ -*- */
// $Id$

// ============================================================================
//
// = LIBRARY
//    apps
// 
// = FILENAME
//    Event_Forwarding_Discriminator.h
//
// = AUTHOR
//    Doug Schmidt 
// 
// ============================================================================

#if !defined (_CONSUMER_MAP_H)
#define _CONSUMER_MAP_H

#include "ace/Map_Manager.h"
#include "Concurrency_Strategies.h"
#include "Event.h"
#include "Consumer_Dispatch_Set.h"

class Event_Forwarding_Discriminator
{
  // = TITLE
  //    Map events to the set of Consumer_Proxies that have subscribed
  //    to receive the event.
public:
  int bind (Event_Key event, Consumer_Dispatch_Set *cds);
  // Associate Event with the Consumer_Dispatch_Set.

  int unbind (Event_Key event);
  // Locate EXID and pass out parameter via INID.  If found,
  // return 0, else -1.

  int find (Event_Key event, Consumer_Dispatch_Set *&cds);
  // Break any association of EXID.

public:
  ACE_Map_Manager<Event_Key, Consumer_Dispatch_Set *, MAP_MUTEX> map_;
  // Map that associates Event Addrs (external ids) with Consumer_Dispatch_Set *'s
  // <internal IDs>.
};

class Event_Forwarding_Discriminator_Iterator
{
  // = TITLE
  //    Define an iterator for the Consumer Map.
public:
  Event_Forwarding_Discriminator_Iterator (Event_Forwarding_Discriminator &mm);
  int next (Consumer_Dispatch_Set *&);
  int advance (void);

private:
  ACE_Map_Iterator<Event_Key, Consumer_Dispatch_Set *, MAP_MUTEX> map_iter_;
  // Map we are iterating over.
};
#endif /* _CONSUMER_MAP_H */