当前位置: 首页>>代码示例>>C++>>正文


C++ Timing::printStreamStatus方法代码示例

本文整理汇总了C++中Timing::printStreamStatus方法的典型用法代码示例。如果您正苦于以下问题:C++ Timing::printStreamStatus方法的具体用法?C++ Timing::printStreamStatus怎么用?C++ Timing::printStreamStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Timing的用法示例。


在下文中一共展示了Timing::printStreamStatus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: loadAnalysisParameters

//Opens a text file set by the user and loads the requested parameters
void ParameterLoaderAnaysis::loadAnalysisParameters(string & strInputSetupFile, AnalysisSetupUniformity &aSetupUniformity){
    //Variable Declaration
    bool bExitSuccess = false;
    
    pair<string,string> pair_strParam; //Input file is setup in <Field, Value> pairs; not used here yet but placeholder
    
    string strLine = "";    //Line taken from the input file
    //string strHeading = ""; //For storing detector heading
    
    vector<string> vec_strList; //For storing char separated input; not used here yet but placeholder
    
    //Open the Data File
    //------------------------------------------------------
    if (bVerboseMode_IO) { //Case: User Requested Verbose Error Messages - I/O
        printClassMethodMsg("ParameterLoaderAnaysis","loadAnalysisParameters", ("trying to open and read: " + strInputSetupFile).c_str() );
    } //End Case: User Requested Verbose Error Messages - I/O
    
    ifstream fStream( strInputSetupFile.c_str() );
    
    //Check to See if Data File Opened Successfully
    //------------------------------------------------------
    if (!fStream.is_open() && bVerboseMode_IO) {
        perror( ("Uniformity::ParameterLoaderAnaysis::loadAnalysisParameters(): error while opening file: " + strInputSetupFile).c_str() );
        printStreamStatus(fStream);
    }
    
    ////Loop Over data Input File
    //------------------------------------------------------
    //Read the file via std::getline().  Obey good coding practice rules:
    //  -first the I/O operation, then error check, then data processing
    //  -failbit and badbit prevent data processing, eofbit does not
    //See: http://gehrcke.de/2011/06/reading-files-in-c-using-ifstream-dealing-correctly-with-badbit-failbit-eofbit-and-perror/
    while ( getlineNoSpaces(fStream, strLine) ) {
        //Reset exit flag used in string manipulation
        bExitSuccess = false;
        
        //Does the user want to comment out this line?
        if ( 0 == strLine.compare(0,1,"#") ) continue;
        
        //Debugging
        cout<<"strLine = " << strLine.c_str() << endl;
        
        //Identify Section Headers
        if ( 0 == strLine.compare(strSecEnd_Analysis) ) { //Case: Reached End of File
            
            //Debugging
            cout<<"Found End of Analysis Section"<<endl;
            
            break;
        } //End Case: Reached End of File
        else if ( 0 == strLine.compare(strSecBegin_Analysis) ) { //Case: Analysis Header
            
            //Filler for now; intentionally empty
            
        } //End Case: Analysis Header
        else if ( 0 == strLine.compare(strSecBegin_Timing) ) { //Case: Timing Parameters
            //Debugging
            cout<<"Found Start of Timing Section"<<endl;
            
            loadAnalysisParametersTiming(fStream, aSetupUniformity);
        } //End Case: Timing Parameters
        else if ( 0 == strLine.compare(strSecBegin_Uniformity) ) { //Case: Uniformity Parameters
            //Debugging
            cout<<"Found Start of Uniformity Section"<<endl;
            
            loadAnalysisParametersUniformity(fStream, aSetupUniformity);
        } //End Case: Uniformity Parameters
        else { //Case: Unsorted Parameters
            
            //Filler for now; intentionally empty but may return to it later
            
        } //End Case: Unsorted Parameters
    } //End Loop Over Input File
    
    //Check to see if we had problems while reading the file
    if (fStream.bad() && bVerboseMode_IO) {
        perror( ("Uniformity::ParameterLoaderAnaysis::loadAnalysisParameters(): error while reading file: " + strInputSetupFile).c_str() );
        printStreamStatus(fStream);
    }
    
    return;
} //End ParameterLoaderAnaysis::loadAnalysisParameters()
开发者ID:jhallan,项目名称:CMS_GEM_Analysis_Framework,代码行数:83,代码来源:ParameterLoaderAnaysis.cpp


注:本文中的Timing::printStreamStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。