Example #1
0
void
BaseType::printForm(std::ostream& out) const
{
    out << "-Base";
    if (qualifier != TQ_None)
    {
        out << ":";
        printQual(out,qualifier);
    }
}
Example #2
0
void
PtrType::printForm(std::ostream& out) const
{
    out << "-Ptr";
    if (qualifier != TQ_None)
    {
        out << ":";
        printQual(out,qualifier);
    }
    if (subType)
        subType->printForm(out);
}
Example #3
0
// o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o
void
PtrType::printBefore( std::ostream& out, Symbol *name, int level ) const
{
    if (subType)
    {
        subType->printBefore(out,NULL,level);
        
        bool paren = ! (subType->isPointer() || subType->isBaseType());
        
        if (paren)
            out << "(" ;
            
        out << "*" ;
        printQual(out,qualifier);
        
    }

    if (name)
    {
        out << *name;
    }
}
//***************************************************************************************************************
int SummaryQualCommand::execute(){
	try{
		
		if (abort == true) { if (calledHelp) { return 0; }  return 2;	}
		
		int start = time(NULL);
		int numSeqs = 0;
		
		vector<int> position;
		vector<int> averageQ;
		vector< vector<int> > scores;
				
		if (m->control_pressed) { return 0; }
		
		if (namefile != "") { nameMap = m->readNames(namefile); }
		else if (countfile != "") {
            CountTable ct;
            ct.readTable(countfile, false, false);
            nameMap = ct.getNameMap();
        }
        
		vector<unsigned long long> positions; 
#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
		positions = m->divideFile(qualfile, processors);
		for (int i = 0; i < (positions.size()-1); i++) {	lines.push_back(linePair(positions[i], positions[(i+1)]));	}
#else	
		if (processors == 1) {
			lines.push_back(linePair(0, 1000)); 
		}else {
			positions = m->setFilePosFasta(qualfile, numSeqs); 
            if (numSeqs < processors) { processors = numSeqs; }
			
			//figure out how many sequences you have to process
			int numSeqsPerProcessor = numSeqs / processors;
			for (int i = 0; i < processors; i++) {
				int startIndex =  i * numSeqsPerProcessor;
				if(i == (processors - 1)){	numSeqsPerProcessor = numSeqs - i * numSeqsPerProcessor; 	}
				lines.push_back(linePair(positions[startIndex], numSeqsPerProcessor));
			}
		}
#endif
		
		
		if(processors == 1){ numSeqs = driverCreateSummary(position, averageQ, scores, qualfile, lines[0]);  }
		else{  numSeqs = createProcessesCreateSummary(position, averageQ, scores, qualfile);  }
		
		if (m->control_pressed) {  return 0; }
		
		//print summary file
        map<string, string> variables; 
		variables["[filename]"] = outputDir + m->getRootName(m->getSimpleName(qualfile));
		string summaryFile = getOutputFileName("summary",variables);
		printQual(summaryFile, position, averageQ, scores);
		
		if (m->control_pressed) {  m->mothurRemove(summaryFile); return 0; }
		
		//output results to screen
		cout.setf(ios::fixed, ios::floatfield); cout.setf(ios::showpoint);
		m->mothurOutEndLine();
		m->mothurOut("Position\tNumSeqs\tAverageQ"); m->mothurOutEndLine();
		for (int i = 0; i < position.size(); i+=100) {
			float average = averageQ[i] / (float) position[i];
			cout << i << '\t' << position[i] << '\t' << average;
			m->mothurOutJustToLog(toString(i) + "\t" + toString(position[i]) + "\t" + toString(average)); m->mothurOutEndLine();
		}
		
		m->mothurOutEndLine();
		m->mothurOut("It took " + toString(time(NULL) - start) + " secs to create the summary file for " + toString(numSeqs) + " sequences."); m->mothurOutEndLine(); m->mothurOutEndLine();
		m->mothurOutEndLine();
		m->mothurOut("Output File Names: "); m->mothurOutEndLine();
		m->mothurOut(summaryFile); m->mothurOutEndLine();	outputNames.push_back(summaryFile); outputTypes["summary"].push_back(summaryFile);
		m->mothurOutEndLine();
		
		return 0;
	}
	catch(exception& e) {
		m->errorOut(e, "SummaryQualCommand", "execute");
		exit(1);
	}
}
Example #5
0
void
BaseType::printBase(std::ostream& out, int level) const
{
    printQual(out,qualifier);

    if (typemask & BT_UnSigned)
        out << "unsigned ";
    else if (typemask & BT_Signed)
        out << "signed ";

    if (typemask & BT_Void)
        out << "void ";
    else if (typemask & BT_Char)
        out << "char ";
    else if (typemask & BT_Short)
        out << "short ";
    else if (typemask & BT_LongLong)
        out << "long long ";
    else if (typemask & BT_Float)
        out << "float ";
    else if (typemask & BT_Float2)
        out << "float2 ";
    else if (typemask & BT_Float3)
        out << "float3 ";
    else if (typemask & BT_Float4)
        out << "float4 ";
    else if ((typemask & BT_Double) && (typemask & BT_Long))
        out << "long double ";
    else if (typemask & BT_Double)
        out << "double ";
    else if (typemask & BT_Ellipsis)
        out << "...";
    else if (typemask & BT_Long)
        out << "long ";
    else if (typemask & BT_Struct)
    {
        if (stDefn != NULL)
        {
            stDefn->print(out, NULL, level);
        }
        else
        {
            out << "struct ";

            if (tag)
                out << *tag << " ";
        }
    }
    else if (typemask & BT_Union)
    {
        if (stDefn != NULL)
        {
            stDefn->print(out, NULL, level);
        }
        else
        {
            out << "union ";

            if (tag)
                out << *tag << " ";
        }
    }
    else if (typemask & BT_Enum)
    {
        out << "enum ";
        if (enDefn != NULL)
        {
            enDefn->print(out, NULL, level);
        }
        else
        {
            if (tag)
                out << *tag << " ";
        }
    }
    else if (typemask & BT_UserType)
    {
        if (typeName)
            out << *typeName << " ";
    }
    else
    {
        out << "int ";        // Default
    }
}
Example #6
0
bool BaseType::printStructureStreamHelperType( std::ostream& out, const std::string& name ) const
{
    printQual(out,qualifier);

    if (typemask & BT_UnSigned)
        out << "unsigned ";
    else if (typemask & BT_Signed)
        out << "signed ";

    if (typemask & BT_Void)
        out << "void ";
    else if (typemask & BT_Char)
        out << "char ";
    else if (typemask & BT_Short)
        out << "short ";
    else if (typemask & BT_LongLong)
        out << "long long ";
    else if (typemask & BT_Float)
        out << "__BrtFloat1 ";
    else if (typemask & BT_Float2)
        out << "__BrtFloat2 ";
    else if (typemask & BT_Float3)
        out << "__BrtFloat3 ";
    else if (typemask & BT_Float4)
        out << "__BrtFloat4 ";
    else if ((typemask & BT_Double) && (typemask & BT_Long))
        out << "long double ";
    else if (typemask & BT_Double)
        out << "double ";
    else if (typemask & BT_Ellipsis)
        out << "...";
    else if (typemask & BT_Long)
        out << "long ";
    else if (typemask & BT_Struct)
    {
        if (stDefn != NULL)
        {
            if( !stDefn->printStructureStreamHelper(out) )
              return false;
        }
        else
        {
            out << "struct ";

            if (tag)
                out << "__cpustruct_" << *tag << " ";
        }
    }
    else if (typemask & BT_Union)
    {
      return false;
    }
    else if (typemask & BT_Enum)
    {
      return false;
    }
    else if (typemask & BT_UserType)
    {
        if (typeName)
            out << "__cpustruct_" << *typeName << " ";
    }
    else
    {
        out << "int ";        // Default
    }
    out << name;
    return true;
}