FileDescriptorSimulationActivity.hpp
Go to the documentation of this file.
1 /***************************************************************************
2 
3  ***************************************************************************
4  * This library is free software; you can redistribute it and/or *
5  * modify it under the terms of the GNU General Public *
6  * License as published by the Free Software Foundation; *
7  * version 2 of the License. *
8  * *
9  * As a special exception, you may use this file as part of a free *
10  * software library without restriction. Specifically, if other files *
11  * instantiate templates or use macros or inline functions from this *
12  * file, or you compile this file and link it with other files to *
13  * produce an executable, this file does not by itself cause the *
14  * resulting executable to be covered by the GNU General Public *
15  * License. This exception does not however invalidate any other *
16  * reasons why the executable file might be covered by the GNU General *
17  * Public License. *
18  * *
19  * This library is distributed in the hope that it will be useful, *
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22  * Lesser General Public License for more details. *
23  * *
24  * You should have received a copy of the GNU General Public *
25  * License along with this library; if not, write to the Free Software *
26  * Foundation, Inc., 59 Temple Place, *
27  * Suite 330, Boston, MA 02111-1307 USA *
28  * *
29  ***************************************************************************/
30 
31 #ifndef FILEDESCRIPTORSIMULATION_ACTIVITY_HPP
32 #define FILEDESCRIPTORSIMULATION_ACTIVITY_HPP
33 
34 #include "../base/ActivityInterface.hpp"
35 #include "../base/RunnableInterface.hpp"
36 #include "../extras/FileDescriptorActivityInterface.hpp"
37 
38 namespace RTT { namespace extras {
39 
60  {
61  public:
62  // priority and name are ignored
65  const std::string& name ="FileDescriptorSimulationActivity" );
66 
67  // scheduler, priority, and name, are ignored
69  int priority,
71  const std::string& name ="FileDescriptorSimulationActivity" );
72 
73  // scheduler, priority, and name, are ignored
75  int priority,
76  Seconds period,
78  const std::string& name ="FileDescriptorSimulationActivity" );
79 
80  // scheduler, priority, cpu_affinity, and name, are ignored
82  int priority,
83  Seconds period,
84  unsigned cpu_affinity,
86  const std::string& name ="FileDescriptorSimulationActivity" );
87 
92 
93  /**********************************************************************
94  * FDAInterface functions
95  **********************************************************************/
96 
98  void watch(int fd);
99 
101  void unwatch(int fd);
102 
104  void clearAllWatches();
105 
107  bool isWatched(int fd) const;
108 
111  bool isUpdated(int fd) const;
112 
115  bool hasTimeout() const;
116 
117  bool hasError() const;
118 
120  void setTimeout(int timeout);
121 
123  void setTimeout_us(int timeout_us);
124 
126  int getTimeout() const;
127 
129  int getTimeout_us() const;
130 
131  /**********************************************************************
132  * ActivityInterface functions
133  **********************************************************************/
134 
136  virtual bool start();
138  virtual bool stop();
140  virtual bool isRunning() const;
142  virtual bool isActive() const;
144  virtual Seconds getPeriod() const;
146  virtual bool isPeriodic() const;
148  virtual bool setPeriod(Seconds s) ;
150  virtual unsigned getCpuAffinity() const;
152  virtual bool setCpuAffinity(unsigned cpu) ;
154  virtual bool execute();
156  virtual bool trigger();
158  virtual bool timeout() ;
160  virtual os::ThreadInterface* thread();
161 
163  virtual void work(base::RunnableInterface::WorkReason reason);
164  protected:
169  bool running;
173  };
174 }}
175 
176 #endif
double Seconds
Definition: os/Time.hpp:53
A class for running a certain piece of code in a thread.
static RTT_UNUSED bool setCpuAffinity(ThreadInterface *thread, const std::bitset< 16 > &cpu_affinity)
Interface to start/stop and query a Activity.
static std::bitset< 16 > getCpuAffinity(ThreadInterface *thread)
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:53
static bool trigger(TaskContext *tc)


rtt
Author(s): RTT Developers
autogenerated on Fri Oct 25 2019 03:59:33