summaryrefslogtreecommitdiff
path: root/TAO/examples/AMI/FL_Callback/Progress_i.h
blob: 681573b76278584c682e13f5dc21a7db176e3d0e (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
69
70
71
72
73
74
75
76
77
78
79
80
81

//=============================================================================
/**
 *  @file   Progress_i.h
 *
 *  @author Carlos O'Ryan
 */
//=============================================================================


#ifndef PROGRESS_I_H
#define PROGRESS_I_H

#include "testS.h"

#include <FL/Fl_Box.H>

class Progress_Window : public Fl_Box
{
public:
  /// Constructor
  Progress_Window (int n_peers,
                   int n_iterations,
                   int x, int y,
                   int w, int h,
                   const char* l = 0);

  /// Keep track of the progress on each peer
  void sent_request (CORBA::Long id);
  void recv_reply (CORBA::Long id);

  /// One of the peers has bound to the server
  CORBA::Long bind (Peer_ptr a_peer);

  /// Start the peers...
  void start (void);

private:
  /// The callback method
  static void start_callback (Fl_Widget* widget, void *data);

private:
  /// The total number of peers
  int n_peers_;

  /// The peers
  PeerSet peers_;

  /// The number of iterations;
  int n_iterations_;

  /// The set of sliders where we keep track of each client
  Fl_Widget** request_progress_;
  Fl_Widget** reply_progress_;
};

/**
 * @class Progress_i
 *
 * @brief Progress server implementation
 *
 * Implements the Progress interface in test.idl, forward the
 * calls to the Progress_Window class
 */
class Progress_i : public POA_Progress
{
public:
  /// ctor
  Progress_i (Progress_Window* window);

  // = The Progress methods.
  void sent_request (CORBA::Long id);
  void recv_reply (CORBA::Long id);
  CORBA::Long bind (Peer_ptr a_peer);

private:
  /// Display the graphics...
  Progress_Window* window_;
};

#endif /* PROGRESS_I_H */