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

cluster::DeviceRequest Class Reference

#include <DeviceRequest.h>

Inheritance diagram for cluster::DeviceRequest:

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

Collaboration graph
[legend]
List of all members.

Public Methods

 DeviceRequest ()
 DeviceRequest (const vpr::GUID &plugin_guid, const std::string &device_name)
 Create a DeviceRequest packet to request a remote device. 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 getDeviceName ()
 Return the name of the remote device being requested. More...


Static Public Methods

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


Constructor & Destructor Documentation

cluster::DeviceRequest::DeviceRequest   [inline]
 

Definition at line 52 of file DeviceRequest.h.

00053    {;}

cluster::DeviceRequest::DeviceRequest const vpr::GUID &    plugin_guid,
const std::string &    device_name
 

Create a DeviceRequest packet to request a remote device.

Parameters:
plugin_guid  -GUID of the ClusterPlugin that should handle this packet.
device_name  -Name of the remote device being requested.

Definition at line 44 of file DeviceRequest.cpp.

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

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


Member Function Documentation

void cluster::DeviceRequest::serialize  
 

Serializes member variables into a data stream.

Definition at line 62 of file DeviceRequest.cpp.

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

Referenced by DeviceRequest.

00063    {
00064       // Clear the data stream.
00065       mPacketWriter->getData()->clear();
00066       mPacketWriter->setCurPos(0);
00067 
00068       // Serialize the header.
00069       mHeader->serializeHeader();
00070       
00071       // Serialize plugin GUID.
00072       mPluginId.writeObject(mPacketWriter);
00073 
00074       // Serialize the name of the requested device.
00075       mPacketWriter->writeString(mDeviceName);
00076    }

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

Parses the data stream into the local member variables.

Implements cluster::Packet.

Definition at line 77 of file DeviceRequest.cpp.

References cluster::Packet::mPluginId.

00078    {   
00079       // De-Serialize plugin GUID
00080       mPluginId.readObject(reader);
00081 
00082       // De-Serialize the name of the requested device.
00083       mDeviceName = reader->readString();
00084    }

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

Print the data to the screen in a readable form.

Implements cluster::Packet.

Definition at line 86 of file DeviceRequest.cpp.

References gadgetDBG_RIM, and cluster::Packet::mPluginId.

00087    {
00088       vprDEBUG_BEGIN(gadgetDBG_RIM,debug_level) 
00089          <<  clrOutBOLD(clrYELLOW,"==== Device Request Packet Data ====\n") << vprDEBUG_FLUSH;
00090       
00091       Packet::printData(debug_level);
00092 
00093       vprDEBUG(gadgetDBG_RIM,debug_level) 
00094          << clrOutBOLD(clrYELLOW, "Plugin GUID: ") << mPluginId.toString()
00095          << std::endl << vprDEBUG_FLUSH;
00096       vprDEBUG(gadgetDBG_RIM,debug_level) 
00097          << clrOutBOLD(clrYELLOW, "Device Name: ") << mDeviceName
00098          << std::endl << vprDEBUG_FLUSH;
00099 
00100       vprDEBUG_END(gadgetDBG_RIM,debug_level) 
00101          <<  clrOutBOLD(clrYELLOW,"====================================\n") << vprDEBUG_FLUSH;
00102    }                                                                                          

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

Return the type of this packet.

Definition at line 81 of file DeviceRequest.h.

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

std::string cluster::DeviceRequest::getDeviceName   [inline]
 

Return the name of the remote device being requested.

Definition at line 89 of file DeviceRequest.h.

00089 { return mDeviceName; }


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