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


C++ SharedPtr::isNull方法代码示例

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


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

示例1: UpdateUISetting

void CLogAnalyzerView::UpdateUISetting()
{
    if (!m_logger->GetActiveUISetting().isNull())
    {
        tstring strSettingName = m_logger->GetActiveUISetting()->getName();
        CLogAnalyzerApp* app = (CLogAnalyzerApp*)AfxGetApp();
        if (app != NULL)
        {
            Poco::SharedPtr<CUISetting> currentSelSetting = app->GetUISetting(strSettingName);
            if (!currentSelSetting.isNull())
                m_logger->SetActiveUISetting(currentSelSetting);
        }
    }
    
}
开发者ID:yanjunnf,项目名称:LogAnalyzer,代码行数:15,代码来源:LogAnalyzerView.cpp

示例2: ShowTraces

void CLogAnalyzerView::ShowTraces(const CString& strComponent, BOOL bShowAll)
{
    tstring strItemText = strComponent;
    const std::map<tstring, Poco::SharedPtr<CComponent>>& components = m_logger->GetComponents();
    std::map<tstring, Poco::SharedPtr<CComponent>>::const_iterator ite = components.find(strItemText);
    if (ite != components.end())
    {
        const std::vector<Poco::SharedPtr<CTraceLog>>& traceLogs = ite->second->GetTraceLogs();
        if (bShowAll)
        {
            //Only show the traces you want in list control
            m_traceList.DeleteAllTraceLog();
            for (int i = 0; i < traceLogs.size(); ++i)
                m_traceList.InsertTraceLog(traceLogs.at(i));
        }
        //Show all traces and go to the first trace log that fits to you want
        else
        {
            Poco::SharedPtr<CUISetting> uiSetting = m_logger->GetActiveUISetting();
            int nColumn = 0;
            int nCurSel = m_comboColumns.GetCurSel();
            if (nCurSel == 0)
                nColumn = -1; //All
            else
            {
                CString strItem;
                m_comboColumns.GetLBText(nCurSel, strItem);
                tstring strItemValue = strItem.GetBuffer(strItem.GetLength());
                if (!uiSetting.isNull())
                {
                    for (int i = 0; i < uiSetting->GetAllColumns().size(); ++i)
                    {
                        if (strItemValue == uiSetting->GetAllColumns().at(i)->m_strRealColumnName)
                        {
                            nColumn = i;
                            break;
                        }
                    }
                }
            }

            m_traceList.SearchText(nColumn, m_strFindContent.GetBuffer(m_strFindContent.GetLength()), m_bMatchCase);
        }
        m_strCurrentPage.Format("%d", m_traceList.GetCurrentPage());
        m_strTraceCount.Format("Total : %d", m_traceList.GetCount());
        UpdateData(FALSE);
    }
}
开发者ID:yanjunnf,项目名称:LogAnalyzer,代码行数:48,代码来源:LogAnalyzerView.cpp

示例3: httpRequest

void NetPoco::httpRequest(string request, HTTPClientSession  *session,string path, string headKey){
    
    //Expires defaults to NOW. Will be reset if Expires or max-age headers are found!
    DateTime expires;
    
    cout << "DateTime now : " << DateTimeFormatter::format(expires.timestamp(), DateTimeFormat::RFC1123_FORMAT) << "\n";
    
	HTTPRequest headReq(request, path, HTTPMessage::HTTP_1_1);
    Poco::SharedPtr<pair<map<string,string>, string > > dataFromCache = clientCache->get(headKey);
    if (!dataFromCache.isNull()) {
        map<string,string> cachedHeaders = dataFromCache->first;
        //cout << "HEADERS: \n";
        
        //First check expires (HTTP 1.0):
        map<string,string>::iterator pos = cachedHeaders.find("Expires");
        if (pos != cachedHeaders.end()) {
            cout << "Expires found" << pos->second << "\n";
            DateTime dt;
            int tzd;
            DateTimeParser::parse(DateTimeFormat::RFC1123_FORMAT, pos->second , dt, tzd);
            expires = dt;
        }
        
        
        //Replace result with max-age if found (HTTP 1.1):
        pos = cachedHeaders.find("Cache-Control");
        if (pos != cachedHeaders.end()) {
            StringTokenizer cacheControlPairs(pos->second, ",", StringTokenizer::TOK_TRIM);
            //cout << "Control pairs : " << cacheControlPairs.count() << "\n";
            for(StringTokenizer::Iterator it = cacheControlPairs.begin(); it != cacheControlPairs.end(); ++it) {
                //cout << "Inspecting : "<< * it << "\n";
                if(string::npos != it->find("max-age")){
                    StringTokenizer maxAgePair(pos->second, "=", StringTokenizer::TOK_TRIM);
                    if (maxAgePair.count()==2) {
                        unsigned int secondsMaxAge = atoi(maxAgePair[1].c_str());
                        cout << "Found max-age : " <<  secondsMaxAge << "\n";
                        //cout << DateTime().dayOfWeek() << "\n";
                        //Set expires to max-age:
                        map<string,string>::iterator pos = cachedHeaders.find("Date");
                        if (pos != cachedHeaders.end()) {
                            cout << "Date found : " << pos->second << "\n";
                            DateTime dt;
                            int tzd;
                            DateTimeParser::parse(DateTimeFormat::RFC1123_FORMAT, pos->second , dt, tzd);
                            dt+=convertToMicro(secondsMaxAge);
                            cout << "expires : " << DateTimeFormatter::format(dt.timestamp(), DateTimeFormat::RFC1123_FORMAT) << "\n";
                            expires = dt;
                        }
               
                        
                    }else{
                        cout << "Error invalid max-age" << "\n";
                    }
                    break;
                }
                
            }
            
        }
        
        DateTime now;
        //If not Expired use cache:
        if (now < expires ) {
            cout << "now < expires" << endl;
            this->usingCached = true;
            return;
        }else{
            cout << "now > expires" << endl;
            this->usingCached = false;
            //Append Last-Modified and ETag to request headers:
            pos = cachedHeaders.find("Last-Modified");
            if (pos != cachedHeaders.end()) {
                headReq.set("IF-MODIFIED-SINCE", pos->second);
            }
        
            pos = cachedHeaders.find("ETag");
            if (pos != cachedHeaders.end()) {
                headReq.set("IF-NONE-MATCH", pos->second);
            }
        }
    }
    else{
        //No data in cache:
        this->usingCached = false;
        cout << "Cache was empty" << "\n";

    }
    cout << "send Request! \n";
    session->sendRequest(headReq);

}
开发者ID:babafall,项目名称:Sogeti-MasterThesis-CrossPlatformMobileDevelopment,代码行数:91,代码来源:NetPoco.cpp

