Nebula
Loading...
Searching...
No Matches
cachedstream.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
12#include "core/config.h"
13#include "io/stream.h"
14
15//------------------------------------------------------------------------------
16namespace IO
17{
18class StreamCache;
20{
21public:
25 virtual ~CachedStream();
26
28 virtual bool CanRead() const;
30 virtual bool CanSeek() const;
32 virtual bool CanBeMapped() const;
34 virtual Size GetSize() const;
36 virtual Position GetPosition() const;
38 virtual bool Open();
40 virtual void Close();
42 virtual Size Read(void* ptr, Size numBytes);
44 virtual void Seek(Offset offset, SeekOrigin origin);
46 virtual bool Eof() const;
48 virtual void* Map();
50 virtual void* MemoryMap();
52 virtual void Unmap();
54 void* GetRawPointer() const;
55
56protected:
57 friend class IO::StreamCache;
58
59 virtual Core::Rtti const& GetParentRtti() = 0;
60
61 // underlying object
63
66 unsigned char* buffer;
67};
68} // namespace IO
69//------------------------------------------------------------------------------
Nebula's runtime type information for one class.
Definition rtti.h:27
Wraps an underlying mappable stream object to avoid reopening it more than once (e.
Definition cachedstream.h:20
virtual void * Map()
map for direct memory-access
Definition cachedstream.cc:192
Ptr< IO::Stream > parentStream
Definition cachedstream.h:62
Size size
Definition cachedstream.h:64
virtual bool CanSeek() const
memory streams support seeking
Definition cachedstream.cc:48
virtual void * MemoryMap()
map for direct memory-access
Definition cachedstream.cc:205
virtual void Unmap()
unmap a mapped stream
Definition cachedstream.cc:215
virtual Size Read(void *ptr, Size numBytes)
directly read from the stream
Definition cachedstream.cc:133
virtual void Close()
close the stream
Definition cachedstream.cc:116
virtual void Seek(Offset offset, SeekOrigin origin)
seek in stream
Definition cachedstream.cc:154
virtual bool Eof() const
return true if end-of-stream reached
Definition cachedstream.cc:180
virtual Size GetSize() const
get the size of the stream in bytes
Definition cachedstream.cc:66
void * GetRawPointer() const
get a direct "raw" pointer to the data
Definition cachedstream.cc:227
virtual bool CanRead() const
memory streams support reading
Definition cachedstream.cc:39
virtual Core::Rtti const & GetParentRtti()=0
virtual bool CanBeMapped() const
memory streams are mappable
Definition cachedstream.cc:57
CachedStream()
constructor
Definition cachedstream.cc:14
virtual ~CachedStream()
destructor
Definition cachedstream.cc:25
unsigned char * buffer
Definition cachedstream.h:66
virtual bool Open()
open the stream
Definition cachedstream.cc:86
virtual Position GetPosition() const
get the current position of the read/write cursor
Definition cachedstream.cc:76
Position position
Definition cachedstream.h:65
Explicit cache for reusing read-only streams that are already opened.
Definition streamcache.h:23
Offers an abstract interface for read/write access to a sequence of bytes.
Definition stream.h:28
SeekOrigin
seek origins
Definition stream.h:54
int64_t Offset
Definition stream.h:33
int64_t Position
typedefs
Definition stream.h:32
int64_t Size
Definition stream.h:34
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
Nebula compiler specific defines and configuration.
Instances of wrapped stream classes.
Definition orientation.cc:10