Panda3D
Public Member Functions | List of all members
DatagramGenerator Class Referenceabstract

This class defines the abstract interace to any source of datagrams, whether it be from a file or from the net. More...

#include "datagramGenerator.h"

Inheritance diagram for DatagramGenerator:
DatagramBuffer DatagramGeneratorNet DatagramInputFile

Public Member Functions

 DatagramGenerator ()
 Does nothing since this is class is just the definition of an interface. More...
 
virtual ~DatagramGenerator ()
 Does nothing since this is class is just the definition of an interface. More...
 
virtual bool get_datagram (Datagram &data)=0
 
virtual const FileReferenceget_file ()
 Returns the FileReference that provides the source for these datagrams, if any, or NULL if the datagrams do not originate from a file on disk. More...
 
virtual std::streampos get_file_pos ()
 Returns the current file position within the data stream, if any, or 0 if the file position is not meaningful or cannot be determined. More...
 
virtual const Filenameget_filename ()
 Returns the filename that provides the source for these datagrams, if any, or empty string if the datagrams do not originate from a file on disk. More...
 
virtual time_t get_timestamp () const
 Returns the on-disk timestamp of the file that was read, at the time it was opened, if that is available, or 0 if it is not. More...
 
virtual VirtualFileget_vfile ()
 Returns the VirtualFile that provides the source for these datagrams, if any, or NULL if the datagrams do not originate from a VirtualFile. More...
 
virtual bool is_eof ()=0
 
virtual bool is_error ()=0
 
virtual bool save_datagram (SubfileInfo &info)
 Skips over the next datagram without extracting it, but saves the relevant file information in the SubfileInfo object so that its data may be read later. More...
 

Detailed Description

This class defines the abstract interace to any source of datagrams, whether it be from a file or from the net.

Definition at line 30 of file datagramGenerator.h.

Constructor & Destructor Documentation

◆ DatagramGenerator()

DatagramGenerator::DatagramGenerator ( )
inline

Does nothing since this is class is just the definition of an interface.

Definition at line 18 of file datagramGenerator.I.

◆ ~DatagramGenerator()

DatagramGenerator::~DatagramGenerator ( )
virtual

Does nothing since this is class is just the definition of an interface.

Definition at line 23 of file datagramGenerator.cxx.

Member Function Documentation

◆ get_file()

const FileReference * DatagramGenerator::get_file ( )
virtual

Returns the FileReference that provides the source for these datagrams, if any, or NULL if the datagrams do not originate from a file on disk.

Reimplemented in DatagramInputFile.

Definition at line 68 of file datagramGenerator.cxx.

Referenced by get_filename().

◆ get_file_pos()

std::streampos DatagramGenerator::get_file_pos ( )
virtual

Returns the current file position within the data stream, if any, or 0 if the file position is not meaningful or cannot be determined.

For DatagramGenerators that return a meaningful file position, this will be pointing to the first byte following the datagram returned after a call to get_datagram().

Reimplemented in DatagramInputFile.

Definition at line 90 of file datagramGenerator.cxx.

◆ get_filename()

const Filename & DatagramGenerator::get_filename ( )
virtual

Returns the filename that provides the source for these datagrams, if any, or empty string if the datagrams do not originate from a file on disk.

Reimplemented in DatagramInputFile.

Definition at line 45 of file datagramGenerator.cxx.

References get_file(), and FileReference::get_filename().

◆ get_timestamp()

time_t DatagramGenerator::get_timestamp ( ) const
virtual

Returns the on-disk timestamp of the file that was read, at the time it was opened, if that is available, or 0 if it is not.

Reimplemented in DatagramInputFile.

Definition at line 59 of file datagramGenerator.cxx.

◆ get_vfile()

VirtualFile * DatagramGenerator::get_vfile ( )
virtual

Returns the VirtualFile that provides the source for these datagrams, if any, or NULL if the datagrams do not originate from a VirtualFile.

Reimplemented in DatagramInputFile.

Definition at line 77 of file datagramGenerator.cxx.

◆ save_datagram()

bool DatagramGenerator::save_datagram ( SubfileInfo info)
virtual

Skips over the next datagram without extracting it, but saves the relevant file information in the SubfileInfo object so that its data may be read later.

For non-file-based datagram generators, this may mean creating a temporary file and copying the contents of the datagram to disk.

Returns true on success, false on failure or if this method is unimplemented.

Reimplemented in DatagramInputFile.

Definition at line 36 of file datagramGenerator.cxx.


The documentation for this class was generated from the following files: