cluster::ApplicationDataAck Class Reference

Application-specific data acknowledgement packet. More...

#include <cluster/Packets/ApplicationDataAck.h>

Inheritance diagram for cluster::ApplicationDataAck:

Inheritance graph
[legend]
Collaboration diagram for cluster::ApplicationDataAck:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ApplicationDataAck ()
 ApplicationDataAck (const vpr::GUID &plugin_guid, const vpr::GUID &id, const bool ack)
 Create a ApplicationDataAck packet to acknowledge a ApplicationDataRequest.
void serialize ()
 Serializes member variables into a data stream.
virtual void parse (vpr::BufferObjectReader *reader)
 Parses the data stream into the local member variables.
virtual void printData (int debug_level)
 Print the data to the screen in a readable form.
vpr::GUID getId ()
 Return the GUID of the ApplicationData object being acknoledged.
bool getAck ()
 Return a boolean determining if this is a positive(ACK) or a negative(NACK) responce.

Static Public Member Functions

static vpr::Uint16 getPacketFactoryType ()
 Return the type of this packet.

Detailed Description

Application-specific data acknowledgement packet.

Definition at line 53 of file ApplicationDataAck.h.


Constructor & Destructor Documentation

cluster::ApplicationDataAck::ApplicationDataAck (  )  [inline]

Definition at line 56 of file ApplicationDataAck.h.

00057    {;}

cluster::ApplicationDataAck::ApplicationDataAck ( const vpr::GUID &  plugin_guid,
const vpr::GUID &  id,
const bool  ack 
)

Create a ApplicationDataAck packet to acknowledge a ApplicationDataRequest.

Parameters:
plugin_guid GUID of the ClusterPlugin that should handle this packet.
id GUID of the ApplicationData object that we are acknowledging.
ack Boolean determining if this is a positive (ACK) or a negative (NACK) responce.

Definition at line 43 of file ApplicationDataAck.cpp.

References cluster::Packet::mHeader, cluster::Packet::mPluginId, cluster::Header::RIM_APPDATA_ACK, cluster::Header::RIM_PACKET, cluster::Header::RIM_PACKET_HEAD_SIZE, and serialize().

00046    {
00047       // Set the local member variables using the given values.
00048       mPluginId = plugin_guid;
00049       mId = id;
00050       mAck = ack;
00051       
00052       // Create a Header for this packet with the correect type and size.
00053       mHeader = new Header(Header::RIM_PACKET,
00054                                       Header::RIM_APPDATA_ACK,
00055                                       Header::RIM_PACKET_HEAD_SIZE 
00056                                       + 16/*Plugin GUID*/
00057                                       + 16/*Object GUID*/
00058                                       + 1 /*mAck*/,
00059                                       0/*Field not curently used*/);
00060       // Serialize the given data.
00061       serialize();
00062    }


Member Function Documentation

void cluster::ApplicationDataAck::serialize (  ) 

Serializes member variables into a data stream.

Definition at line 63 of file ApplicationDataAck.cpp.

References cluster::Packet::mHeader, cluster::Packet::mPacketWriter, cluster::Packet::mPluginId, and cluster::Header::serializeHeader().

Referenced by ApplicationDataAck().

00064    {
00065       // Clear the data stream.
00066       mPacketWriter->getData()->clear();
00067       mPacketWriter->setCurPos(0);
00068 
00069       // Serialize the header.
00070       mHeader->serializeHeader();
00071       
00072       // Serialize plugin GUID
00073       mPluginId.writeObject(mPacketWriter);
00074 
00075       // Serialize ApplicationData object GUID
00076       mId.writeObject(mPacketWriter);
00077 
00078       // Serialize the Ack boolean
00079       mPacketWriter->writeBool(mAck);
00080    }

void cluster::ApplicationDataAck::parse ( vpr::BufferObjectReader *  reader  )  [virtual]

Parses the data stream into the local member variables.

Implements cluster::Packet.

Definition at line 82 of file ApplicationDataAck.cpp.

References cluster::Packet::mPluginId.

00083    {
00084       // De-Serialize plugin GUID
00085       mPluginId.readObject(reader);
00086       
00087       // De-Serialize ApplicationData object GUID
00088       mId.readObject(reader);
00089 
00090       // De-Serialize the Ack boolean
00091       mAck = reader->readBool();
00092    }

void cluster::ApplicationDataAck::printData ( int  debug_level  )  [virtual]

Print the data to the screen in a readable form.

Implements cluster::Packet.

Definition at line 94 of file ApplicationDataAck.cpp.

References gadgetDBG_RIM(), cluster::Packet::mPluginId, and cluster::Packet::printData().

00095    {
00096       vprDEBUG_BEGIN(gadgetDBG_RIM,debug_level) 
00097          <<  clrOutBOLD(clrYELLOW,"==== ApplicationData Ack Packet ====\n") << vprDEBUG_FLUSH;
00098       
00099       Packet::printData(debug_level);
00100 
00101       vprDEBUG(gadgetDBG_RIM,debug_level) 
00102          << clrOutBOLD(clrYELLOW, "Plugin GUID:        ") << mPluginId.toString()
00103          << std::endl << vprDEBUG_FLUSH;
00104       vprDEBUG(gadgetDBG_RIM,debug_level) 
00105          << clrOutBOLD(clrYELLOW, "Object GUID:        ") << mId.toString()
00106          << std::endl << vprDEBUG_FLUSH;
00107       vprDEBUG(gadgetDBG_RIM,debug_level) 
00108          << clrOutBOLD(clrYELLOW, "Ack or Nack:      ") << (mAck ? "Ack" : "Nack")  << std::endl
00109          << std::endl << vprDEBUG_FLUSH;
00110 
00111       vprDEBUG_END(gadgetDBG_RIM,debug_level) 
00112          <<  clrOutBOLD(clrYELLOW,"================================\n") << vprDEBUG_FLUSH;      
00113    }

static vpr::Uint16 cluster::ApplicationDataAck::getPacketFactoryType (  )  [inline, static]

Return the type of this packet.

Definition at line 92 of file ApplicationDataAck.h.

References cluster::Header::RIM_APPDATA_ACK.

00093    {
00094        return(Header::RIM_APPDATA_ACK);
00095    }

vpr::GUID cluster::ApplicationDataAck::getId (  )  [inline]

Return the GUID of the ApplicationData object being acknoledged.

Definition at line 100 of file ApplicationDataAck.h.

Referenced by cluster::ApplicationDataManager::handlePacket().

00100 { return mId; }

bool cluster::ApplicationDataAck::getAck (  )  [inline]

Return a boolean determining if this is a positive(ACK) or a negative(NACK) responce.

Definition at line 106 of file ApplicationDataAck.h.

Referenced by cluster::ApplicationDataManager::handlePacket().

00107    {
00108       return mAck;
00109    }


The documentation for this class was generated from the following files:
Generated on Thu Jan 4 10:44:19 2007 for Gadgeteer by  doxygen 1.5.1