示例4: exportComponents


//.........这里部分代码省略.........

        logger().debug("Exporting components for source #" +
            Poco::NumberFormatter::format(sourceIndex));
        for (vector<int>::const_iterator it = sourceIt->begin();
            it != sourceIt->end(); ++it)
        {
            if (*it < 1 || *it > _nrOfComponents) {
                logger().error(nameAndTaskID() + ": invalid component index: " +
                    Poco::NumberFormatter::format(*it));
                continue;
            }
            int i = *it - 1;
            logger().debug(nameAndTaskID() + " exporting component #" +
                Poco::NumberFormatter::format(i));
            // Compute the component's magnitude spectrum.
            Poco::SharedPtr<Matrix> magnitudeSpectrum = new Matrix(
                magnitudeSpectraMatrix(0).rows(),
                gainsMatrix().cols());
            // NMD case
            if (_nrOfSpectra > 1) {
                magnitudeSpectrum->zero();
                RowVector componentGains = gainsMatrix().nthRow(i);
                for (unsigned int t = 0; t < _nrOfSpectra; t++) {
                    ColVector componentSpectrum = magnitudeSpectraMatrix(t).nthColumn(i);
                    magnitudeSpectrum->add(componentSpectrum * componentGains);
                    componentGains.shiftRight();
                }
            }
            // "NMF" case (separated for efficiency)
            else {
                ColVector componentSpectrum = magnitudeSpectraMatrix(0).nthColumn(i);
                RowVector componentGains = gainsMatrix().nthRow(i);
                *magnitudeSpectrum = componentSpectrum * componentGains;
            }

            // revert transformation to component spectrogram
            magnitudeSpectrum = revertTransforms(magnitudeSpectrum);

            if (wienerRec) {
                // (Component/Whole) reconstruction
                reconst->floor(1e-6);
                magnitudeSpectrum->elementWiseDivision(*reconst, magnitudeSpectrum);
                // Use as filter for original spectrogram
                magnitudeSpectrum->elementWiseMultiplication(ftMagMatrix(),
                                                       magnitudeSpectrum);
            }

            // Mix the components to a single spectrogram that is exported after
            // the loop.
            if (_mixExportedComponents) {
                if (mixedSpectrogram.isNull()) {
                    mixedSpectrogram = new Matrix(magnitudeSpectrum->rows(), 
                        magnitudeSpectrum->cols());
                    mixedSpectrogram->zero();
                }
                mixedSpectrogram->add(*magnitudeSpectrum);
            }
            // Export components individually.
            else {
                // Construct the filename.
                string prefix = getExportPrefix();
                const int numDigits = (int)(1 + log10f((float)_nrOfComponents));
                stringstream ss;
                ss << prefix;
                if (compIndices.size() > 1) {
                    const int numDigitsS = (int)(1 + log10f((float)compIndices.size()));
                    ss << '_' << setfill('0') << setw(numDigitsS) << sourceIndex;
                }
                ss << '_' << setfill('0') << setw(numDigits) << *it;

                if (exportAsMatrix) {
                    magnitudeSpectrum->dump(ss.str() + ".dat");
                }
                if (exportAsWave) {
                    // Convert component spectrogram to time signal and save it as WAV.
                    spectrogramToAudioFile(magnitudeSpectrum, ss.str() + ".wav");
                }
            }
        }
        // Export the mixed source spectrogram to a single audio file.
        if (_mixExportedComponents) {
            // Construct the filename.
            stringstream ss;
            ss << getExportPrefix();
            const int numDigitsS = (int)(1 + log10f((float)compIndices.size()));
            ss << "_source" << setfill('0') << setw(numDigitsS) << sourceIndex;
            // Convert component spectrogram to time signal and save it as WAV.
            string filename = ss.str();
            logger().debug(nameAndTaskID() + ": creating mixed audio file " +
                filename);
            if (exportAsMatrix) {
                mixedSpectrogram->dump(filename + ".dat");
            }
            if (exportAsWave) {
                spectrogramToAudioFile(mixedSpectrogram, filename + ".wav");
            }
        }
    }

}
开发者ID:Spencerx,项目名称:openBliSSART,代码行数:101,代码来源:SeparationTask.cpp

