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

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

Inheritance diagram for DatagramGenerator:
DatagramBuffer DatagramGeneratorNet DatagramInputFile

Public Member Functions

bool getDatagram (Datagram data)
 
const FileReference getFile ()
 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...
 
const Filename getFilename ()
 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...
 
Streamoff getFilePos ()
 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...
 
time_t getTimestamp ()
 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...
 
VirtualFile getVfile ()
 Returns the VirtualFile that provides the source for these datagrams, if any, or NULL if the datagrams do not originate from a VirtualFile. More...
 
bool isEof ()
 
bool isError ()
 
bool saveDatagram (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.

Member Function Documentation

◆ getDatagram()

bool getDatagram ( Datagram  data)

◆ getFile()

const FileReference getFile ( )

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.

◆ getFilename()

const Filename getFilename ( )

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.

◆ getFilePos()

Streamoff getFilePos ( )

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().

◆ getTimestamp()

time_t getTimestamp ( )

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.

◆ getVfile()

VirtualFile getVfile ( )

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

◆ isEof()

bool isEof ( )

◆ isError()

bool isError ( )

◆ saveDatagram()

bool saveDatagram ( 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.

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.