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

Class representing a Callback especially for API callbacks. More...

#include <Callback.h>

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

Public Member Functions

 APICallback (Buffer *buffer)
 Constructor. More...
 
virtual void executeCallback ()
 execution of the callback. More...
 
- Public Member Functions inherited from TTEthernetModel::Callback
 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...
 

Additional Inherited Members

- Protected Attributes inherited from TTEthernetModel::Callback
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 especially for API callbacks.

See Also
Callback

Definition at line 114 of file Callback.h.

Constructor & Destructor Documentation

TTEthernetModel::APICallback::APICallback ( Buffer buffer)
inline

Constructor.

Definition at line 120 of file Callback.h.

120  : Callback(buffer){
121  }

Member Function Documentation

void TTEthernetModel::APICallback::executeCallback ( )
virtual

execution of the callback.

If method is called the stored function pointer is invoked.

Reimplemented from TTEthernetModel::Callback.

Definition at line 17 of file Callback.cc.

17  {
18  if(argSet){
19  fn(arg);
20  }
21  else{
22  tte_buffer_t buf;
23  if(dynamic_cast<TTBuffer*>(buffer) != NULL){
24  buf.traffic_type= TTE_TT_TRAFFIC;
25  }
26  else if(dynamic_cast<RCBuffer*>(buffer) != NULL){
27  buf.traffic_type= TTE_CT_TRAFFIC;
28  }
29  else{
30  buf.traffic_type= TTE_BG_TRAFFIC;
31  }
32  buf.channel=0;
33  buf.ct_id=buffer->par("ct_id").longValue();
34  buf.shared=0;
35 
36  TTEAPIPriv *priv = new TTEAPIPriv();
37  buf.priv = priv;
38  priv->buffer = buffer;
39  fn((void*)&buf);
40  if(buf.priv){
41  delete priv;
42  buf.priv=0;
43  }
44  }
45 }

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