#include <application_layer.hpp>
Inheritance diagram for ApplicationLayer:
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 |
This is the superclass from which application classes should be derived.
Definition at line 14 of file application_layer.hpp.
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.
CommunicationLayer::Types ApplicationLayer::getLayerType | ( | ) | const [inline, virtual] |
Get the layer type for an object.
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.
packet | a pointer to the received packet. | |
sendingLayerIdx | the index of the layer that sent the packet. |
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.
direction | the direction the packet was sent. | |
packet | a pointer to the received packet. | |
sendingLayerIdx | the index of the layer that sent 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.
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.
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.
this
object. Implemented in RfidReaderApp, and RfidTagApp.
bool ApplicationLayer::m_isRunning [protected] |
Keeps track of whether the application is running.
Definition at line 92 of file application_layer.hpp.
Referenced by RfidTagApp::handleRecvdPacket(), and RfidReaderApp::handleRecvdPacket().