Panda3D

datagramGenerator.cxx

00001 // Filename: datagramGenerator.cxx
00002 // Created by:  jason (07Jun00)
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 #include "pandabase.h"
00017 
00018 #include "datagramGenerator.h"
00019 #include "temporaryFile.h"
00020 
00021 ////////////////////////////////////////////////////////////////////
00022 //     Function: DatagramGenerator::Destructor
00023 //       Access: Published, Virtual
00024 //  Description: Does nothing since this is class is just
00025 //               the definition of an interface
00026 ////////////////////////////////////////////////////////////////////
00027 DatagramGenerator::
00028 ~DatagramGenerator() {
00029 }
00030 
00031 ////////////////////////////////////////////////////////////////////
00032 //     Function: DatagramGenerator::save_datagram
00033 //       Access: Published, Virtual
00034 //  Description: Skips over the next datagram without extracting it,
00035 //               but saves the relevant file information in the
00036 //               SubfileInfo object so that its data may be read
00037 //               later.  For non-file-based datagram generators, this
00038 //               may mean creating a temporary file and copying the
00039 //               contents of the datagram to disk.
00040 //
00041 //               Returns true on success, false on failure or if this
00042 //               method is unimplemented.
00043 ////////////////////////////////////////////////////////////////////
00044 bool DatagramGenerator::
00045 save_datagram(SubfileInfo &info) {
00046   return false;
00047 }
00048 
00049 ////////////////////////////////////////////////////////////////////
00050 //     Function: DatagramGenerator::get_filename
00051 //       Access: Published, Virtual
00052 //  Description: Returns the filename that provides the source for
00053 //               these datagrams, if any, or empty string if the
00054 //               datagrams do not originate from a file on disk.
00055 ////////////////////////////////////////////////////////////////////
00056 const Filename &DatagramGenerator::
00057 get_filename() {
00058   const FileReference *file = get_file();
00059   if (file != (FileReference *)NULL) {
00060     return file->get_filename();
00061   }
00062   static const Filename empty_filename;
00063   return empty_filename;
00064 }
00065 
00066 ////////////////////////////////////////////////////////////////////
00067 //     Function: DatagramGenerator::get_file
00068 //       Access: Published, Virtual
00069 //  Description: Returns the FileReference that provides the source for
00070 //               these datagrams, if any, or NULL if the datagrams do
00071 //               not originate from a file on disk.
00072 ////////////////////////////////////////////////////////////////////
00073 const FileReference *DatagramGenerator::
00074 get_file() {
00075   return NULL;
00076 }
00077 
00078 ////////////////////////////////////////////////////////////////////
00079 //     Function: DatagramGenerator::get_vfile
00080 //       Access: Published, Virtual
00081 //  Description: Returns the VirtualFile that provides the source for
00082 //               these datagrams, if any, or NULL if the datagrams do
00083 //               not originate from a VirtualFile.
00084 ////////////////////////////////////////////////////////////////////
00085 VirtualFile *DatagramGenerator::
00086 get_vfile() {
00087   return NULL;
00088 }
00089 
00090 ////////////////////////////////////////////////////////////////////
00091 //     Function: DatagramGenerator::get_file_pos
00092 //       Access: Published, Virtual
00093 //  Description: Returns the current file position within the data
00094 //               stream, if any, or 0 if the file position is not
00095 //               meaningful or cannot be determined.
00096 //
00097 //               For DatagramGenerators that return a meaningful file
00098 //               position, this will be pointing to the first byte
00099 //               following the datagram returned after a call to
00100 //               get_datagram().
00101 ////////////////////////////////////////////////////////////////////
00102 streampos DatagramGenerator::
00103 get_file_pos() {
00104   return 0;
00105 }
 All Classes Functions Variables Enumerations