00001 // Filename: datagramInputFile.I 00002 // Created by: drose (30Oct00) 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 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: DatagramInputFile::Constructor 00018 // Access: Published 00019 // Description: 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE DatagramInputFile:: 00022 DatagramInputFile() { 00023 _error = false; 00024 _read_first_datagram = false; 00025 _in = (istream *)NULL; 00026 _owns_in = false; 00027 } 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Function: DatagramInputFile::Destructor 00031 // Access: Published 00032 // Description: 00033 //////////////////////////////////////////////////////////////////// 00034 INLINE DatagramInputFile:: 00035 ~DatagramInputFile() { 00036 close(); 00037 } 00038 00039 //////////////////////////////////////////////////////////////////// 00040 // Function: DatagramInputFile::open 00041 // Access: Published 00042 // Description: Opens the indicated filename for reading. Returns 00043 // true on success, false on failure. 00044 //////////////////////////////////////////////////////////////////// 00045 INLINE bool DatagramInputFile:: 00046 open(const Filename &filename) { 00047 return open(new FileReference(filename)); 00048 } 00049 00050 //////////////////////////////////////////////////////////////////// 00051 // Function: DatagramInputFile::get_stream 00052 // Access: Published 00053 // Description: Returns the istream represented by the input file. 00054 //////////////////////////////////////////////////////////////////// 00055 INLINE istream &DatagramInputFile:: 00056 get_stream() { 00057 static ifstream null_stream; 00058 nassertr(_in != NULL, null_stream); 00059 return *_in; 00060 }