Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Examples  

cluster::SyncAck Class Reference

#include <SyncAck.h>

Inheritance diagram for cluster::SyncAck:

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

Collaboration graph
[legend]
List of all members.

Public Methods

 SyncAck ()
 SyncAck (const std::string &host_name, const vpr::Uint16 &port, const bool ack)
 Create a ApplicationDataAck packet to acknowledge a ApplicationDataRequest. More...

void serialize ()
 Serializes member variables into a data stream. More...

virtual void parse (vpr::BufferObjectReader *reader)
 Parses the data stream into the local member variables. More...

virtual void printData (int debug_level)
 Print the data to the screen in a readable form. More...

std::string getHostname ()
 Returns the hostname of the node acknowledging the SyncRequest. More...

vpr::Uint16 getPort ()
 Returns the port of the node acknowledging the SyncRequest. More...

bool getAck ()
 Returns a boolean determining if this is a positive(ACK) or a negative(NACK) responce. More...


Static Public Methods

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


Constructor & Destructor Documentation

cluster::SyncAck::SyncAck   [inline]
 

Definition at line 52 of file SyncAck.h.

00053    {;}

cluster::SyncAck::SyncAck const std::string &    host_name,
const vpr::Uint16 &    port,
const bool    ack
 

Create a ApplicationDataAck packet to acknowledge a ApplicationDataRequest.

Parameters:
host_name  -The hostname of the node acknowledging the SyncRequest.
port  -The port of the node acknowledging the SyncRequest.
ack  -Boolean determining if this is a positive(ACK) or a negative(NACK) responce.

Definition at line 44 of file SyncAck.cpp.

References cluster::Packet::mHeader, and serialize.

00045    {
00046       // Set the local member variables using the given values.
00047       mHostname = host_name;
00048       mPort = port;
00049       mAck = ack;
00050 
00051       // Create a Header for this packet with the correect type and size.
00052       mHeader = new Header(Header::RIM_PACKET,
00053                                       Header::RIM_SYNC_ACK,
00054                                       Header::RIM_PACKET_HEAD_SIZE 
00055                                       + 2 /* data for length*/
00056                                       + mHostname.size()
00057                                       + 2 /*mPort*/
00058                                       + 1 /*mAck*/,
00059                                       0/*Field not curently used*/);
00060       // Serialize the given data.
00061       serialize();
00062    }


Member Function Documentation

void cluster::SyncAck::serialize  
 

Serializes member variables into a data stream.

Definition at line 64 of file SyncAck.cpp.

References cluster::Packet::mHeader, and cluster::Packet::mPacketWriter.

Referenced by SyncAck.

00065    {
00066       // Clear the data stream.
00067       mPacketWriter->getData()->clear();
00068       mPacketWriter->setCurPos(0);
00069 
00070       // Serialize the header.
00071       mHeader->serializeHeader();
00072       
00073       // Serialize the hostname of the machine acknowledging the SyncRequest.
00074       mPacketWriter->writeString(mHostname);
00075                
00076       // Serialize the listening port of the machine acknowledging the SyncRequest.
00077       mPacketWriter->writeUint16(mPort);
00078          
00079       // Serialize the Ack boolean
00080       mPacketWriter->writeBool(mAck);
00081    }

void cluster::SyncAck::parse vpr::BufferObjectReader *    reader [virtual]
 

Parses the data stream into the local member variables.

Implements cluster::Packet.

Definition at line 83 of file SyncAck.cpp.

00084    {
00085       // De-Serialize the hostname of the machine acknowledging the SyncRequest.
00086       mHostname = reader->readString();
00087          
00088       // De-Serialize the listening port of the machine acknowledging the SyncRequest.
00089       mPort = reader->readUint16();
00090 
00091       // De-Serialize the Ack boolean
00092       mAck = reader->readBool();
00093    }

void cluster::SyncAck::printData int    debug_level [virtual]
 

Print the data to the screen in a readable form.

Implements cluster::Packet.

Definition at line 95 of file SyncAck.cpp.

References gadgetDBG_RIM.

00096    {
00097       vprDEBUG_BEGIN(gadgetDBG_RIM,debug_level) 
00098          <<  clrOutBOLD(clrYELLOW,"==== Sync Ack Packet Data ====\n") << vprDEBUG_FLUSH;
00099       
00100       Packet::printData(debug_level);
00101 
00102       vprDEBUG(gadgetDBG_RIM,debug_level) 
00103          << clrOutBOLD(clrYELLOW, "Host Name:    ") << mHostname
00104          << std::endl << vprDEBUG_FLUSH;
00105       vprDEBUG(gadgetDBG_RIM,debug_level) 
00106          << clrOutBOLD(clrYELLOW, "Port:         ") << mPort
00107          << std::endl << vprDEBUG_FLUSH;
00108       vprDEBUG(gadgetDBG_RIM,debug_level) 
00109          << clrOutBOLD(clrYELLOW, "Ack or Nack:  ") << (mAck ? "Ack" : "Nack")
00110          << std::endl << vprDEBUG_FLUSH;
00111 
00112       vprDEBUG_END(gadgetDBG_RIM,debug_level) 
00113          <<  clrOutBOLD(clrYELLOW,"====================================\n") << vprDEBUG_FLUSH;
00114    }

vpr::Uint16 cluster::SyncAck::getPacketFactoryType   [inline, static]
 

Return the type of this packet.

Definition at line 82 of file SyncAck.h.

00083    {
00084        return(Header::RIM_SYNC_ACK);
00085    }

std::string cluster::SyncAck::getHostname   [inline]
 

Returns the hostname of the node acknowledging the SyncRequest.

Definition at line 90 of file SyncAck.h.

00090 { return mHostname; }

vpr::Uint16 cluster::SyncAck::getPort   [inline]
 

Returns the port of the node acknowledging the SyncRequest.

Definition at line 95 of file SyncAck.h.

00095 { return mPort; }

bool cluster::SyncAck::getAck   [inline]
 

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

Definition at line 100 of file SyncAck.h.

00100 { return mAck; }


The documentation for this class was generated from the following files:
Generated on Sun May 2 14:26:47 2004 for Gadgeteer by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002