void convertHitsToASQG(const std::string& indexPrefix, const StringVector& hitsFilenames, std::ostream* pASQGWriter) { // Load the suffix array index and the reverse suffix array index // Note these are not the full suffix arrays SuffixArray* pFwdSAI = new SuffixArray(indexPrefix + SAI_EXT); SuffixArray* pRevSAI = new SuffixArray(indexPrefix + RSAI_EXT); // Load the ReadInfoTable for the queries to look up the ID and lengths of the hits ReadInfoTable* pQueryRIT = new ReadInfoTable(opt::readsFile); // If the target file is not the query file, load its ReadInfoTable ReadInfoTable* pTargetRIT; if(!opt::targetFile.empty() && opt::targetFile != opt::readsFile) pTargetRIT = new ReadInfoTable(opt::targetFile); else pTargetRIT = pQueryRIT; bool bIsSelfCompare = pTargetRIT == pQueryRIT; // Convert the hits to overlaps and write them to the asqg file as initial edges for(StringVector::const_iterator iter = hitsFilenames.begin(); iter != hitsFilenames.end(); ++iter) { printf("[%s] parsing file %s\n", PROGRAM_IDENT, iter->c_str()); std::istream* pReader = createReader(*iter); // Read each hit sequentially, converting it to an overlap std::string line; while(getline(*pReader, line)) { size_t readIdx; size_t totalEntries; bool isSubstring; OverlapVector ov; OverlapCommon::parseHitsString(line, pQueryRIT, pTargetRIT, pFwdSAI, pRevSAI, bIsSelfCompare, readIdx, totalEntries, ov, isSubstring); for(OverlapVector::iterator iter = ov.begin(); iter != ov.end(); ++iter) { ASQG::EdgeRecord edgeRecord(*iter); edgeRecord.write(*pASQGWriter); } } delete pReader; // delete the hits file unlink(iter->c_str()); } // Deallocate data if(pTargetRIT != pQueryRIT) delete pTargetRIT; delete pFwdSAI; delete pRevSAI; delete pQueryRIT; }
void RegistryComponent::SetComponentInfo(const ComponentInfo &info) { std::string KeyComponentClassId = Key_ComponentClassIDs; KeyComponentClassId += "/"; StringVector ClassIDs = info.GetClassIDs(); for (StringVector::const_iterator i = ClassIDs.begin() ; i != ClassIDs.end() ; ++i) { std::string ClassId = KeyComponentClassId; ClassId += *i; Reg.CreateKey(ClassId); Reg.SetValue(ClassId, info.GetModuleGuid().c_str()); } std::string KeyComponentInformation = Key_ComponentInformation; KeyComponentInformation += "/"; KeyComponentInformation += info.GetModuleGuid(); KeyComponentInformation += "/"; std::string Key = KeyComponentInformation; Key += Key_Type; Reg.CreateKey(Key); Reg.SetValue(Key, info.GetTypeAsStr().c_str()); Key = KeyComponentInformation; Key += Key_ModuleName; Reg.CreateKey(Key); Reg.SetValue(Key, info.GetModuleName().c_str()); Key = KeyComponentInformation; Key += Key_Location; Reg.CreateKey(Key); Reg.SetValue(Key, info.GetLocation().c_str()); Key = KeyComponentInformation; Key += Key_Description; Reg.CreateKey(Key); Reg.SetValue(Key, info.GetDescription().c_str()); Key = KeyComponentInformation; Key += Key_ClassIDs; Reg.CreateKey(Key); unsigned Index = 0; for (StringVector::const_iterator i = ClassIDs.begin() ; i != ClassIDs.end() ; ++i) { std::stringstream Io; Io << Key_ClassId << Index++; std::string ClassIdKey = Key + "/" + Io.str(); Reg.CreateKey(ClassIdKey); Reg.SetValue(ClassIdKey, static_cast<const char*>(i->c_str())); } }
//----------------------------------------------------------------------- void CgProgram::buildArgs(void) { StringVector args; if (!mCompileArgs.empty()) args = StringUtil::split(mCompileArgs); StringVector::const_iterator i; if (mSelectedCgProfile == CG_PROFILE_VS_1_1) { // Need the 'dcls' argument whenever we use this profile // otherwise compilation of the assembler will fail bool dclsFound = false; for (i = args.begin(); i != args.end(); ++i) { if (*i == "dcls") { dclsFound = true; break; } } if (!dclsFound) { args.push_back("-profileopts"); args.push_back("dcls"); } } // Now split args into that god-awful char** that Cg insists on freeCgArgs(); mCgArguments = new char*[args.size() + 1]; int index = 0; for (i = args.begin(); i != args.end(); ++i, ++index) { mCgArguments[index] = new char[i->length() + 1]; strcpy(mCgArguments[index], i->c_str()); } // Null terminate list mCgArguments[index] = 0; }