00001 // Filename: ioPtaDatagramLinMath.I 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 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: IoPtaDatagamLinMath::write_datagram 00022 // Access: Public, Static 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 template<class LinMathElement> 00026 void IoPtaDatagramLinMath<LinMathElement>:: 00027 write_datagram(Datagram &dest, CPTA(LinMathElement) array) 00028 { 00029 dest.add_uint32(array.size()); 00030 for(int i = 0; i < (int)array.size(); i++) 00031 { 00032 array[i].write_datagram(dest); 00033 } 00034 } 00035 00036 //////////////////////////////////////////////////////////////////// 00037 // Function: IoPtaDatagamLinMath::read_datagram 00038 // Access: Public, Static 00039 // Description: 00040 //////////////////////////////////////////////////////////////////// 00041 template<class LinMathElement> 00042 PTA(LinMathElement) IoPtaDatagramLinMath<LinMathElement>:: 00043 read_datagram(DatagramIterator &source) 00044 { 00045 PTA(LinMathElement) array; 00046 LinMathElement temp; 00047 00048 int size = source.get_uint32(); 00049 for(int i = 0; i < size; i++) 00050 { 00051 temp.read_datagram(source); 00052 array.push_back(temp); 00053 } 00054 00055 return array; 00056 } 00057 00058