Commit Graph

15 Commits (bfa303f73b24eb386977304c62a8d8120a06508b)

Author SHA1 Message Date
clang-format-bot ddb0522bbf
Apply clang-format to code base 2 years ago
Project579 e5c417c968 Make sure all paths are passed as std::filesystem::path instead of std::string where possible. 2 years ago
elsid f99ed6f1db
Split components/misc/stringops.hpp into multiple headers
Replace all ciEqual overloads with one having std::string_view as argument.
2 years ago
elsid 3affe9913f
Limit the number of simultaneously open not actively used content files
Use LRU cache for ESMReaders. When cache capacity is reached close least
recently used ESMReader. Remember the file name if a reader was open. Once the
reader requested again open the file if there is stored name for it. Put
released ESMReader to the back of the free items list. Close ESMReader's from
the front of the free items list.

Cached item can be used only by one client at the same time. If the same item is
requested twice exception is thrown. This should never happen in practice. If
this happens need to fix the client logic.

It's allowed to go over the capacity limit when requesting different readers.
Ideally this should never happen but there will be system error anyway
signalizing about too many open files. Need to fix client logic in this case.

All places that were using a vector of ESMReaders now using the cache. Cache is
local for each use case and there is no need for a thread safety.
3 years ago
jvoisin 23eccebe9e Convert esmtool from `const std::string&` to `std::string_view` 3 years ago
elsid b09570692e
Use ifstream for ESMReader
ESMReader reads the whole file, there is no need in the ConstrainedFileStream.
3 years ago
elsid 4447ab0ed7
Remove ESM:: namespace qualifier in components/esm3/ and tests 3 years ago
psi29a 03806eb75e Merge branch 'esm_rm_redundant_include' into 'master'
Remove redundant include from esm3/esmreader.hpp

See merge request OpenMW/openmw!1761
3 years ago
elsid 6481324eb1
Read when need to skip few bytes 3 years ago
elsid db44f91fd5
Remove redundant include from esm3/esmreader.hpp 3 years ago
elsid c3a924de23
Fix skip DATA in cell ref loading 3 years ago
elsid 6b464a9330
Check ESMReader value size in compile time 3 years ago
elsid bbfdb347bd
Skip load cell ref when there is no need
Primarily to avoid temporary allocations by ESMReader::getHString.
3 years ago
elsid 3305b400dc
Use ESM::NAME instead of const char* and std::string as argument type 3 years ago
Bret Curtis d1fb854521 move most of the files from esm to esm3, keep common code in esm; this is make space for a future with esm4
esm typo

esm typo
3 years ago