ApplicationLayer Class Reference

The application layer of the network stack. More...

#include <application_layer.hpp>

Inheritance diagram for ApplicationLayer:

CommunicationLayer SimulationEndListener RfidReaderApp RfidTagApp List of all members.

Public Types

typedef boost::shared_ptr<
ApplicationLayer
ApplicationLayerPtr
 Smart pointer that clients should use.

Public Member Functions

virtual ~ApplicationLayer ()
 A destructor.
virtual ApplicationLayerPtr thisApplicationLayer ()=0
 Gives this pointer as a ApplicationLayer object.
void start (const SimTime &startTime)
 Start the application running.
void stop (const SimTime &stopTime)
 Stop the application running.
bool recvFromLayer (CommunicationLayer::Directions direction, PacketPtr packet, t_uint sendingLayerIdx)
 Receives a packet from a sending layer.
CommunicationLayer::Types getLayerType () const
 Get the layer type for an object.

Protected Member Functions

 ApplicationLayer (NodePtr node)
 A constructor.
virtual bool handleRecvdPacket (PacketPtr packet, t_uint sendingLayerIdx)=0
 Let each subclass handle a received packet in their own specific manner.
virtual void startHandler ()=0
 Function to execute when the application is started.
virtual void stopHandler ()=0
 Function to execute when the application is stopped.

Protected Attributes

bool m_isRunning
 Keeps track of whether the application is running.

Friends

class AppEpochEvent

Detailed Description

The application layer of the network stack.

This is the superclass from which application classes should be derived.

Definition at line 14 of file application_layer.hpp.


Constructor & Destructor Documentation

ApplicationLayer::~ApplicationLayer (  )  [virtual]

A destructor.

A virtual destructor is recommended since the class has virtual functions.

Definition at line 11 of file application_layer.cpp.


Member Function Documentation

CommunicationLayer::Types ApplicationLayer::getLayerType (  )  const [inline, virtual]

Get the layer type for an object.

Returns:
the type of the layer.

Implements CommunicationLayer.

Definition at line 103 of file application_layer.hpp.

References CommunicationLayer::Types_Application.

virtual bool ApplicationLayer::handleRecvdPacket ( PacketPtr  packet,
t_uint  sendingLayerIdx 
) [protected, pure virtual]

Let each subclass handle a received packet in their own specific manner.

Parameters:
packet a pointer to the received packet.
sendingLayerIdx the index of the layer that sent the packet.
Returns:
true if the packet was handled successfully.

Implemented in RfidReaderApp, and RfidTagApp.

Referenced by recvFromLayer().

bool ApplicationLayer::recvFromLayer ( CommunicationLayer::Directions  direction,
PacketPtr  packet,
t_uint  sendingLayerIdx 
) [virtual]

Receives a packet from a sending layer.

Parameters:
direction the direction the packet was sent.
packet a pointer to the received packet.
sendingLayerIdx the index of the layer that sent the packet.
Returns:
true if the specified layer was able to receive the packet.

Reimplemented from CommunicationLayer.

Definition at line 36 of file application_layer.cpp.

References CommunicationLayer::Directions_Lower, and handleRecvdPacket().

void ApplicationLayer::start ( const SimTime startTime  ) 

Start the application running.

Parameters:
startTime the time to start the application.

Definition at line 16 of file application_layer.cpp.

References AppEpochEvent::create(), Simulator::currentTime(), AppEpochEvent::Epochs_Start, Simulator::instance(), Simulator::scheduleEvent(), and thisApplicationLayer().

void ApplicationLayer::stop ( const SimTime stopTime  ) 

Stop the application running.

Parameters:
stopTime the time stop the application.

Definition at line 26 of file application_layer.cpp.

References AppEpochEvent::create(), Simulator::currentTime(), AppEpochEvent::Epochs_Stop, Simulator::instance(), Simulator::scheduleEvent(), and thisApplicationLayer().

virtual ApplicationLayerPtr ApplicationLayer::thisApplicationLayer (  )  [pure virtual]

Gives this pointer as a ApplicationLayer object.

This is used to deal with shared_ptr's, this, and inheritance.

Returns:
a pointer to this object.

Implemented in RfidReaderApp, and RfidTagApp.

Referenced by start(), and stop().


Member Data Documentation

bool ApplicationLayer::m_isRunning [protected]

Keeps track of whether the application is running.

See also:
start()

stop()

Definition at line 92 of file application_layer.hpp.

Referenced by RfidTagApp::handleRecvdPacket(), and RfidReaderApp::handleRecvdPacket().


The documentation for this class was generated from the following files:
Generated on Tue Dec 12 17:04:39 2006 for rfidsim by  doxygen 1.4.7