X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fresourcemanager.h;h=afa2c2d073e45b32b25332a91a3be9c7c8568461;hp=a2a4975db5185eaf3eadf7348e995f9a0b4ca5b7;hb=cfd4d36c2b6b6095ada3aef8082e5d409a233a21;hpb=508319df28270eccdfa03a880a8604549278a139 diff --git a/source/resourcemanager.h b/source/resourcemanager.h index a2a4975d..afa2c2d0 100644 --- a/source/resourcemanager.h +++ b/source/resourcemanager.h @@ -16,6 +16,7 @@ class ResourceWatcher; class resource_load_error: public std::runtime_error { public: + resource_load_error(const std::string &, const std::string &); resource_load_error(const std::string &, const std::exception &); virtual ~resource_load_error() throw() { } }; @@ -31,6 +32,15 @@ public: LOAD_MANUALLY }; + struct ResourceLocation + { + DataFile::Collection *collection; + std::string name; + + ResourceLocation(); + ResourceLocation(DataFile::Collection &, const std::string &); + }; + private: struct ManagedResource { @@ -45,8 +55,8 @@ private: }; Resource *resource; - DataFile::Collection *collection; - std::string name; + ResourceLocation location; + bool load_priority; IO::Seekable *io; Resource::AsyncLoader *loader; State state; @@ -78,6 +88,8 @@ private: unsigned capacity; unsigned size; std::list error_queue; + Mutex data_size_mutex; + UInt64 loaded_data_size; volatile bool done; public: @@ -96,6 +108,7 @@ private: public: bool sync(); bool needs_work() const { return size