#include <SyncRequest.h>
Inheritance diagram for cluster::SyncRequest:


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... | |
|
|
Definition at line 52 of file SyncRequest.h.
00053 {;}
|
|
||||||||||||
|
Create a SyncRequest packet to request syncronization.
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
Return the type of this packet.
Definition at line 81 of file SyncRequest.h.
00082 {
00083 return(Header::RIM_SYNC_REQ);
00084 }
|
|
|
Return the hostname of the node requesting syncronization.
Definition at line 89 of file SyncRequest.h.
00089 { return mHostname; }
|
|
|
Return the listening port of the requesting machine.
Definition at line 94 of file SyncRequest.h.
00094 { return mPort; }
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002