Communication with the packer
After an operation is started (by calling the entry method of the UvpOperationT class), the packer will start returning results of the processing by sending messages of different types to the application. Every time the packer needs to send a message, it calls a handler provided by the application in the m_pMessageHandler member of the UvpOperationInputT class. It will pass the following values as handler parameters:
|This pointer will always be set to a value provided by the application in the m_pMessageHandlerData member of the UvpOperationInputT object. Thanks to this technique, the application may access its custom data structure when executing the message handler. m_pMessageHandlerData can also be set to NULL if it is not used by the application.|
|A pointer to the actual message sent by the packer|
The application has to properly handle the message in the handler according to its needs.
All packer calls to the message handler are serialized - the packer won’t call the handler until the previous call returns. The entry method won’t return until all messages are handled by the application.
WARNING: the application becomes the only owner of a message after it has been received. In particular the application is responsible for deallocating the message object by calling the destroy method on the message pointer after it is not needed anymore (the application must NOT use the delete operator to deallocate a message).
Every message sent by the packer is a pointer to an abstract UvpMessageT base class. The packer defines a few derived message types, each carrying a different type of information. The application should determine the actual type of the message using the C++ RTTI mechanism (dynamic_cast call) or by checking the value of the m_Code member of the message base class and then performing a proper static_cast to a derived type.