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

This class can be used to write a series of datagrams into a memory buffer. More...

Inheritance diagram for DatagramBuffer:
DatagramSink DatagramGenerator

Public Member Functions

 __init__ ()
 Initializes an empty datagram buffer. More...
 
 __init__ (VectorUchar data)
 Initializes the buffer with the given data. More...
 
 clear ()
 Clears the internal buffer. More...
 
- Public Member Functions inherited from DatagramSink
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 Member Functions inherited from DatagramGenerator
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...
 

Public Attributes

const VectorUchar data
 Returns the internal buffer. More...
 
- Public Attributes inherited from DatagramSink
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 can be used to write a series of datagrams into a memory buffer.

It acts as both a datagram sink and generator; you can fill it up with datagrams and then read as many datagrams from it.

This uses the same format as DatagramInputFile and DatagramOutputFile, meaning that Datagram sizes are always stored little-endian.

Member Function Documentation

◆ __init__() [1/2]

__init__ ( )

Initializes an empty datagram buffer.

◆ __init__() [2/2]

__init__ ( VectorUchar  data)

Initializes the buffer with the given data.

◆ clear()

clear ( )

Clears the internal buffer.

Member Data Documentation

◆ data

const VectorUchar data

Returns the internal buffer.