=default for generated implementation copy ctor
[ACE_TAO.git] / TAO / examples / Callback_Quoter / Supplier_Timer_Handler.h
blob913815fb0c19835737a51c40b52377969d3eda6b
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 //=============================================================================
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)
21 # pragma once
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 class Supplier;
26 /**
27 * @class Supplier_Timer_Handler
29 * @brief Feeds stock information to the Callback Quoter notifier
30 * periodically.
31 * = Description
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
37 public:
38 /// Initialization.
39 Supplier_Timer_Handler (Supplier *supplier,
40 ACE_Reactor *reactor,
41 FILE *file_ptr);
43 /// Destructor.
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;
49 private:
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.
60 FILE* file_ptr_;
62 /// The name of the stock.
63 char stockname_[BUFSIZ];
65 /// The market value of the stock.It will be typecasted to long later.
66 long value_;
69 #endif /* SUPPLIER_TIMER_HANDLER_H */