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

Base class for a double buffer class. More...

#include <DoubleBuffer.h>

Inheritance diagram for TTEthernetModel::DoubleBuffer:
TTEthernetModel::Buffer TTEthernetModel::RCDoubleBuffer TTEthernetModel::TTDoubleBuffer

Public Member Functions

 DoubleBuffer ()
 Constructor. More...
 
virtual ~DoubleBuffer ()
 Destructor. More...
 
- Public Member Functions inherited from TTEthernetModel::Buffer
 ~Buffer ()
 Destructor. More...
 
virtual void handleParameterChange (const char *parname)
 Indicates a parameter has changed. More...
 
EtherFrame * getFrame ()
 Wrapper function arround dequeue(). More...
 
void putFrame (EtherFrame *frame)
 Wrapper function arround enqueue(). More...
 
void addReceiveCallback (Callback *cb, TTEApplicationBase *application)
 Adds a receive callback for an application to the buffer. More...
 
CallbackgetReceiveCallback (TTEApplicationBase *application)
 Returns the currently registered receive callback for an application. More...
 
void addTransmitCallback (Callback *cb, TTEApplicationBase *application)
 Adds a transmit callback for an application to the buffer. More...
 
CallbackgetTransmitCallback (TTEApplicationBase *application)
 Returns the currently registered transmit callback for an application. More...
 

Protected Member Functions

virtual void enqueue (EtherFrame *newFrame)
 Stores a new frame. More...
 
virtual EtherFrame * dequeue ()
 Returns the frame that is stored in the buffer. More...
 
- Protected Member Functions inherited from TTEthernetModel::Buffer
virtual void initialize (int stage)
 Initializes the module. More...
 
virtual int numInitStages () const
 Returns the numer of initializaiton stages this module needs. More...
 
void handleMessage (cMessage *msg)
 Is called when a new Frame is received in the buffer. More...
 
void recordPacketSent ()
 Emits a statistics signal that a frame was sent from the buffer. More...
 
void setIsEmpty (bool empty)
 Sets the status of the Buffer to empty or non-empty. More...
 

Private Attributes

EtherFrame * frame
 The EtherFrame pointer is stored here. More...
 

Additional Inherited Members

- Protected Attributes inherited from TTEthernetModel::Buffer
std::list< cGate * > destinationGates
 Stores the Gates to that the messages are delivered. More...
 
std::map< TTEApplicationBase
*, Callback * > 
receiveCallbacks
 Stores the callbacks that are executed when a frame is added to the buffer. More...
 
std::map< TTEApplicationBase
*, Callback * > 
transmitCallbacks
 Stores the callbacks that are executed when a frame is removed from the buffer. More...
 
- Static Protected Attributes inherited from TTEthernetModel::Buffer
static simsignal_t txPkSignal = SIMSIGNAL_NULL
 Signal that is emitted every time a frame was sent. More...
 
static simsignal_t latencySignal = SIMSIGNAL_NULL
 Signal that contains the latency until the frame enters the buffer. More...
 

Detailed Description

Base class for a double buffer class.

Use the implementations BGDoubleBuffer, TTDoubleBuffer, RCDoubleBuffer.

See Also
BGDoubleBuffer, TTDoubleBuffer, RCDoubleBuffer, Buffer

Definition at line 34 of file DoubleBuffer.h.

Constructor & Destructor Documentation

DoubleBuffer::DoubleBuffer ( )

Constructor.

Definition at line 20 of file DoubleBuffer.cc.

21 {
22  frame = NULL;
23 }
DoubleBuffer::~DoubleBuffer ( )
virtual

Destructor.

Definition at line 25 of file DoubleBuffer.cc.

26 {
27  delete frame;
28 }

Member Function Documentation

EtherFrame * DoubleBuffer::dequeue ( )
protectedvirtual

Returns the frame that is stored in the buffer.

The stored frame is copied and the copy is being returned. If there is no EtherFrame stored NULL is returned.

Returns
Pointer to the copied frame or NULL if no frame is stored.

Reimplemented from TTEthernetModel::Buffer.

Definition at line 41 of file DoubleBuffer.cc.

42 {
43  if (frame)
44  return frame->dup();
45  else
46  return NULL;
47 }
void DoubleBuffer::enqueue ( EtherFrame *  newFrame)
protectedvirtual

Stores a new frame.

The incoming EtherFrame pointer is stored. A previously stored frame is deleted

Parameters
newFramethe new EtherFrame to store.

Reimplemented from TTEthernetModel::Buffer.

Definition at line 30 of file DoubleBuffer.cc.

31 {
32  if (frame != NULL)
33  delete frame;
34  else
35  {
36  setIsEmpty(newFrame == NULL);
37  }
38  frame = newFrame;
39 }

Member Data Documentation

EtherFrame* TTEthernetModel::DoubleBuffer::frame
private

The EtherFrame pointer is stored here.

Definition at line 50 of file DoubleBuffer.h.


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