| PathEngine home | previous: | next: |
The client application creates objects derived from this interface to receive streamed data from PathEngine.
Defined in SDKRoot/include/i_pathengine.h.
#ifndef I_OUTPUTSTREAM_HAS_BEEN_INCLUDED
#define I_OUTPUTSTREAM_HAS_BEEN_INCLUDED
class iOutputStream
{
public:
virtual ~iOutputStream() {};
virtual void put(const char* data, tUnsigned32 data_size)=0;
};
#endif
|
This method is called by PathEngine to send data to an application defined output stream. |
A very simple sample implementation of this interface for output to a file
is as follows:
#include "i_pathengine.h"
#include <stdio.h>
#include <assert.h>
class cFileOutputStream : public iOutputStream
{
FILE* _file;
public:
cFileOutputStream(const char* name)
{
_file = fopen(name, "wb");
assert(_file);
}
~cFileOutputStream()
{
int errorOccurred = fclose(_file);
assert(!errorOccurred);
}
void put(const char* data, unsigned long dataSize)
{
size_t written = fwrite(data, 1, dataSize, _file);
assert(written == dataSize);
int flushResult = fflush(_file);
assert(flushResult == 0);
}
};
|
| Documentation for PathEngine release 5.24 - Copyright © 2002-2010 PathEngine | next: |