highlighter application  1.1
HCE project utils : highlighter
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
ContentsStorageSimple.hpp
Go to the documentation of this file.
1 
13 #ifndef CONTENTS_STORAGE_SIMPLE_HPP
14 #define CONTENTS_STORAGE_SIMPLE_HPP
15 
16 #include <atomic>
17 #include <map>
18 #include <unistd.h>
19 
20 #include "ContentsStorageBase.hpp"
21 
23 {
24  protected:
25  void fillWordPosMap(Poco::SharedPtr<HCE::OutDataRefine> outDataRefine, ContentsStorageBase::WordPosPtrType ret);
26  std::map<unsigned long long, std::pair<WordPosPtrType, Poco::SharedPtr<std::atomic_flag> > > wordPosCache;
27  public:
28  ContentsStorageSimple(unsigned int refinesCount);
29  virtual WordPosPtrType wordMapExctract(unsigned long long key, std::string &incomeContent);
30  virtual void wordMapRelease(unsigned long long key, WordPosPtrType &refinePtr);
31  void cacheAddElement(unsigned long long key, WordPosPtrType wordPos);
32  void cacheClear();
33  unsigned int getCacheSize() const {return wordPosCache.size();}
34  virtual ~ContentsStorageSimple();
35 };
36 
37 #endif