Nebula
Loading...
Searching...
No Matches
streamcache.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
13#include "core/refcounted.h"
14#include "core/singleton.h"
15#include "io/uri.h"
16#include "io/stream.h"
17#include "util/dictionary.h"
18
19//------------------------------------------------------------------------------
20namespace IO
21{
23{
26public:
30 virtual ~StreamCache();
31
33 bool IsCached(IO::URI const& uri) const;
37 bool OpenStream(IO::URI const& uri, Core::Rtti const& rtti);
39 void RemoveStream(IO::URI const& uri);
40
41private:
43 void Discard();
45 {
47 void * buffer = nullptr;
49 };
50
52};
53
54} // namespace IO
55//------------------------------------------------------------------------------
The common base class of Nebula.
Definition refcounted.h:38
Nebula's runtime type information for one class.
Definition rtti.h:27
Explicit cache for reusing read-only streams that are already opened.
Definition streamcache.h:23
Util::KeyValuePair< void *, Ptr< IO::Stream > > GetCachedStream(IO::URI const &uri)
Definition streamcache.cc:45
virtual ~StreamCache()
destructor
Definition streamcache.cc:26
__DeclareSingleton(StreamCache)
bool IsCached(IO::URI const &uri) const
Definition streamcache.cc:36
void Discard()
discard
Definition streamcache.cc:100
bool OpenStream(IO::URI const &uri, Core::Rtti const &rtti)
Definition streamcache.cc:57
void RemoveStream(IO::URI const &uri)
Definition streamcache.cc:81
StreamCache()
constructor
Definition streamcache.cc:18
__DeclareClass(StreamCache)
Util::Dictionary< Util::String, CacheEntry > streams
Definition streamcache.h:51
An URI object can split a Uniform Resource Identifier string into its components or build a string fr...
Definition uri.h:67
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
A collection of key/value pairs with quick value retrieval by key at roughly O(log n).
Definition dictionary.h:34
Key/Value pair objects are used by most assiociative container classes, like Dictionary or HashTable.
Definition keyvaluepair.h:19
Instances of wrapped stream classes.
Definition orientation.cc:10
Definition streamcache.h:45
void * buffer
Definition streamcache.h:47
SizeT useCount
Definition streamcache.h:48
Ptr< IO::Stream > stream
Definition streamcache.h:46
int SizeT
Definition types.h:49