00001 // Filename: ioPtaDatagramInt.cxx 00002 // Created by: jason (26Jun00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #include <pandabase.h> 00020 00021 #include "ioPtaDatagramInt.h" 00022 #include "datagram.h" 00023 #include "datagramIterator.h" 00024 00025 //////////////////////////////////////////////////////////////////// 00026 // Function: IoPtaDatagramInt::write_datagram 00027 // Access: Public, Static 00028 // Description: 00029 //////////////////////////////////////////////////////////////////// 00030 void IoPtaDatagramInt:: 00031 write_datagram(Datagram &dest, CPTA_int array) 00032 { 00033 dest.add_uint32(array.size()); 00034 for(int i = 0; i < (int)array.size(); i++) 00035 { 00036 dest.add_uint32(array[i]); 00037 } 00038 } 00039 00040 //////////////////////////////////////////////////////////////////// 00041 // Function: IoPtaDatagramInt::read_datagram 00042 // Access: Public, Static 00043 // Description: 00044 //////////////////////////////////////////////////////////////////// 00045 PTA_int IoPtaDatagramInt:: 00046 read_datagram(DatagramIterator &source) 00047 { 00048 PTA_int array; 00049 00050 int size = source.get_uint32(); 00051 for(int i = 0; i < size; i++) 00052 { 00053 array.push_back(source.get_uint32()); 00054 } 00055 00056 return array; 00057 } 00058