TTEthernet Model for INET Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Task.h
Go to the documentation of this file.
1 //
2 // This program is free software: you can redistribute it and/or modify
3 // it under the terms of the GNU General Public License as published by
4 // the Free Software Foundation, either version 3 of the License, or
5 // (at your option) any later version.
6 //
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU General Public License for more details.
11 //
12 // You should have received a copy of the GNU General Public License
13 // along with this program. If not, see http://www.gnu.org/licenses/.
14 //
15 
16 #ifndef TASK_H_
17 #define TASK_H_
18 
19 #include <cobject.h>
20 
21 
22 namespace TTEthernetModel {
23 
24 typedef void(*cbFunc)(void *);
25 
36 class Task
37 {
38  protected:
42  void (*fn)(void *);
46  void *arg;
50  bool argSet;
51  public:
55  Task(){
56  argSet=false;
57  }
58 
64  virtual void setFunctionPointer(void (*functionPointer)(void*)){
65  fn=functionPointer;
66  }
67 
74  return fn;
75  }
76 
82  virtual void setFunctionArg(void *setFunctionArg){
84  argSet=true;
85  }
86 
92  virtual void* getFunctionArg(){
93  return arg;
94  }
95 
101  virtual void executeTask(){
102  fn(arg);
103  }
104 };
105 
111 class APITask : public Task
112 {
113 };
114 
115 }
116 
117 #endif /* TASK_H_ */