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

cluster::SyncRequest Class Reference

#include <SyncRequest.h>

Inheritance diagram for cluster::SyncRequest:

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

Collaboration graph
[legend]
List of all members.

Public Methods

 SyncRequest ()
 SyncRequest (std::string &host_name, vpr::Uint16 &port)
 Create a SyncRequest packet to request syncronization. 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 ()
 Return the hostname of the node requesting syncronization. More...

vpr::Uint16 getPort ()
 Return the listening port of the requesting machine. More...


Static Public Methods

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


Constructor & Destructor Documentation

cluster::SyncRequest::SyncRequest   [inline]
 

Definition at line 52 of file SyncRequest.h.

00053    {;}

cluster::SyncRequest::SyncRequest std::string &    host_name,
vpr::Uint16 &    port
 

Create a SyncRequest packet to request syncronization.

Parameters:
host_name  -Hostname of the node requesting syncronization.
port  -Listening port of the requesting machine.

Definition at line 45 of file SyncRequest.cpp.

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

00046    {
00047       // Given the input, create the packet and then serialize the packet(which includes the header)
00048       // - Set member variables
00049       // - Create the correct packet header
00050       // - Serialize the packet
00051 
00052       // Set the local member variables using the given values.
00053       mHostname = host_name;
00054       mPort = port;
00055       
00056       // Create a Header for this packet with the correect type and size.
00057       mHeader = new Header(Header::RIM_PACKET,
00058                                       Header::RIM_SYNC_REQ,
00059                                       Header::RIM_PACKET_HEAD_SIZE 
00060                                       + 2 /*mHostname.size()*/
00061                                       + mHostname.size()
00062                                       + 2 /*mPort*/
00063                                       ,0/*Field not curently used*/);
00064       // Serialize the given data.
00065       serialize();
00066    }


Member Function Documentation

void cluster::SyncRequest::serialize  
 

Serializes member variables into a data stream.

Definition at line 67 of file SyncRequest.cpp.

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

Referenced by SyncRequest.

00068    {
00069       // Clear the data stream.
00070       mPacketWriter->getData()->clear();
00071       mPacketWriter->setCurPos(0);
00072       
00073       // Serialize the header.
00074       mHeader->serializeHeader();
00075       
00076       // Serialize the hostname of the requesting node.
00077       mPacketWriter->writeString(mHostname);
00078                
00079       // Serialize the listening port of the requesting node.
00080       mPacketWriter->writeUint16(mPort);         
00081    }

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

Parses the data stream into the local member variables.

Implements cluster::Packet.

Definition at line 83 of file SyncRequest.cpp.

00084    {
00085       // De-Serialize the hostname of the requesting node.
00086       mHostname = reader->readString();
00087          
00088       // De-Serialize the listening port of the requesting node.
00089       mPort = reader->readUint16();
00090    }

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

Print the data to the screen in a readable form.

Implements cluster::Packet.

Definition at line 92 of file SyncRequest.cpp.

References gadgetDBG_RIM.

00093    {
00094       vprDEBUG_BEGIN(gadgetDBG_RIM,debug_level) 
00095          <<  clrOutBOLD(clrYELLOW,"==== Sync Request Packet Data ====\n") << vprDEBUG_FLUSH;
00096       
00097       Packet::printData(debug_level);
00098 
00099       vprDEBUG(gadgetDBG_RIM,debug_level) 
00100          << clrOutBOLD(clrYELLOW, "Host Name:    ") << mHostname
00101          << std::endl << vprDEBUG_FLUSH;
00102       vprDEBUG(gadgetDBG_RIM,debug_level) 
00103          << clrOutBOLD(clrYELLOW, "Port:         ") << mPort
00104          << std::endl << vprDEBUG_FLUSH;
00105 
00106       vprDEBUG_END(gadgetDBG_RIM,debug_level) 
00107          <<  clrOutBOLD(clrYELLOW,"========================================\n") << vprDEBUG_FLUSH;
00108    }

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

Return the type of this packet.

Definition at line 81 of file SyncRequest.h.

00082    {
00083        return(Header::RIM_SYNC_REQ);
00084    }

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

Return the hostname of the node requesting syncronization.

Definition at line 89 of file SyncRequest.h.

00089 { return mHostname; }

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

Return the listening port of the requesting machine.

Definition at line 94 of file SyncRequest.h.

00094 { return mPort; }


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