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
13 Consumer () = default;
16 ~Consumer () = default;
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 ();
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.
42 Consumer::handle_signal (int signum
,
50 // Indicate that the consumer initiated the shutdown.
51 this->ih_
.consumer_initiated_shutdown (1);
61 // clean up the input handler.
70 // Run the <Consumer_Handler>'s ORB.
75 Consumer::initialize (int argc
, ACE_TCHAR
*argv
[])
77 // Initialize the <Consumer_Handler>.
78 if (this->ch_
.init (argc
, argv
, this) == -1)
79 ACE_ERROR_RETURN ((LM_ERROR
,
81 "Consumer_Handler failed to initialize\n"),
83 // Initialize the <Consumer_Input_Handler>.
84 else if (this->ih_
.initialize (&this->ch_
) == -1)
85 ACE_ERROR_RETURN ((LM_ERROR
,
87 "Consumer_Input_Handler failed to initialize\n"),
89 else if (this->ch_
.reactor ()->register_handler (SIGINT
,
91 ACE_ERROR_RETURN ((LM_ERROR
,
100 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
102 // Initialize the supplier and consumer object references.
105 if (consumer
.initialize (argc
, argv
) == -1)
106 ACE_ERROR_RETURN ((LM_ERROR
,
108 "Consumer init failed\n"),
111 // Loop forever handling events.
112 if (consumer
.run () == -1)
113 ACE_ERROR_RETURN ((LM_ERROR
,
115 "Consumer run failed\n"),