1 #include "Consumer_Handler.h"
2 #include "Consumer_Input_Handler.h"
5 * Consumer driver for the Publish/Subscribe example.
7 * The Consumer holds the <Consumer_Input_Handler> and
8 * <Cosumer_Handler> objects.
10 class Consumer
: public ACE_Event_Handler
, public ShutdownCallback
19 int initialize (int argc
, ACE_TCHAR
*argv
[]);
20 // Initialization method.
23 // Execute the consumer;
25 //FUZZ: disable check_for_lack_ACE_OS
26 virtual void close (void);
27 // Shutdown the consumer.
28 //FUZZ: enable check_for_lack_ACE_OS
31 virtual int handle_signal (int signum
, siginfo_t
*, ucontext_t
*);
32 // Signal handler method.
34 Consumer_Input_Handler ih_
;
35 // Handler for keyboard input.
38 // Handler for CORBA Consumer.
41 Consumer::Consumer (void)
46 Consumer::~Consumer (void)
52 Consumer::handle_signal (int signum
,
60 // Indicate that the consumer initiated the shutdown.
61 this->ih_
.consumer_initiated_shutdown (1);
69 Consumer::close (void)
71 // clean up the input handler.
80 // Run the <Consumer_Handler>'s ORB.
85 Consumer::initialize (int argc
, ACE_TCHAR
*argv
[])
87 // Initialize the <Consumer_Handler>.
88 if (this->ch_
.init (argc
, argv
, this) == -1)
89 ACE_ERROR_RETURN ((LM_ERROR
,
91 "Consumer_Handler failed to initialize\n"),
93 // Initialize the <Consumer_Input_Handler>.
94 else if (this->ih_
.initialize (&this->ch_
) == -1)
95 ACE_ERROR_RETURN ((LM_ERROR
,
97 "Consumer_Input_Handler failed to initialize\n"),
99 else if (this->ch_
.reactor ()->register_handler (SIGINT
,
101 ACE_ERROR_RETURN ((LM_ERROR
,
110 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
112 // Initialize the supplier and consumer object references.
115 if (consumer
.initialize (argc
, argv
) == -1)
116 ACE_ERROR_RETURN ((LM_ERROR
,
118 "Consumer init failed\n"),
121 // Loop forever handling events.
122 if (consumer
.run () == -1)
123 ACE_ERROR_RETURN ((LM_ERROR
,
125 "Consumer run failed\n"),