00001 // Filename: ioPtaDatagramFloat.cxx 00002 // Created by: charles (10Jul00) 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 "ioPtaDatagramFloat.h" 00018 #include "datagram.h" 00019 #include "datagramIterator.h" 00020 00021 //////////////////////////////////////////////////////////////////// 00022 // Function: IoPtaDatagramFloat::write_datagram 00023 // Access: Public, Static 00024 // Description: 00025 //////////////////////////////////////////////////////////////////// 00026 void IoPtaDatagramFloat:: 00027 write_datagram(BamWriter *, Datagram &dest, CPTA_stdfloat array) { 00028 dest.add_uint32(array.size()); 00029 for (int i = 0; i < (int)array.size(); ++i) { 00030 dest.add_stdfloat(array[i]); 00031 } 00032 } 00033 00034 //////////////////////////////////////////////////////////////////// 00035 // Function: IoPtaDatagramFloat::read_datagram 00036 // Access: Public, Static 00037 // Description: 00038 //////////////////////////////////////////////////////////////////// 00039 PTA_stdfloat IoPtaDatagramFloat:: 00040 read_datagram(BamReader *, DatagramIterator &source) { 00041 PTA_stdfloat array; 00042 00043 int size = source.get_uint32(); 00044 for (int i = 0; i < size; ++i) { 00045 array.push_back(source.get_stdfloat()); 00046 } 00047 00048 return array; 00049 }