Panda3D
Public Member Functions | Public Attributes | List of all members
DatagramSink Class Reference

This class defines the abstract interface to sending datagrams to any target, whether it be into a file or across the net. More...

Inheritance diagram for DatagramSink:
DatagramBuffer DatagramOutputFile DatagramSinkNet

Public Member Functions

bool copyDatagram (SubfileInfo result, const Filename filename)
 Copies the file data from the entire indicated file (via the vfs) as the next datagram. More...
 
bool copyDatagram (SubfileInfo result, const SubfileInfo source)
 Copies the file data from the range of the indicated file (outside of the vfs) as the next datagram. More...
 
 flush ()
 
const FileReference getFile ()
 Returns the FileReference that provides the target for these datagrams, if any, or NULL if the datagrams do not written to a file on disk. More...
 
const Filename getFilename ()
 Returns the filename that provides the target for these datagrams, if any, or empty string if the datagrams do not get written to 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...
 
bool isError ()
 
bool putDatagram (const Datagram data)
 

Public Attributes

const FileReference file
 Returns the FileReference that provides the target for these datagrams, if any, or NULL if the datagrams do not written to a file on disk. More...
 
Streamoff 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...
 
const Filename filename
 Returns the filename that provides the target for these datagrams, if any, or empty string if the datagrams do not get written to a file on disk. More...
 

Detailed Description

This class defines the abstract interface to sending datagrams to any target, whether it be into a file or across the net.

Member Function Documentation

◆ copyDatagram() [1/2]

bool copyDatagram ( SubfileInfo  result,
const Filename  filename 
)

Copies the file data from the entire indicated file (via the vfs) as the next datagram.

This is intended to support potentially very large datagrams.

Returns true on success, false on failure or if this method is unimplemented. On true, fills "result" with the information that references the copied file, if possible.

◆ copyDatagram() [2/2]

bool copyDatagram ( SubfileInfo  result,
const SubfileInfo  source 
)

Copies the file data from the range of the indicated file (outside of the vfs) as the next datagram.

This is intended to support potentially very large datagrams.

Returns true on success, false on failure or if this method is unimplemented. On true, fills "result" with the information that references the copied file, if possible.

◆ flush()

flush ( )

◆ getFile()

const FileReference getFile ( )

Returns the FileReference that provides the target for these datagrams, if any, or NULL if the datagrams do not written to a file on disk.

◆ getFilename()

const Filename getFilename ( )

Returns the filename that provides the target for these datagrams, if any, or empty string if the datagrams do not get written to 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 DatagramSinks that return a meaningful file position, this will be pointing to the first byte following the datagram returned after a call to put_datagram().

◆ isError()

bool isError ( )

◆ putDatagram()

bool putDatagram ( const Datagram  data)

Member Data Documentation

◆ file

const FileReference file

Returns the FileReference that provides the target for these datagrams, if any, or NULL if the datagrams do not written to a file on disk.

◆ file_pos

Streamoff 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.

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

◆ filename

const Filename filename

Returns the filename that provides the target for these datagrams, if any, or empty string if the datagrams do not get written to a file on disk.