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