void printFunctions(std::wstringstream& str,const UDT::Functions& functions,int depth,CV_access_e& protection) { for(UDT::Functions::const_iterator it = functions.begin(); it != functions.end(); ++it) { std::wstring name = it->getName(); if(!name.empty()) { str << checkProtection(it->protection(),protection,depth); printDepth(str,depth+1); if(it->reservedName()) str << L"// "; if(it->isCompilerGenerated()) str << L"/* compiler generated */ "; if(it->isStatic()) str << L"static "; if(it->isVirtual()) str << L"virtual "; str << it->returnType() << L" "; str << it->callingConvention(); str << name; str << L"("; std::list<std::wstring> args = it->getArgs(); bool first = true; for(std::list<std::wstring>::iterator it2 = args.begin(); it2 != args.end(); ++it2) { if(!first)str << L", "; first = false; str << *it2; } str << L")"; if(it->isPure()) str << L" = 0"; if(it->isConst()) str << L" const"; unsigned int rva = it->getRVA(); if(rva) str << L" //" << rva; std::list<std::wstring> localVars = it->getLocalVars(); if(localVars.empty()) { str << L";" << std::endl; } else { str << L"\n"; printDepth(str,depth+1); str << L"{\n"; for(std::list<std::wstring>::iterator it3 = localVars.begin(); it3 != localVars.end(); ++it3) { printDepth(str,depth+2); str << *it3 << std::endl; } printDepth(str,depth+1); str << L"}\n"; } } } }
// recursive function to print resource tree void printRescTree( const std::string& node_name, std::string depth ) { int resc_index; // get children string resc_index = resc_map[node_name]; std::string& children_str = resc_children[resc_index]; // print node name, and type if not UFS if ( resc_types[resc_index] != irods::RESOURCE_TYPE_NATIVE ) { std::cout << node_name << ":" << resc_types[resc_index] << std::endl; } else { std::cout << node_name << std::endl; } // if leaf we're done if ( children_str.empty() ) { return; } // print children irods::children_parser parser; parser.set_string( children_str ); irods::children_parser::const_iterator it, final_it = parser.end(); final_it--; for ( it = parser.begin(); it != parser.end(); ++it ) { if ( it != final_it ) { // print depth string printDepth( depth ); // print middle child connector std::cout << middle_child_connector[gfx_mode]; // append '1' to depth string and print child printRescTree( it->first, depth + "1" ); } else { // print depth string printDepth( depth ); // print last child connector std::cout << last_child_connector[gfx_mode]; // append '0' to depth string and print child printRescTree( it->first, depth + "0" ); } } return; }
void printUDT(std::wstringstream& str,const UDT& udt,int depth) { printDepth(str,depth); //str << udt.getID() << L" " << udt.getTypeID() << L" "; str << udt.getKind() << L" " << udt.getName(); UDT::Bases bases = udt.getBases(); printBaseList(str,bases); str << std::endl; printDepth(str,depth); str << L"{\n"; CV_access_e protection = udt.getDefaultProtection(); UDT::Nested nested = udt.getNested(); for(UDT::Nested::const_iterator it = nested.begin(); it != nested.end(); ++it) { printUDT(str,*it,depth+1); } /* std::wstring friends = udt.getFriends(); if(!friends.empty()) { printDepth(str,depth); str << L"//friends " << friends << std::endl; } */ std::wstring enums = udt.getEnums(); if(!enums.empty()) { str << enums; } std::wstring typedefs = udt.getTypedefs(); if(!typedefs.empty()) { str << typedefs; } UDT::DataMembers dataMembers = udt.getDataMembers(); printMembers(str,dataMembers,depth,protection); UDT::Functions functions = udt.getFunctions(); printFunctions(str,functions,depth,protection); printDepth(str,depth); str << L"};\n"; }
void printFunctionReturns(std::wstringstream& str,const UDT::Functions& functions,int depth) { for(UDT::Functions::const_iterator it = functions.begin(); it != functions.end(); ++it) { std::wstring name = it->getName(); if(!name.empty()) { printDepth(str,depth+1); str << it->returnType() << L" // " << name << L"\n"; } } }
std::wstring checkProtection(CV_access_e member,CV_access_e& current,int depth) { if(current != member) { std::wstringstream str; printDepth(str,depth); switch(member) { case CV_private: str << L"private:\n"; break; case CV_protected: str << L"protected:\n"; break; case CV_public: str << L"public:\n"; break; } current = member; return str.str(); } return L""; }
void printMembers(std::wstringstream& str, const UDT::DataMembers& dataMembers,int depth,CV_access_e& protection) { for(UDT::DataMembers::const_iterator it = dataMembers.begin(); it != dataMembers.end(); ++it) { str << checkProtection(it->protection(),protection,depth); printDepth(str,depth+1); if(it->isStatic()) str << L"static "; if(it->pointerToFunction()) { str << it->type() << L";" << std::endl; } else { str << it->type() << L" "; str << it->getName(); str << L";" << std::endl; } } }
//$ <test executable> <input file containing sequence s> <input alphabet file> int main(int argc, char* argv[]) { seqlength=loadseq(argv[1]); printf("seqlength %d \n", seqlength); nalpha=loadalpha(argv[2]); printf("nalpha %d \n",nalpha); buildTree(); //// top results pid_t pid=getpid(); printf("pid %d\n", pid); sprintf(topcommand, "top -b -n 1 -p %d >%s.top ", pid , argv[1]); system(topcommand); /////post -order print potdepths=malloc(internalID*sizeof(int)); memset(potdepths, 0, internalID*sizeof(int)); printf("\n\n++++++++++++++++\n"); printTree(root); // post-order, find max depth here printf("post-order traversal depths\n"); printDepth(potdepths); /////// DFS print d=0; dfsdepths=malloc(internalID*sizeof(int)); memset(dfsdepths, 0, internalID*sizeof(int)); printf("\n\n++++++++++++++++\n"); DFS(root); // post-order printf("DFS depths\n"); printDepth(dfsdepths); // longest exact matching printf("\n\n++++++++++++++++\n"); printf("avg internal depth: %d, max internal depth: %d\n", sumdepth/(internalID-seqlength),maxdepth ); int i =0; while(maxnodes[i]) { printf("longest exact matching sequence is at node %d :\n", maxnodes[i]->id); printLongest(maxnodes[i]); printf("for suffix :\n"); printChildren(maxnodes[i]); i++; printf("\n"); } }
/*! * \brief load next Depth frame to depth vector */ void MainCalib::nextDepthFrame() { //qDebug("MainCalib::nextDepthFrame"); device->getDepth(depth); emit printDepth(); }