Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / tests / Notify / Basic / Updates.h
blob635f581017eb0ca711bddfd57d9e833df646079d
1 /* -*- C++ -*- */
2 //=============================================================================
3 /**
4 * @file Updates.h
6 * Test to check if <offer_change> and <subscription_change> messages are
7 * received correctly.
9 * @author Pradeep Gore <pradeep@cs.wustl.edu>
11 //=============================================================================
14 #ifndef NOTIFY_TESTS_UPDATES_H
15 #define NOTIFY_TESTS_UPDATES_H
17 #include "Notify_Test_Client.h"
18 #include "Notify_StructuredPushConsumer.h"
19 #include "Notify_StructuredPushSupplier.h"
21 #if defined(_MSC_VER)
22 #pragma warning(push)
23 #pragma warning(disable:4250)
24 #endif /* _MSC_VER */
26 class Updates;
28 class Updates_StructuredPushConsumer : public TAO_Notify_Tests_StructuredPushConsumer
30 public:
31 /// Constructor.
32 Updates_StructuredPushConsumer (Updates *test_client);
34 /// Offer change is conveyed here.
35 virtual void offer_change (const CosNotification::EventTypeSeq & added,
36 const CosNotification::EventTypeSeq & removed);
38 protected:
39 Updates * test_client_;
42 /***************************************************************************/
44 class Updates_StructuredPushSupplier : public TAO_Notify_Tests_StructuredPushSupplier
46 public:
47 /// Constructor.
48 Updates_StructuredPushSupplier (Updates * test_client);
50 /// Destructor.
51 virtual ~Updates_StructuredPushSupplier ();
53 /// Subscription change is conveyed here.
54 virtual void subscription_change (
55 const CosNotification::EventTypeSeq & added,
56 const CosNotification::EventTypeSeq & removed);
58 protected:
59 Updates* test_client_;
62 /***************************************************************************/
64 class Updates : public Notify_Test_Client
66 public:
67 // Initialization and termination code
68 Updates ();
69 virtual ~Updates ();
71 /// initialization.
72 int init (int argc, ACE_TCHAR *argv []);
74 /// Run the test.
75 void run_test ();
77 /// print_event_types
78 void print_event_types (const CosNotification::EventTypeSeq &types);
80 /// Invoked by Supplier and Consumer when they receive updates
81 void types_changed (const CosNotification::EventTypeSeq & added, const CosNotification::EventTypeSeq & removed);
83 /// Wait for expected count of updates.
84 void wait_for_updates (int expected_added, int expected_removed);
86 protected:
87 /// Create EC
88 void create_EC ();
90 /// Helper to add types.
91 void add_type (CosNotification::EventTypeSeq& type_seq, const char* type);
93 // test subscription_change
94 void test_subscription_change ();
96 // test offer_change
97 void test_offer_change ();
99 /// Reset the counts.
100 void reset_counts ();
102 /// Lock to serialize internal state.
103 TAO_SYNCH_MUTEX lock_;
105 /// Count of added updates received
106 int added_count_;
108 /// Count of removed updates received
109 /// Check if these are equal to <update_count_> at the end of the test.
110 int removed_count_;
112 /// The one channel that we create using the factory.
113 CosNotifyChannelAdmin::EventChannel_var ec_;
115 /// The consumer admin used by consumers.
116 CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin_;
118 /// The supplier admin used by suppliers.
119 CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin_;
121 /// Consumer
122 TAO_Notify_Tests_StructuredPushConsumer* consumer_;
124 /// Supplier
125 TAO_Notify_Tests_StructuredPushSupplier* supplier_;
127 private:
128 friend class Updates_StructuredPushSupplier;
129 friend class Updates_StructuredPushConsumer;
132 /***************************************************************************/
134 #if defined(_MSC_VER)
135 #pragma warning(pop)
136 #endif /* _MSC_VER */
138 #endif /* NOTIFY_TESTS_UPDATES_H */