Rhino C++ API  7.21
Public Member Functions | List of all members
ON_UncompressStream Class Reference

#include <opennurbs_compress.h>

Public Member Functions

 ON_UncompressStream ()
 
virtual ~ON_UncompressStream ()
 
bool Begin ()
 
void * CallbackContext () const
 
ON_StreamCallbackFunction CallbackFunction () const
 
bool End ()
 
bool In (ON__UINT64 in_buffer_size, const void *in_buffer)
 
ON__UINT32 InCRC () const
 
ON__UINT64 InSize () const
 
virtual bool Out (void *callback_context, ON__UINT32 out_buffer_size, const void *out_buffer)
 
ON__UINT32 OutCRC () const
 
ON__UINT64 OutSize () const
 
bool SetCallback (ON_StreamCallbackFunction callback_function, void *callback_context)
 

Constructor & Destructor Documentation

◆ ON_UncompressStream()

ON_UncompressStream::ON_UncompressStream ( )

◆ ~ON_UncompressStream()

virtual ON_UncompressStream::~ON_UncompressStream ( )
virtual

Member Function Documentation

◆ Begin()

bool ON_UncompressStream::Begin ( )

Description: Call BeginUnompressStream() one time to initialize the compression calculation. Then call In() one or more times to submit the compressed stream to the uncompression calculation.
When you reach the end of the compressed stream, call End(). Returns: true if successful, false if an error occured.

◆ CallbackContext()

void* ON_UncompressStream::CallbackContext ( ) const

Returns: Current value of the context pointer passed as the first argument to the uncompressed stream output handler function.

◆ CallbackFunction()

ON_StreamCallbackFunction ON_UncompressStream::CallbackFunction ( ) const

Returns: Current value of the callback function for handling the uncompressed stream. If the callback function is null, the the virtual UncompressedStreamOut() function is used.

◆ End()

bool ON_UncompressStream::End ( )

Description: After the last call to In(), call End().
Calling End() may generate zero or more calls to the output stream handler. Returns: true if successful, false if an error occured.

◆ In()

bool ON_UncompressStream::In ( ON__UINT64  in_buffer_size,
const void *  in_buffer 
)

Description: Call In() one or more times to uncompress a stream of compressed bytes. After the last call to In(), call End(). Calling End() may generate zero or more calls to the output stream handler. Parameters: in_buffer_size - [in] number of bytes in in_buffer in_buffer - [in] Returns: true if successful, false if an error occured.

◆ InCRC()

ON__UINT32 ON_UncompressStream::InCRC ( ) const

Returns: Then the returned value is the 32-bit crc of the input stream. The crc is updated every time In() is called before any calls are made to the output stream handler. If the compression calculation is finished ( End() has been called ), then the returned value is the 32-bit crc of the entire input stream.

◆ InSize()

ON__UINT64 ON_UncompressStream::InSize ( ) const

Returns: Then the returned value is the total number bytes in the input stream. The size is updated every time In() is called before any calls are made to the output stream handler. If the calculation is finished ( End() has been called ), then the returned value is the total number of bytes in the entire input stream.

◆ Out()

virtual bool ON_UncompressStream::Out ( void *  callback_context,
ON__UINT32  out_buffer_size,
const void *  out_buffer 
)
virtual

Description: If an explicit uncompressed stream handler is not specified ( CallbackFunction() returns null ), then the virtual Out() function is called to handle the uncompressed output stream. As the input stream is uncompressed, one or more calls to Out() will occur. Returns: True to continue uncompressing and false to cancel the uncompression calculation. Remarks: In general, it is probably going to be easier to test and debug your code if you ignore the callback_context parameter and add a member variable to your derived class to make additional information accessable to your Out function.

◆ OutCRC()

ON__UINT32 ON_UncompressStream::OutCRC ( ) const

Returns: Then the returned value is the 32bit crc of the output stream. The crc is updated immediately after each call to the output stream handler. If the calculation is finished ( End() has been called ), then the returned value is the 32-bit crc of the entire output stream.

◆ OutSize()

ON__UINT64 ON_UncompressStream::OutSize ( ) const

Returns: Then the returned value is the total number bytes in the output stream. The size is incremented immediately after each call to the output stream handler. If the compression calculation is finished ( End() has been called ), then the returned value is the total number of bytes in the entire output stream.

◆ SetCallback()

bool ON_UncompressStream::SetCallback ( ON_StreamCallbackFunction  callback_function,
void *  callback_context 
)

Description: ON_UncompressStream delivers the uncompressed stream by calling an uncompressed stream output handler function. There are two options for specifying the uncompressed stream output handler function.

  1. Overriding the virtual Out() function.
  2. Providing a callback function. SetCallback() is used to specify a callback function to handle the uncompressed stream and to specify a context pointer to be passed to either option of the handler. Parameters: callback_function - [in] Function to call with sections of the uncompressed stream. If callback_function is null, then the virtual Out() function will be called. When callback_function is specified, it must return true if the uncompression calculation should continue and false to cancel the uncompression calculation. callback_context - [in] This value is passed as the first argument when calling callback_function or the virutal Out() function. Returns: True if successful. Remarks: Once uncompression has started, it would be unusual to intentionally change the uncompressed stream output handler, but you can do this if you need to.