RCFProto
 All Classes Functions Typedefs
ServerTask.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_SERVERTASK_HPP
20 #define INCLUDE_RCF_SERVERTASK_HPP
21 
22 #include <RCF/Export.hpp>
23 #include <RCF/ThreadPool.hpp>
24 #include <RCF/Tools.hpp>
25 
26 namespace RCF {
27 
28  class RcfServer;
29 
30  class RCF_EXPORT TaskEntry
31  {
32  public:
33  TaskEntry(
34  Task task,
35  StopFunctor stopFunctor,
36  const std::string & threadName,
37  bool autoStart = true);
38 
39  TaskEntry(
40  MuxerType muxerType);
41 
42  ThreadPool &
43  getThreadPool();
44 
45  void setThreadPoolPtr(ThreadPoolPtr threadPoolPtr);
46  Task getTask();
47  bool getAutoStart();
48  void start();
49  void stop();
50 
51  void resetMuxers();
52 
53  private:
54 
55  friend class RcfServer;
56 
57  MuxerType mMuxerType;
58 
59  Task mTask;
60  StopFunctor mStopFunctor;
61  std::string mThreadName;
62 
63  ThreadPoolPtr mLocalThreadPoolPtr;
64  ThreadPoolPtr mWhichThreadPoolPtr;
65 
66  bool mAutoStart;
67  };
68 
69  typedef std::vector<TaskEntry> TaskEntries;
70 
71 } // namespace RCF
72 
73 #endif // ! INCLUDE_RCF_SERVERTASK_HPP