tVecStr ImageManager::filterByDate ( tVecStr list , BppTree & tree ) { TreeIterator& it = tree.first(); while ( !it.end() ) { KeyStr* key = dynamic_cast<KeyStr*>(it.getKey()); if( imgTree.exists( *key ) ) { ValueInt* idImg = dynamic_cast<ValueInt*>( imgTree.find( *key )); if( idImg != NULL ) { ImgRegistry* reg=dynamic_cast<ImgRegistry*>(orgImages.GetRegistry(idImg->getValue())); Date d = reg->GetDate(); if (! ( d == Date::getDate( key->getKey().c_str()) )) { list.push_back( key->getKey() ); } } delete idImg; } delete key; ++it; } tree.deleteIterator(it); return list; }
TEST_F(ExprConcatTest, Value) { ValueInt* v = dynamic_cast<ValueInt*>(testRule->value(*startState)); if(v) EXPECT_EQ(5, v->getValue()); else FAIL(); }
TEST_F(RepeatTest, State) { StateTuple endState = testRuleState->sigma(*startState); ValueInt* v = dynamic_cast<ValueInt*>(endState.getPStateValue("x")); if(v) EXPECT_EQ(10, v->getValue()); else FAIL(); }
/* -------------------------------------------------------------------------- */ void ImageManager::DeleteImage(string imgPath, tVecStr* imgErasedList, bool filterAll, bool removetoTree) { KeyStr key(imgPath); if(!imgTree.empty()) { if(imgTree.exists(key)) { ValueInt* vInt = dynamic_cast<ValueInt*>(imgTree.find(key)); DeleteImage(vInt->getValue(), imgErasedList, filterAll, removetoTree); delete vInt; } } }
/* -------------------------------------------------------------------------- */ void ImageManager::ShowMessageFromDirectory(const char* dirPath) { if( imgTree.empty()) return; tVecStr fileList = FileSystem::GetFiles(dirPath,File); if(fileList.empty()) return; std::list<string> listNameMsg; string strDirPath(dirPath); StrToken::FormatPath(strDirPath); for( unsigned int i=0; i<fileList.size(); i++) { string fullPath = strDirPath + fileList[i]; KeyStr key(fileList[i]); ValueInt* vInt = dynamic_cast<ValueInt*>(imgTree.find(key)); if( vInt == NULL) continue; ImgRegistry* imgReg = dynamic_cast<ImgRegistry*>(orgImages.GetRegistry(vInt->getValue())); tRegisterList* listIdMsg = this->orgListMsgs.GetList(imgReg->GetPtrFreeSpaceList()); if( listIdMsg != NULL ) { itRegisterList it; MessageManager* messageManager = MessageManager::GetInstance(); for( it=listIdMsg->begin(); it != listIdMsg->end(); it++ ) { ListMsgRegistry* listMsgReg = dynamic_cast<ListMsgRegistry*>(*it); ID_type idMsg = listMsgReg->GetIDMessage(); std::string nameMsg = messageManager->GetNameMessage(idMsg); listNameMsg.push_back(nameMsg); delete listMsgReg; } delete listIdMsg; } delete vInt; delete imgReg; delete listIdMsg; } listNameMsg.unique(); std::list<string>::iterator it; for(it=listNameMsg.begin(); it != listNameMsg.end(); it++) { std::cout << (*it) << "\n"; } }