blob: 9a44480be04f7364d5997590ef80fe947863c40b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
// --------------------------------------------------------------------------
//
// File
// Name: ReadGatherStream.h
// Purpose: Build a stream (for reading only) out of a number of other streams.
// Created: 10/12/03
//
// --------------------------------------------------------------------------
#ifndef READGATHERSTREAM_H
#define READGATHERSTREAM_H
#include "IOStream.h"
#include <vector>
// --------------------------------------------------------------------------
//
// Class
// Name: ReadGatherStream
// Purpose: Build a stream (for reading only) out of a number of other streams.
// Created: 10/12/03
//
// --------------------------------------------------------------------------
class ReadGatherStream : public IOStream
{
public:
ReadGatherStream(bool DeleteComponentStreamsOnDestruction);
~ReadGatherStream();
private:
ReadGatherStream(const ReadGatherStream &);
ReadGatherStream &operator=(const ReadGatherStream &);
public:
int AddComponent(IOStream *pStream);
void AddBlock(int Component, pos_type Length, bool Seek = false, pos_type SeekTo = 0);
virtual int Read(void *pBuffer, int NBytes, int Timeout = IOStream::TimeOutInfinite);
virtual pos_type BytesLeftToRead();
virtual void Write(const void *pBuffer, int NBytes,
int Timeout = IOStream::TimeOutInfinite);
virtual bool StreamDataLeft();
virtual bool StreamClosed();
virtual pos_type GetPosition() const;
private:
bool mDeleteComponentStreamsOnDestruction;
std::vector<IOStream *> mComponents;
typedef struct
{
pos_type mLength;
pos_type mSeekTo;
int mComponent;
bool mSeek;
} Block;
std::vector<Block> mBlocks;
pos_type mCurrentPosition;
pos_type mTotalSize;
unsigned int mCurrentBlock;
pos_type mPositionInCurrentBlock;
bool mSeekDoneForCurrent;
};
#endif // READGATHERSTREAM_H
|