Panda3D

physxMemoryReadBuffer.cxx

00001 // Filename: physxMemoryReadBuffer.cxx
00002 // Created by:  enn0x (11Oct09)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "physxMemoryReadBuffer.h"
00016 
00017 ////////////////////////////////////////////////////////////////////
00018 //     Function: PhysxMemoryReadBuffer::Constructor
00019 //       Access: Public
00020 //  Description:
00021 ////////////////////////////////////////////////////////////////////
00022 PhysxMemoryReadBuffer::PhysxMemoryReadBuffer(const NxU8 *data) : buffer(data)
00023 {
00024 
00025 }
00026 
00027 ////////////////////////////////////////////////////////////////////
00028 //     Function: PhysxMemoryReadBuffer::Destructor
00029 //       Access: Public
00030 //  Description:
00031 ////////////////////////////////////////////////////////////////////
00032 PhysxMemoryReadBuffer::~PhysxMemoryReadBuffer()
00033 {
00034 
00035 }
00036 
00037 ////////////////////////////////////////////////////////////////////
00038 //     Function: PhysxMemoryReadBuffer::readByte
00039 //       Access: Public
00040 //  Description:
00041 ////////////////////////////////////////////////////////////////////
00042 NxU8 PhysxMemoryReadBuffer::readByte() const
00043 {
00044   NxU8 b;
00045   memcpy(&b, buffer, sizeof(NxU8));
00046   buffer += sizeof(NxU8);
00047   return b;
00048 }
00049 
00050 ////////////////////////////////////////////////////////////////////
00051 //     Function: PhysxMemoryReadBuffer::readWord
00052 //       Access: Public
00053 //  Description:
00054 ////////////////////////////////////////////////////////////////////
00055 NxU16 PhysxMemoryReadBuffer::readWord() const
00056 {
00057   NxU16 w;
00058   memcpy(&w, buffer, sizeof(NxU16));
00059   buffer += sizeof(NxU16);
00060   return w;
00061 }
00062 
00063 ////////////////////////////////////////////////////////////////////
00064 //     Function: PhysxMemoryReadBuffer::readDword
00065 //       Access: Public
00066 //  Description:
00067 ////////////////////////////////////////////////////////////////////
00068 NxU32 PhysxMemoryReadBuffer::readDword() const
00069 {
00070   NxU32 d;
00071   memcpy(&d, buffer, sizeof(NxU32));
00072   buffer += sizeof(NxU32);
00073   return d;
00074 }
00075 
00076 ////////////////////////////////////////////////////////////////////
00077 //     Function: PhysxMemoryReadBuffer::readFloat
00078 //       Access: Public
00079 //  Description:
00080 ////////////////////////////////////////////////////////////////////
00081 float PhysxMemoryReadBuffer::readFloat() const
00082 {
00083   float f;
00084   memcpy(&f, buffer, sizeof(float));
00085   buffer += sizeof(float);
00086   return f;
00087 }
00088 
00089 ////////////////////////////////////////////////////////////////////
00090 //     Function: PhysxMemoryReadBuffer::readDouble
00091 //       Access: Public
00092 //  Description:
00093 ////////////////////////////////////////////////////////////////////
00094 double PhysxMemoryReadBuffer::readDouble() const
00095 {
00096   double f;
00097   memcpy(&f, buffer, sizeof(double));
00098   buffer += sizeof(double);
00099   return f;
00100 }
00101 
00102 ////////////////////////////////////////////////////////////////////
00103 //     Function: PhysxMemoryReadBuffer::readBuffer
00104 //       Access: Public
00105 //  Description:
00106 ////////////////////////////////////////////////////////////////////
00107 void PhysxMemoryReadBuffer::readBuffer(void *dest, NxU32 size) const
00108 {
00109   memcpy(dest, buffer, size);
00110   buffer += size;
00111 }
00112 
 All Classes Functions Variables Enumerations