示例5: OnBnClickedButtonOpen

void CLogAnalyzerView::OnBnClickedButtonOpen()
{
    //Open File
    if (!m_logger.isNull() && !(m_logger->GetActiveUISetting().isNull()))
    {
        if (!m_logger->GetActiveUISetting()->IsAvailable())
            if (AfxMessageBox("The UI setting is not available, Do you want to configurate it?", MB_OKCANCEL) == IDOK)
            {
                //OnAnalyseSetting();
                return;
            }
    }

    CString strFile = _T("");
    CFileDialog dlgFile(TRUE, NULL, NULL, OFN_HIDEREADONLY, _T("Describe Files (*.log)|*.log|All Files (*.*)|*.*||"), NULL);

    if (dlgFile.DoModal() == IDOK)
    {
        strFile = dlgFile.GetPathName();

        CString strItem;
        m_comboSettings.GetLBText(m_comboSettings.GetCurSel(), strItem);
        CLogAnalyzerApp* app = (CLogAnalyzerApp*)AfxGetApp();
        if (app != NULL)
        {
            Poco::SharedPtr<CUISetting> currentSelSetting = app->GetUISetting(strItem.GetBuffer(strItem.GetLength()));
            if (!currentSelSetting.isNull())
            {
                if (!m_logger.isNull() && !m_logger->GetFileName().empty())
                {
                    m_logger->ClearAllComponents();
                    //Open another log file, remove the previous one
                    RemoveItem();
                }
                m_logger->SetActiveUISetting(currentSelSetting);
            }

            //Update list control
            while(m_comboColumns.DeleteString(0));
            while(m_traceList.DeleteColumn(0));
            m_comboColumns.AddString("All");
            //Init list control
            LV_COLUMN lv;
            lv.mask = LVCF_TEXT | LVCF_WIDTH;
            if (!currentSelSetting.isNull())
            {
                int nIndex = 0;
                //Insert the first column of Line number
                lv.pszText = "Line";
                lv.cx = 50;
                m_traceList.InsertColumn(nIndex++, &lv);

                const std::vector<Poco::SharedPtr<CColumnSetting>>& columns = currentSelSetting->GetAllColumns();
                for (int i = 0; i < columns.size(); ++i)
                {
                    if (columns.at(i)->m_bEnable)
                    {
                        lv.pszText = (LPSTR)columns.at(i)->m_strRealColumnName.c_str();
                        lv.cx = 100;
                        m_traceList.InsertNewColumn(nIndex++, &lv, i);
                        m_comboColumns.AddString(columns.at(i)->m_strRealColumnName.c_str());
                    }
                }
                m_traceList.SetColumnSetting(currentSelSetting->GetAllColumns());
            }
        }
        m_comboColumns.SetCurSel(0);

        m_traceList.DeleteAllTraceLog();

        m_logger->StartParse(tstring(strFile.GetBuffer(strFile.GetLength())));
        CAnalyseProgressDlg dlg(m_logger);
        dlg.DoModal();

        //Update tree view
        CClassView* pClassView = NULL;
        GET_CLASS_VIEW(pClassView);
        if (pClassView != NULL)
        {
            HTREEITEM hFile = pClassView->InsertLogFile(strFile);
            const std::map<tstring, Poco::SharedPtr<CComponent>>& components = m_logger->GetComponents();
            std::map<tstring, Poco::SharedPtr<CComponent>>::const_iterator ite = components.begin();
            while (ite != components.end())
            {
                pClassView->InsertComponent(hFile, ite->second->GetComponentName().c_str());
                ++ite;
            }
            pClassView->SetFocus();
        }

        //Update log file information/UI Setting in property panel
        CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd();
        if (pMainFrame != NULL)
        {
            Poco::SharedPtr<SLogFileProperty> logFilePro = new SLogFileProperty;
            logFilePro->m_strFileName = m_logger->GetFileName();
            logFilePro->m_nFileSize = m_logger->GetFileSize();

            pMainFrame->SetLogFileProperty(logFilePro);
            pMainFrame->SetCurrentUISettingProperty(m_logger->GetActiveUISetting());
//.........这里部分代码省略.........
开发者ID:yanjunnf,项目名称:LogAnalyzer,代码行数:101,代码来源:LogAnalyzerView.cpp


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