3 //=============================================================================
7 * Defines the implementation header for the Supplier interface.
9 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
11 //=============================================================================
17 #include "NotifierS.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #include "ConsumerC.h"
24 #include "ace/Hash_Map_Manager.h"
25 #include "ace/Containers.h"
26 #include "ace/SString.h"
27 #include "ace/Null_Mutex.h"
32 * @brief Notifier servant class.
34 * The implementation of the Notifier class, which is the servant
35 * object for the callback quoter server.
37 class Notifier_i
: public POA_Notifier
46 /// Register a distributed callback handler that is invoked when the
47 /// given stock reaches the desired threshold value.
48 virtual void register_callback (const char *stock_name
,
49 CORBA::Long threshold_value
,
50 Callback_Quoter::Consumer_ptr consumer_handler
);
52 /// Remove the consumer object.
53 virtual void unregister_callback (Callback_Quoter::Consumer_ptr consumer_handler
);
55 /// Get the market status.
56 virtual void market_status (const char *stock_name
,
57 CORBA::Long stock_value
);
59 /// Get the orb pointer.
60 void orb (CORBA::ORB_ptr orb
);
62 /// Shutdown the Notifier.
63 virtual void shutdown (void);
65 // CONSUMER_MAP* get_consumer_map_ptr ();
66 // Returns the consumer map ptr.
74 * @class Consumer_Data
76 * @brief Saves the Consumer_var and the threshold stock value.
81 /// Comparison operator.
82 bool operator== (const Consumer_Data
&rhs
) const;
84 /// Stores the consumer object reference.
85 Callback_Quoter::Consumer_var consumer_
;
87 /// Stores the stock threshold value.
88 CORBA::Long desired_value_
;
91 typedef ACE_Unbounded_Set
<Consumer_Data
>
94 typedef ACE_Hash_Map_Manager
<ACE_CString
, CONSUMERS
*, ACE_Null_Mutex
>
97 /// This is the hash map with each hash_entry consisting of the stockname
98 /// and an unbounded set of consumer object pointer and the desired stockvalue.
99 CONSUMER_MAP consumer_map_
;
101 ///This marks the exit of the notifier. This should be taken care of
102 /// before the consumer tries to unregister after the notifier quits.
103 int notifier_exited_
;
108 #endif /* NOTIFIER_I_H */