Panda3D
 All Classes Functions Variables Enumerations
datagramSink.cxx
00001 // Filename: datagramSink.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 #include "datagramSink.h"
00016 #include "fileReference.h"
00017 
00018 ////////////////////////////////////////////////////////////////////
00019 //     Function: DatagramSink::Destructor
00020 //       Access: Public, Virtual
00021 //  Description: Does nothing since this is class is just
00022 //               the definition of an interface
00023 ////////////////////////////////////////////////////////////////////
00024 DatagramSink::
00025 ~DatagramSink() {
00026 }
00027 
00028 ////////////////////////////////////////////////////////////////////
00029 //     Function: DatagramSink::copy_datagram
00030 //       Access: Published, Virtual
00031 //  Description: Copies the file data from the entire indicated
00032 //               file (via the vfs) as the next datagram.  This is
00033 //               intended to support potentially very large datagrams.
00034 //
00035 //               Returns true on success, false on failure or if this
00036 //               method is unimplemented.  On true, fills "result"
00037 //               with the information that references the copied file,
00038 //               if possible.
00039 ////////////////////////////////////////////////////////////////////
00040 bool DatagramSink::
00041 copy_datagram(SubfileInfo &result, const Filename &filename) {
00042   return false;
00043 }
00044 
00045 ////////////////////////////////////////////////////////////////////
00046 //     Function: DatagramSink::copy_datagram
00047 //       Access: Published, Virtual
00048 //  Description: Copies the file data from the range of the indicated
00049 //               file (outside of the vfs) as the next datagram.  This
00050 //               is intended to support potentially very large
00051 //               datagrams.
00052 //
00053 //               Returns true on success, false on failure or if this
00054 //               method is unimplemented.  On true, fills "result"
00055 //               with the information that references the copied file,
00056 //               if possible.
00057 ////////////////////////////////////////////////////////////////////
00058 bool DatagramSink::
00059 copy_datagram(SubfileInfo &result, const SubfileInfo &source) {
00060   return false;
00061 }
00062 
00063 ////////////////////////////////////////////////////////////////////
00064 //     Function: DatagramSink::get_filename
00065 //       Access: Published, Virtual
00066 //  Description: Returns the filename that provides the target for
00067 //               these datagrams, if any, or empty string if the
00068 //               datagrams do not get written to a file on disk.
00069 ////////////////////////////////////////////////////////////////////
00070 const Filename &DatagramSink::
00071 get_filename() {
00072   const FileReference *file = get_file();
00073   if (file != (FileReference *)NULL) {
00074     return file->get_filename();
00075   }
00076   static const Filename empty_filename;
00077   return empty_filename;
00078 }
00079 
00080 ////////////////////////////////////////////////////////////////////
00081 //     Function: DatagramSink::get_file
00082 //       Access: Published, Virtual
00083 //  Description: Returns the FileReference that provides the target for
00084 //               these datagrams, if any, or NULL if the datagrams do
00085 //               not written to a file on disk.
00086 ////////////////////////////////////////////////////////////////////
00087 const FileReference *DatagramSink::
00088 get_file() {
00089   return NULL;
00090 }
00091 
00092 ////////////////////////////////////////////////////////////////////
00093 //     Function: DatagramSink::get_file_pos
00094 //       Access: Published, Virtual
00095 //  Description: Returns the current file position within the data
00096 //               stream, if any, or 0 if the file position is not
00097 //               meaningful or cannot be determined.
00098 //
00099 //               For DatagramSinks that return a meaningful file
00100 //               position, this will be pointing to the first byte
00101 //               following the datagram returned after a call to
00102 //               put_datagram().
00103 ////////////////////////////////////////////////////////////////////
00104 streampos DatagramSink::
00105 get_file_pos() {
00106   return 0;
00107 }
 All Classes Functions Variables Enumerations