13 #include <Poco/Timestamp.h>
18 #define INTERNAL_SLEEP 4000
22 if(!outDataRefine.isNull() && !ret.isNull())
25 std::map<unsigned long long, std::vector<WordPos> > wordPos;
26 unsigned long long key = 0llu;
27 std::vector<HCE::CWords> cwords = outDataRefine->getCWords();
28 unsigned int realWordPos = 0;
29 for(
unsigned int i = 0; i < cwords.size(); i++)
31 if(cwords[i].getWordType() != HCE::WORD_TYPE::WORD && cwords[i].getWordType() != HCE::WORD_TYPE::NUMBER)
35 key = crc64.
calc(cwords[i].getNormWord().c_str(), cwords[i].getNormWord().length());
36 auto it = wordPos.find(key);
37 if(it == wordPos.end())
39 std::vector<WordPos> localVec;
40 localVec.push_back(
WordPos(cwords[i].getOffset(), cwords[i].getOffset() + cwords[i].getInitWordLen(), realWordPos, 0));
41 wordPos.insert(std::pair<
unsigned long long, std::vector<WordPos> >(key, localVec));
45 (*it).second.push_back(
WordPos(cwords[i].getOffset(), cwords[i].getOffset() + cwords[i].getInitWordLen(), realWordPos, 0));
49 ret->push_back(wordPos);
60 if(!refinePtr.isNull())
62 ret =
WordPosPtrType(
new std::vector<std::map<
unsigned long long, std::vector<WordPos> > >);
63 Poco::SharedPtr<HCE::DataBase> inData =
nullptr;
64 Poco::SharedPtr<HCE::DataBase> outDataContent =
nullptr;
70 outDataContent = refinePtr->process(inData);
78 outDataContent = refinePtr->process(inData);
93 while((*it).second.second->test_and_set(std::memory_order_acquire))
97 ret = (*it).second.first;
107 (*it).second.second->clear(std::memory_order_release);
117 std::pair<unsigned long long, std::pair<WordPosPtrType, Poco::SharedPtr<std::atomic_flag> > > element;
119 element.second.first = wordPos;
120 element.second.second = Poco::SharedPtr<std::atomic_flag>(
new std::atomic_flag());
121 element.second.second->clear(std::memory_order_release);
131 while((*it).second.second->test_and_set(std::memory_order_acquire))
135 (*it).second.second->clear(std::memory_order_release);