RCFProto
 All Classes Functions Typedefs
ClientProgress.hpp
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2013, Delta V Software. All rights reserved.
6 // http://www.deltavsoft.com
7 //
8 // RCF is distributed under dual licenses - closed source or GPL.
9 // Consult your particular license for conditions of use.
10 //
11 // If you have not purchased a commercial license, you are using RCF
12 // under GPL terms.
13 //
14 // Version: 2.0
15 // Contact: support <at> deltavsoft.com
16 //
17 //******************************************************************************
18 
19 #ifndef INCLUDE_RCF_CLIENTPROGRESS_HPP
20 #define INCLUDE_RCF_CLIENTPROGRESS_HPP
21 
22 #include <boost/function.hpp>
23 #include <boost/shared_ptr.hpp>
24 
25 #include <RCF/Tools.hpp>
26 
27 namespace RCF {
28 
29  class ClientProgress
30  {
31  public:
32 
33  enum Activity
34  {
35  Connect,
36  Send,
37  Receive
38  };
39 
40  enum Action
41  {
42  Cancel,
43  Continue
44  };
45 
46  enum Trigger
47  {
48  Event = 1,
49  Timer = 2,
50  UiMessage = 4
51  };
52 
53  typedef boost::function5<
54  void,
55  std::size_t,
56  std::size_t,
57  Trigger,
58  Activity,
59  Action &> ProgressCallback;
60 
61  ClientProgress() :
62  mProgressCallback(),
63  mTriggerMask(),
64  mTimerIntervalMs(),
65  mUiMessageFilter()
66  {}
67 
68  ProgressCallback mProgressCallback;
69  int mTriggerMask;
70  unsigned int mTimerIntervalMs;
71  int mUiMessageFilter;
72  };
73 
74  typedef boost::shared_ptr<ClientProgress> ClientProgressPtr;
75 
76  class WithProgressCallback
77  {
78  public:
79 
80  virtual ~WithProgressCallback()
81  {}
82 
83  void setClientProgressPtr(ClientProgressPtr clientProgressPtr)
84  {
85  mClientProgressPtr = clientProgressPtr;
86  }
87 
88  protected:
89  ClientProgressPtr mClientProgressPtr;
90  };
91 
92 } // namespace RCF
93 
94 #endif // ! INCLUDE_RCF_CLIENTPROGRESS_HPP