All Frameworks Class Hierarchy This Framework Indexes
Usage: you can freely reimplement this interface.
interface CATIStreamMsg
Interface to stream and unstream backbone messages.
Role: This interface must be implemented by backbone messages
to enable their streaming and unstreaming.
If your message contains simple data types, use the methods of the CATIBBStreamer interface implemented by the CATBBMessage component.
| public virtual FreeStreamData( | Buffer, | |
| iLength) |
HRESULT FreeStreamData(void *Buffer, uint32 iLength)
{
...
CATIBBStreamer * pICATIBBStreamer = NULL ;
HRESULT rc = QueryInterface(IID_CATIBBStreamer,(void**)&pICATIBBStreamer);
if ( SUCCEEDED(rc) )
{
pICATIBBStreamer->ResetStreamData(); // free simple data types at once
pICATIBBStreamer->Release();
pICATIBBStreamer = NULL ;
}
... // free other data
}
| public virtual SetMessageSpecifications( | ) |
HRESULT SetMessageSpecifications()
{
...
CATICommMsg * pICATICommMsg = NULL;
HRESULT rc = QueryInterface(IID_CATICommMsg,(void**)&pICATICommMsg);
if ( SUCCEEDED(rc) )
{
// To set the message class name (mandatory)
// MessageClassName is the name of the component.
pICATICommMsg->SetMessageClass(MessageClassName);
// To set options (if necessary)
pICATICommMsg->SetMessageSpecifiers(..|..|..);
pICATICommMsg->Release();
pICATICommMsg = NULL;
}
}
| public virtual StreamData( | oBuffer, | |
| oLength) |
HRESULT StreamData( void **oBuffer, uint32 *oLength)
{
...
CATIBBStreamer * pICATIBBStreamer = NULL ;
HRESULT rc = QueryInterface(IID_CATIBBStreamer,(void**)&pICATIBBStreamer);
// stream simple data types
if ( SUCCEEDED(rc) )
{
// Begin by this instruction
pICATIBBStreamer->BeginStream();
// Stream each message data according to its type
// ----------------------------------------------
pICATIBBStreamer->StreamFloat(..);
pICATIBBStreamer->StreamInt(..);
// End by these 3 instructions
int Length;
*oBuffer = pICATIBBStreamer->EndStream(&Length);
*oLength = Length ;
pICATIBBStreamer->Release();
pICATIBBStreamer = NULL;
}
... // stream other data and update oLength
}
| public virtual UnstreamData( | iBuffer, | |
| iLength) |
HRESULT UnstreamData(void *iBuffer, uint32 iLength)
{
...
CATIBBStreamer * pICATIBBStreamer = NULL;
HRESULT rc = QueryInterface(IID_CATIBBStreamer,(void**)&pICATIBBStreamer);
// unstream simple data types
if ( SUCCEEDED(rc) )
{
// Begin by this instruction
pICATIBBStreamer->BeginUnstream(iBuffer, iLength);
// Unstream message data (in the same order as when streaming)
// according to its type
// -----------------------------------------------------------
pICATIBBStreamer->UnstreamFloat(..);
pICATIBBStreamer->UnstreamInt(..);
...
// --------------------------
// End by this instruction
pICATIBBStreamer->EndUnstream();
pICATIBBStreamer->Release();
pICATIBBStreamer = NULL;
}
... // unstream other data
}
Copyright © 2003, Dassault Systèmes. All rights reserved.