IStreamEngine

C++
struct IStreamEngine {
  enum EJobType {
    ejtStarted = 1<<0,
    ejtPending = 1<<1,
    ejtFinished = 1<<2
  };
  enum EFlags {
    FLAGS_NO_SYNC_CALLBACK = BIT(0),
    FLAGS_FILE_ON_DISK = BIT(1),
    FLAGS_IGNORE_TMP_OUT_OF_MEM = BIT(2),
    FLAGS_WRITE_ONLY_EXTERNAL_BUFFER = BIT(3)
  };
};
File

IStreamEngine.h

Description

The highest level. There is only one StreamingEngine in the application and it controls all I/O streams.

IStreamEngine::EFlags Enumeration

General purpose flags.

C++
enum EFlags {
  FLAGS_NO_SYNC_CALLBACK = BIT(0),
  FLAGS_FILE_ON_DISK = BIT(1),
  FLAGS_IGNORE_TMP_OUT_OF_MEM = BIT(2),
  FLAGS_WRITE_ONLY_EXTERNAL_BUFFER = BIT(3)
};
File

IStreamEngine.h

Members
Members
Description
FLAGS_NO_SYNC_CALLBACK = BIT(0)
If this is set only asynchronous callback will be called.
FLAGS_FILE_ON_DISK = BIT(1)
If this is set the file will be read from disc directly, instead of from the pak system.
FLAGS_IGNORE_TMP_OUT_OF_MEM = BIT(2)
Ignore the tmp out of streaming memory for this request
FLAGS_WRITE_ONLY_EXTERNAL_BUFFER = BIT(3)
External buffer is write only
IStreamEngine::EJobType Enumeration
C++
enum EJobType {
  ejtStarted = 1<<0,
  ejtPending = 1<<1,
  ejtFinished = 1<<2
};
File

IStreamEngine.h

IStreamEngine::~IStreamEngine Destructor
C++
virtual ~IStreamEngine();
IStreamEngine::BeginReadGroup Method
C++
virtual void BeginReadGroup() = 0;
Description

Call this methods before/after submitting large number of new requests.

IStreamEngine::EndReadGroup Method
C++
virtual void EndReadGroup() = 0;
IStreamEngine::GetMemoryStatistics Method
C++
virtual void GetMemoryStatistics(ICrySizer * pSizer) = 0;
Description

Puts the memory statistics into the given sizer object. According to the specifications in interface ICrySizer.

See Also

ICrySizer

IStreamEngine::GetPauseMask Method
C++
virtual uint32 GetPauseMask() const = 0;
Description

Get pause bit mask

IStreamEngine::GetStreamingOpenStatistics Method
C++
virtual void GetStreamingOpenStatistics(SStreamEngineOpenStats& openStatsOut) = 0;
Description

Returns the counts of open streaming requests.

IStreamEngine::GetStreamTaskTypeName Method
C++
virtual const char* GetStreamTaskTypeName(EStreamTaskType type) = 0;
IStreamEngine::IsStreamDataOnHDD Method
C++
virtual bool IsStreamDataOnHDD() const = 0;
Description

Is the streaming data available on harddisc for fast streaming

IStreamEngine::PauseIO Method
C++
virtual void PauseIO(bool bPause) = 0;
Description

Pause/resumes any IO active from the streaming engine

IStreamEngine::PauseStreaming Method
C++
virtual void PauseStreaming(bool bPause, uint32 nPauseTypesBitmask) = 0;
Description

Pause/resumes streaming of specific data types. nPauseTypesBitmask is a bit mask of data types (ex, 1<

IStreamEngine::SetStreamDataOnHDD Method
C++
virtual void SetStreamDataOnHDD(bool bFlag) = 0;
Description

Inform streaming engine that the streaming data is available on HDD

IStreamEngine::StartBatchRead Method
C++
virtual size_t StartBatchRead(IReadStreamPtr* pStreamsOut, const StreamReadBatchParams* pReqs, size_t numReqs) = 0;
IStreamEngine::StartRead Method
C++
virtual IReadStreamPtr StartRead(const EStreamTaskType tSource, const char* szFile, IStreamCallback* pCallback = NULL, const StreamReadParams* pParams = NULL) = 0;
Parameters
Parameters
Description
IStreamCallback* pCallback = NULL
pParams - PLACEHOLDER for the future additional parameters (like priority), or really a pointer to a structure that will hold the parameters if there are too many of them.
szSource
szFile -
Returns

IReadStream is reference-counted and will be automatically deleted if you don't refer to it; if you don't store it immediately in an auto-pointer, it may be deleted as soon as on the next line of code, because the read operation may complete immediately inside StartRead() and the object is self-disposed as soon as the callback is called.

Description

Starts asynchronous read from the specified file (the file may be on a virtual file system, in pak or zip file or wherever). Reads the file contents into the given buffer, up to the given size. Upon success, calls success callback. If the file is truncated or for other reason can not be read, calls error callback. The callback can be NULL (in this case, the client should poll the returned IReadStream object; the returned object must be locked for that)

Remarks

In some implementations disposal of the old pointers happen synchronously (in the main thread) outside StartRead() (it happens in the entity update), so you're guaranteed that it won't trash inside the calling function. However, this may change in the future and you'll be required to assign it to IReadStream immediately (StartRead will return IReadStream_AutoPtr then).

Notes

the error/success/ progress callbacks can also be called from INSIDE this function.

See Also

IReadStream,IReadStream_AutoPtr

IStreamEngine::Update Method ()
C++
virtual void Update() = 0;
Description

Per frame update ofthe streaming engine, synchronous events are dispatched from this function.

IStreamEngine::Update Method (uint32)
C++
virtual void Update(uint32 nUpdateTypesBitmask) = 0;
Description

Per frame update of the streaming engine, synchronous events are dispatched from this function, by particular TypesBitmask.

IStreamEngine::UpdateAndWait Method
C++
virtual void UpdateAndWait(bool bAbortAll = false) = 0;
Description

Waits until all submitted requests are complete. (can abort all reads which are currently in flight)