2021-03-13 | Paul Boddie | raw annotate files changeset graph | Renamed file_open to file_context_open, providing file_open as a convenience function that creates a context, sets the filename, opens the file, and closes the context. Changed the string-setting function to be more immediately useful, if more complicated in operation, for this application. |
1 #include "paging.h" 2 3 bool Paging::reserve(Accessor *accessor) 4 { 5 _lock.lock(); 6 7 return _mappers.find(accessor) != _mappers.end(); 8 } 9 10 PageMapper *Paging::get(Accessor *accessor) 11 { 12 AccessorMapping::iterator entry = _mappers.find(accessor); 13 PageMapper *mapper; 14 15 if (entry == _mappers.end()) 16 mapper = NULL; 17 else 18 mapper = entry->second; 19 20 _lock.unlock(); 21 return mapper; 22 } 23 24 void Paging::set(Accessor *accessor, PageMapper *mapper) 25 { 26 AccessorMapping::iterator entry = _mappers.find(accessor); 27 28 if (entry == _mappers.end()) 29 _mappers[accessor] = mapper; 30 31 _lock.unlock(); 32 } 33 34 // vim: tabstop=4 expandtab shiftwidth=4