TTEthernet Model for INET Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Callback.h
Go to the documentation of this file.
1 /*
2  * Callback.h
3  *
4  * Created on: Aug 24, 2011
5  * Author: tillsteinbach
6  */
7 
8 #ifndef CALLBACK_H_
9 #define CALLBACK_H_
10 
11 #include "tte_api.h"
12 #include "Buffer.h"
13 #include "TTBuffer.h"
14 #include "RCBuffer.h"
15 
16 namespace TTEthernetModel {
17 
18 typedef void(*cbFunc)(void *);
19 
30 class Callback
31 {
32  protected:
36  void (*fn)(void *);
37 
41  void *arg;
45  bool argSet;
46 
51  public:
56  argSet=false;
57  this->buffer=buffer;
58  }
59 
65  virtual void setFunctionPointer(void (*functionPointer)(void*)){
66  fn=functionPointer;
67  }
68 
75  return fn;
76  }
77 
83  virtual void setFunctionArg(void *setFunctionArg){
85  argSet=true;
86  }
87 
88 
94  virtual void* getFunctionArg(){
95  return arg;
96  }
97 
103  virtual void executeCallback(){
104  fn(arg);
105  }
106 };
107 
108 
114 class APICallback: public Callback
115 {
116  public:
121  }
122 
128  virtual void executeCallback();
129 };
130 
131 }
132 
133 #endif /* CALLBACK_H_ */