root/juggler/branches/2.2/modules/gadgeteer/cluster/Packets/ApplicationDataRequest.cpp
| Revision 19729, 3.4 kB (checked in by patrick, 2 years ago) | |
|---|---|
| |
| Line | |
|---|---|
| 1 | /*************** <auto-copyright.pl BEGIN do not edit this line> ************** |
| 2 | * |
| 3 | * VR Juggler is (C) Copyright 1998-2007 by Iowa State University |
| 4 | * |
| 5 | * Original Authors: |
| 6 | * Allen Bierbaum, Christopher Just, |
| 7 | * Patrick Hartling, Kevin Meinert, |
| 8 | * Carolina Cruz-Neira, Albert Baker |
| 9 | * |
| 10 | * This library is free software; you can redistribute it and/or |
| 11 | * modify it under the terms of the GNU Library General Public |
| 12 | * License as published by the Free Software Foundation; either |
| 13 | * version 2 of the License, or (at your option) any later version. |
| 14 | * |
| 15 | * This library is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 18 | * Library General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU Library General Public |
| 21 | * License along with this library; if not, write to the |
| 22 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 23 | * Boston, MA 02111-1307, USA. |
| 24 | * |
| 25 | *************** <auto-copyright.pl END do not edit this line> ***************/ |
| 26 | |
| 27 | #include <gadget/Util/Debug.h> |
| 28 | |
| 29 | #include <cluster/Packets/ApplicationDataRequest.h> |
| 30 | #include <cluster/Packets/PacketFactory.h> |
| 31 | |
| 32 | namespace cluster |
| 33 | { |
| 34 | CLUSTER_REGISTER_CLUSTER_PACKET_CREATOR(ApplicationDataRequest); |
| 35 | |
| 36 | ApplicationDataRequest::ApplicationDataRequest(const vpr::GUID plugin_guid, const vpr::GUID& id) |
| 37 | { |
| 38 | // Set the local member variables using the given values. |
| 39 | mPluginId = plugin_guid; |
| 40 | mId = id; |
| 41 | |
| 42 | // Create a Header for this packet with the correect type and size. |
| 43 | mHeader = new Header(Header::RIM_PACKET, |
| 44 | Header::RIM_APPDATA_REQ, |
| 45 | Header::RIM_PACKET_HEAD_SIZE |
| 46 | + 16/*Plugin GUID*/ |
| 47 | + 16/*Object GUID*/, |
| 48 | 0/*Field not curently used*/); |
| 49 | // Serialize the given data. |
| 50 | serialize(); |
| 51 | } |
| 52 | void ApplicationDataRequest::serialize() |
| 53 | { |
| 54 | // Clear the data stream. |
| 55 | mPacketWriter->getData()->clear(); |
| 56 | mPacketWriter->setCurPos(0); |
| 57 | |
| 58 | // Serialize the header. |
| 59 | mHeader->serializeHeader(); |
| 60 | |
| 61 | // Serialize plugin GUID. |
| 62 | mPluginId.writeObject(mPacketWriter); |
| 63 | |
| 64 | // Serialize ApplicationData object GUID |
| 65 | mId.writeObject(mPacketWriter); |
| 66 | } |
| 67 | |
| 68 | void ApplicationDataRequest::parse(vpr::BufferObjectReader* reader) |
| 69 | { |
| 70 | // De-Serialize plugin GUID |
| 71 | mPluginId.readObject(reader); |
| 72 | |
| 73 | // De-Serialize ApplicationData object GUID |
| 74 | mId.readObject(reader); |
| 75 | } |
| 76 | |
| 77 | void ApplicationDataRequest::printData(int debug_level) |
| 78 | { |
| 79 | vprDEBUG_BEGIN(gadgetDBG_RIM,debug_level) |
| 80 | << clrOutBOLD(clrYELLOW,"==== ApplicationData Request Packet ====\n") << vprDEBUG_FLUSH; |
| 81 | |
| 82 | Packet::printData(debug_level); |
| 83 | |
| 84 | vprDEBUG(gadgetDBG_RIM,debug_level) |
| 85 | << clrOutBOLD(clrYELLOW, "Plugin GUID: ") << mPluginId.toString() |
| 86 | << std::endl << vprDEBUG_FLUSH; |
| 87 | vprDEBUG(gadgetDBG_RIM,debug_level) |
| 88 | << clrOutBOLD(clrYELLOW, "Object GUID: ") << mId.toString() |
| 89 | << std::endl << vprDEBUG_FLUSH; |
| 90 | |
| 91 | vprDEBUG_END(gadgetDBG_RIM,debug_level) |
| 92 | << clrOutBOLD(clrYELLOW,"====================================\n") << vprDEBUG_FLUSH; |
| 93 | } |
| 94 | |
| 95 | }// end namespace cluster |
| 96 |
Note: See TracBrowser for help on using the browser.
