Hydra 0.20
hydra.src/desktop/FileItemCache.h
00001 
00002 /*
00003  * Copyright (c) 2009 Aleksander B. Demko
00004  * This source code is distributed under the MIT license.
00005  * See the accompanying file LICENSE.MIT.txt for details.
00006  */
00007 
00008 #ifndef __INCLUDED_HYDRADESKTOP_FILEITEMCACHE_H__
00009 #define __INCLUDED_HYDRADESKTOP_FILEITEMCACHE_H__
00010 
00011 #include <hydra/Records.h>
00012 #include <desktop/LoadCache.h>
00013 
00014 namespace desktop
00015 {
00016   class FileItemCache;
00017 }
00018 
00019 /**
00020  * A cache mapping file hashes to FileItemRecords.
00021  *
00022  * THIS CLASS IS CURRENTLY NOT BEING USED.
00023  * Will reenable in the future when we want to catch circular references.
00024  *
00025  * @author Aleksander Demko
00026  */ 
00027 class desktop::FileItemCache
00028 {
00029   public:
00030     typedef LoadCacheBase<hydra::FileItemRecord,QUuid>::cache_ptr cache_ptr;
00031 
00032   public:
00033     FileItemCache(void);
00034     ~FileItemCache();
00035 
00036     static FileItemCache * instance(void) { return dm_instance; }
00037 
00038     //bool containsItem(const QString &fullfilename);
00039 
00040     // returns true on success
00041     bool getItem(const QString &fullfilename, desktop::cache_ptr<hydra::FileItemRecord,QUuid> &outitem, 
00042         QString &outhash, bool *needsBigRead = 0);
00043 
00044   private:
00045     LoadCacheBase<hydra::FileItemRecord, QUuid> dm_cache;
00046 
00047   private:
00048     static FileItemCache *dm_instance;
00049 };
00050 
00051 #endif
00052 
 All Classes Namespaces Functions Variables