openMSX
Classes | Public Types | Public Member Functions | List of all members
openmsx::FilePool Class Referencefinal

#include <FilePool.hh>

Inheritance diagram for openmsx::FilePool:
Inheritance graph
[legend]
Collaboration diagram for openmsx::FilePool:
Collaboration graph
[legend]

Public Types

enum  FileType { SYSTEM_ROM = 1, ROM = 2, DISK = 4, TAPE = 8 }
 

Public Member Functions

 FilePool (CommandController &controler, EventDistributor &distributor)
 
 ~FilePool ()
 
std::unique_ptr< FilegetFile (FileType fileType, const Sha1Sum &sha1sum)
 Search file with the given sha1sum. More...
 
Sha1Sum getSha1Sum (File &file)
 Calculate sha1sum for the given File object. More...
 
void removeSha1Sum (File &file)
 Remove sha1sum for this file from the cache. More...
 

Detailed Description

Definition at line 25 of file FilePool.hh.

Member Enumeration Documentation

Enumerator
SYSTEM_ROM 
ROM 
DISK 
TAPE 

Definition at line 32 of file FilePool.hh.

Constructor & Destructor Documentation

openmsx::FilePool::FilePool ( CommandController controler,
EventDistributor distributor 
)
openmsx::FilePool::~FilePool ( )

Member Function Documentation

unique_ptr< File > openmsx::FilePool::getFile ( FileType  fileType,
const Sha1Sum sha1sum 
)

Search file with the given sha1sum.

If found it returns the (already opened) file, if not found it returns nullptr.

Definition at line 253 of file FilePool.cc.

References openmsx::FileOperations::expandTilde(), openmsx::MSXException::getMessage(), openmsx::Timer::getTime(), and openmsx::CliComm::printWarning().

Referenced by openmsx::CassettePlayer::serialize(), and openmsx::DiskChanger::serialize().

Sha1Sum openmsx::FilePool::getSha1Sum ( File file)

Calculate sha1sum for the given File object.

If possible the result is retrieved from cache, avoiding the relatively expensive calculation.

Definition at line 473 of file FilePool.cc.

References end(), openmsx::File::getModificationDate(), openmsx::File::getURL(), and gl::sum().

Referenced by openmsx::File::getSha1Sum().

void openmsx::FilePool::removeSha1Sum ( File file)

Remove sha1sum for this file from the cache.

When the file was written to, sha1sum changes and it should be removed from the cache.

Definition at line 498 of file FilePool.cc.

References end(), and openmsx::File::getURL().

Referenced by openmsx::File::write().


The documentation for this class was generated from the following files: