summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/FtRtEvent/PushSupplier.h
blob: 7fb1ff135d9532cb05102df19e3dbbf35c64e7b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// -*- C++ -*-
//=============================================================================
/**
 *  @file   PushSupplier.h
 *
 *  $Id$
 *
 *  @author Huang-Ming Huang <hh1@cse.wustl.edu>
 */
//=============================================================================

#ifndef PUSHSUPPLIER_H
#define PUSHSUPPLIER_H

#include "orbsvcs/RtecEventCommS.h"
#include "orbsvcs/RtecEventChannelAdminC.h"
#include "orbsvcs/Channel_Clients_T.h"
#include "ace/Event_Handler.h"
#include "ace/Task.h"
#include "ace/Reactor.h"
#include "ace/Time_Value.h"
#include "ace/SString.h"

class ACE_Reactor;
struct Options;
class PushSupplier_impl : public ACE_Event_Handler
{
public:
  PushSupplier_impl();
  ~PushSupplier_impl();

  int init(CORBA::ORB_ptr orb,
           RtecEventChannelAdmin::EventChannel_ptr,
           const Options& options ACE_ENV_ARG_DECL);

  virtual void  disconnect_push_supplier (ACE_ENV_SINGLE_ARG_DECL)
    ACE_THROW_SPEC ((CORBA::SystemException));
private:

  class ReactorTask : public ACE_Task_Base
  {
  public:
    // ctor
    ReactorTask(ACE_Event_Handler* handler) : handler_(handler){}
    virtual int svc (void);
    // The thread entry point.

    ACE_Reactor* reactor_;
    ACE_Event_Handler* handler_;
    ACE_Time_Value timer_interval_;
  };

  virtual int handle_timeout (const ACE_Time_Value &current_time,
                              const void *act = 0);

  CORBA::ORB_var orb_;
  int num_iterations_;
  ACE_CString proxy_consumer_file_;
  ACE_PushSupplier_Adapter<PushSupplier_impl> supplier_servant_;
  CORBA::ULong seq_no_;
  ReactorTask reactor_task_;
  RtecEventChannelAdmin::ProxyPushConsumer_var consumer_;
  bool in_timeout_handler_;

  PushSupplier_impl(const PushSupplier_impl&);
  void operator==(const PushSupplier_impl&);
};
#endif