3 //=============================================================================
5 * @file Supplier_Timer_Handler.h
7 * Definition of the Supplier_Timer_Handler class.
9 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
11 //=============================================================================
13 #ifndef SUPPLIER_TIMER_HANDLER_H
14 #define SUPPLIER_TIMER_HANDLER_H
15 #include "ace/Reactor.h"
16 #include "ace/Timer_Queue.h"
17 #include "ace/Event_Handler.h"
18 #include "Supplier_i.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
27 * @class Supplier_Timer_Handler
29 * @brief Feeds stock information to the Callback Quoter notifier
32 * Create a class to handle timer events. Since only timer events
33 * need to be handled, only the handle_timeout method is overlaoded.
35 class Supplier_Timer_Handler
: public ACE_Event_Handler
39 Supplier_Timer_Handler (Supplier
*supplier
,
44 ~Supplier_Timer_Handler () = default;
46 /// Method which will be called by the Reactor when timeout occurs.
47 int handle_timeout (const ACE_Time_Value
&tv
, const void *arg
= 0) override
;
50 /// The values of the stock and its rate are got from the file.
51 int get_stock_information ();
53 /// The supplier instance.
54 Supplier
*supplier_obj_
;
56 /// Reactor used by the supplier.
57 ACE_Reactor
*reactor_
;
59 /// The file handle of the file from where the stock input is obtained.
62 /// The name of the stock.
63 char stockname_
[BUFSIZ
];
65 /// The market value of the stock.It will be typecasted to long later.
69 #endif /* SUPPLIER_TIMER_HANDLER_H */