Panda3D
 All Classes Functions Variables Enumerations
ioPtaDatagramShort.cxx
00001 // Filename: ioPtaDatagramShort.cxx
00002 // Created by:  jason (26Jun00)
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 "pandabase.h"
00016 
00017 #include "ioPtaDatagramShort.h"
00018 #include "datagram.h"
00019 #include "datagramIterator.h"
00020 
00021 ////////////////////////////////////////////////////////////////////
00022 //     Function: IoPtaDatagramShort::write_datagram
00023 //       Access: Public, Static
00024 //  Description:
00025 ////////////////////////////////////////////////////////////////////
00026 void IoPtaDatagramShort::
00027 write_datagram(BamWriter *, Datagram &dest, CPTA_ushort array) {
00028   dest.add_uint32(array.size());
00029   for(int i = 0; i < (int)array.size(); ++i) {
00030     dest.add_uint16(array[i]);
00031   }
00032 }
00033 
00034 ////////////////////////////////////////////////////////////////////
00035 //     Function: IoPtaDatagramShort::read_datagram
00036 //       Access: Public, Static
00037 //  Description:
00038 ////////////////////////////////////////////////////////////////////
00039 PTA_ushort IoPtaDatagramShort::
00040 read_datagram(BamReader *, DatagramIterator &source) {
00041   PTA_ushort array;
00042 
00043   int size = source.get_uint32();
00044   for(int i = 0; i < size; ++i) {
00045     array.push_back(source.get_uint16());
00046   }
00047 
00048   return array;
00049 }
 All Classes Functions Variables Enumerations