TTEthernet Model for INET Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
TTEthernetModel::Callback Class Reference

Class representing a Callback. More...

#include <Callback.h>

Inheritance diagram for TTEthernetModel::Callback:
TTEthernetModel::APICallback

Public Member Functions

 Callback (Buffer *buffer)
 Constructor. More...
 
virtual void setFunctionPointer (void(*functionPointer)(void *))
 Setter for the function pointer. More...
 
virtual cbFunc getFunctionPointer ()
 Getter for the function pointer. More...
 
virtual void setFunctionArg (void *setFunctionArg)
 Setter for the function args. More...
 
virtual void * getFunctionArg ()
 Getter for the function args. More...
 
virtual void executeCallback ()
 execution of the callback. More...
 

Protected Attributes

void(* fn )(void *)
 Function pointer of the callback. More...
 
void * arg
 Pointer to the function args. More...
 
bool argSet
 Boolean indicating whether args were set. More...
 
Bufferbuffer
 Pointer to the Buffer that issues the Callback. More...
 

Detailed Description

Class representing a Callback.

The class stores a funtion pointer and args and executes the function on demand.

Todo:
This may be merged with the Task class in a joined superclass. The code seems identical.
See Also
TTEApplicationBase

Definition at line 30 of file Callback.h.

Constructor & Destructor Documentation

TTEthernetModel::Callback::Callback ( Buffer buffer)
inline

Constructor.

Definition at line 55 of file Callback.h.

55  {
56  argSet=false;
57  this->buffer=buffer;
58  }

Member Function Documentation

virtual void TTEthernetModel::Callback::executeCallback ( )
inlinevirtual

execution of the callback.

If method is called the stored function pointer is invoked.

Reimplemented in TTEthernetModel::APICallback.

Definition at line 103 of file Callback.h.

Referenced by TTEthernetModel::TTEApplicationBase::executeCallback().

103  {
104  fn(arg);
105  }
virtual void* TTEthernetModel::Callback::getFunctionArg ( )
inlinevirtual

Getter for the function args.

Returns
the funtion arg used in the callback

Definition at line 94 of file Callback.h.

Referenced by TTEthernetModel::TTEAPIApplicationBase::tte_get_buf_var().

94  {
95  return arg;
96  }
virtual cbFunc TTEthernetModel::Callback::getFunctionPointer ( )
inlinevirtual

Getter for the function pointer.

Returns
the funtion pointer that is invoked in the callback

Definition at line 74 of file Callback.h.

Referenced by TTEthernetModel::TTEAPIApplicationBase::tte_get_buf_var().

74  {
75  return fn;
76  }
virtual void TTEthernetModel::Callback::setFunctionArg ( void *  setFunctionArg)
inlinevirtual

Setter for the function args.

Parameters
setFunctionArgthe funtion arg to be used in the callback

Definition at line 83 of file Callback.h.

Referenced by TTEthernetModel::TTEAPIApplicationBase::tte_set_buf_var().

83  {
85  argSet=true;
86  }
virtual void TTEthernetModel::Callback::setFunctionPointer ( void(*)(void *)  functionPointer)
inlinevirtual

Setter for the function pointer.

Parameters
functionPointerthe funtion pointer to be invoked in the callback

Definition at line 65 of file Callback.h.

Referenced by TTEthernetModel::TTEAPIApplicationBase::tte_set_buf_var().

65  {
66  fn=functionPointer;
67  }

Member Data Documentation

void* TTEthernetModel::Callback::arg
protected

Pointer to the function args.

Definition at line 41 of file Callback.h.

Referenced by executeCallback(), TTEthernetModel::APICallback::executeCallback(), getFunctionArg(), and setFunctionArg().

bool TTEthernetModel::Callback::argSet
protected

Boolean indicating whether args were set.

Definition at line 45 of file Callback.h.

Referenced by Callback(), TTEthernetModel::APICallback::executeCallback(), and setFunctionArg().

Buffer* TTEthernetModel::Callback::buffer
protected

Pointer to the Buffer that issues the Callback.

Definition at line 50 of file Callback.h.

Referenced by Callback(), and TTEthernetModel::APICallback::executeCallback().

void(* TTEthernetModel::Callback::fn)(void *)
protected

Function pointer of the callback.

Definition at line 36 of file Callback.h.

Referenced by executeCallback(), TTEthernetModel::APICallback::executeCallback(), getFunctionPointer(), and setFunctionPointer().


The documentation for this class was generated from the following file: