MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / Store

Method Store

engine/Poseidon/IO/FileServer.cpp:169–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167}
168
169void FileCache::Store(QIFStreamB& stream, const char* name)
170{
171 // search the cache
172 int index = Find(name);
173 if (index >= 0)
174 {
175 if (index != 0)
176 {
177 MoveToFront(index);
178 }
179 return;
180 }
181 // not cached yet
182 FileInCache* newEntry = new FileInCache(stream, name);
183 _cache.Insert(0, newEntry);
184 PoseidonAssert(newEntry->_data.tellg() == 0);
185 _size += newEntry->_data.rest();
186 Maintain();
187}
188void FileCache::Maintain()
189{
190 while ((_size > _maxSize || _cache.Size() > _maxFiles) && _cache.Size() > 1)

Callers 1

OpenMethod · 0.80

Calls 4

FindFunction · 0.85
tellgMethod · 0.80
restMethod · 0.80
InsertMethod · 0.45

Tested by

no test coverage detected