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

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

#include "datagramSink.h"

Inheritance diagram for DatagramSink:
DatagramBuffer DatagramOutputFile DatagramSinkNet

Public Member Functions

 DatagramSink ()
 Does nothing since this is class is just the definition of an interface. More...
 
virtual ~DatagramSink ()
 Does nothing since this is class is just the definition of an interface. More...
 
virtual bool copy_datagram (SubfileInfo &result, const Filename &filename)
 Copies the file data from the entire indicated file (via the vfs) as the next datagram. More...
 
virtual bool copy_datagram (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...
 
virtual void flush ()=0
 
virtual const FileReferenceget_file ()
 
virtual std::streampos get_file_pos ()
 
virtual const Filenameget_filename ()
 
virtual bool is_error ()=0
 
virtual bool put_datagram (const Datagram &data)=0
 

Public Attributes

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

Definition at line 29 of file datagramSink.h.

Constructor & Destructor Documentation

◆ DatagramSink()

DatagramSink::DatagramSink ( )
inline

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

Definition at line 18 of file datagramSink.I.

◆ ~DatagramSink()

DatagramSink::~DatagramSink ( )
virtual

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

Definition at line 21 of file datagramSink.cxx.

Member Function Documentation

◆ copy_datagram() [1/2]

bool DatagramSink::copy_datagram ( SubfileInfo result,
const Filename filename 
)
virtual

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.

Reimplemented in DatagramOutputFile.

Definition at line 34 of file datagramSink.cxx.

Referenced by BamWriter::write_file_data().

◆ copy_datagram() [2/2]

bool DatagramSink::copy_datagram ( SubfileInfo result,
const SubfileInfo source 
)
virtual

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.

Reimplemented in DatagramOutputFile.

Definition at line 48 of file datagramSink.cxx.

Member Data Documentation

◆ get_file

const FileReference * DatagramSink::get_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.

Definition at line 45 of file datagramSink.h.

◆ get_file_pos

std::streampos DatagramSink::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.

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

Definition at line 46 of file datagramSink.h.

◆ get_filename

const Filename & DatagramSink::get_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.

Definition at line 44 of file datagramSink.h.


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