Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / examples / Callback_Quoter / Supplier_Timer_Handler.h
blob8d20adf09fa4b8fc5c9ddaeb018a33d1b09276c7
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file Supplier_Timer_Handler.h
7 * Definition of the Supplier_Timer_Handler class.
9 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
11 //=============================================================================
14 #ifndef SUPPLIER_TIMER_HANDLER_H
15 #define SUPPLIER_TIMER_HANDLER_H
16 #include "ace/Reactor.h"
17 #include "ace/Timer_Queue.h"
18 #include "ace/Event_Handler.h"
19 #include "Supplier_i.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 # pragma once
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
25 class Supplier;
27 /**
28 * @class Supplier_Timer_Handler
30 * @brief Feeds stock information to the Callback Quoter notifier
31 * periodically.
32 * = Description
33 * Create a class to handle timer events. Since only timer events
34 * need to be handled, only the handle_timeout method is overlaoded.
36 class Supplier_Timer_Handler : public ACE_Event_Handler
38 public:
39 /// Initilization.
40 Supplier_Timer_Handler (Supplier *supplier,
41 ACE_Reactor *reactor,
42 FILE *file_ptr);
44 /// Destructor.
45 ~Supplier_Timer_Handler (void);
47 /// Method which will be called by the Reactor when timeout occurs.
48 virtual int handle_timeout (const ACE_Time_Value &tv,
49 const void *arg = 0);
51 private:
53 /// The values of the stock and its rate are got from the file.
54 int get_stock_information (void);
56 /// The supplier instance.
57 Supplier *supplier_obj_;
59 /// Reactor used by the supplier.
60 ACE_Reactor *reactor_;
62 /// The file handle of the file from where the stock input is obtained.
63 FILE* file_ptr_;
65 /// The name of the stock.
66 char stockname_[BUFSIZ];
68 /// The market value of the stock.It will be typecasted to long later.
69 long value_;
72 #endif /* SUPPLIER_TIMER_HANDLER_H */