Remote Call Framework 3.2
ServerTask.hpp
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2020, 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: 3.2
15 // Contact: support <at> deltavsoft.com
16 //
17 //******************************************************************************
18 
19 #ifndef INCLUDE_RCF_SERVERTASK_HPP
20 #define INCLUDE_RCF_SERVERTASK_HPP
21 
22 #include <functional>
23 #include <memory>
24 
25 #include <RCF/Export.hpp>
26 #include <RCF/ThreadPool.hpp>
27 
28 namespace RCF {
29 
30  class RcfServer;
31 
32  class RCF_EXPORT TaskEntry
33  {
34  public:
35  TaskEntry(
36  Task task,
37  StopFunctor stopFunctor,
38  const std::string & threadName,
39  bool autoStart = true);
40 
41  TaskEntry(
42  MuxerType muxerType);
43 
44  ThreadPool &
45  getThreadPool();
46 
47  void setThreadPoolPtr(ThreadPoolPtr threadPoolPtr);
48  Task getTask();
49  bool getAutoStart();
50  void start();
51  void stop();
52 
53  void resetMuxers();
54 
55  private:
56 
57  friend class RcfServer;
58 
59  MuxerType mMuxerType;
60 
61  Task mTask;
62  StopFunctor mStopFunctor;
63  std::string mThreadName;
64 
65  ThreadPoolPtr mLocalThreadPoolPtr;
66  ThreadPoolPtr mWhichThreadPoolPtr;
67 
68  bool mAutoStart;
69  };
70 
71  typedef std::vector<TaskEntry> TaskEntries;
72 
73 } // namespace RCF
74 
75 #endif // ! INCLUDE_RCF_SERVERTASK_HPP
Definition: AmiIoHandler.hpp:24