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


C++ RefPtr::flush方法代码示例

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


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

示例1:

bool
Preferences::save()
{
	try {
		Glib::RefPtr<Glib::IOChannel> outfile =
			Glib::IOChannel::create_from_file( get_rc_file(), "w");
		outfile->write(keyfile_.to_data());
		outfile->flush();
	}
	catch (const Glib::Error& error) {
		std::cerr << _("Failed to save configuration file.") << std::endl;
		std::cerr << _("An error occurred while attempting to save the file ")
			+ get_rc_file() + _(", this file stores your preferences.");
		std::cerr << std::endl;
		std::cerr << _("The system reported this error as: ") + error.what();
		std::cerr << std::endl;
		return false;
	}
	return true;
}
开发者ID:MichaelColonel,项目名称:ScanAmatiTest,代码行数:20,代码来源:preferences.cpp

示例2: writeRows

    void Gui_ResultFileWriter::writeRows(const bool detail,const ResultMap& res_map,const std::vector<int>& idxs){
        Glib::RefPtr< Gio::FileOutputStream > fout = m_out_file->append_to();


        if(detail){
            for (auto i : idxs){
                const Result& res_ref = res_map.getResultAt(i);

                const std::string& path = (res_map.getFileFromIdx(i)->get_path());
                const std::string& comment = res_map.getCommentAt(i);

                if(!res_map.getIsNAAt(i)){
                    for (unsigned int j=0; j<res_ref.size();++j){
                        std::stringstream ss;
                        const OneObjectRow& oor = res_ref.getRow(j);
                        ss <<"\""<<path<<"\", "<< oor.print()<<", \""<<comment<<"\""<<std::endl;
                        fout->write(ss.str());
                    }
                }
            }
        }
        else{
            for (auto i : idxs){
                const Result& res_ref = res_map.getResultAt(i);
                Glib::RefPtr<Gio::File> tmp_file = res_map.getFileFromIdx(i);
                const std::vector<int> roi_keys = res_ref.getROIs();
                const std::string& comment = res_map.getCommentAt(i);

                std::map < unsigned int,std::pair<unsigned int,unsigned int> > table;
                table[0].first = res_ref.getNValid();
                table[0].second =  res_ref.size() - res_ref.getNValid();
                for(unsigned int i=0; i != (unsigned int)res_ref.size(); ++i){
                    OneObjectRow object = res_ref.getRow(i);
                    int roi = object.getROI();
                    if (roi > 0){
                        if(object.getGUIValid() && object.isValid()) //otherwise colour filters etc. don't work
                            ++(table[roi].first);
                        else
                            ++(table[roi].second);
                    }
                }


                for (auto &it : table){
                    int roi = it.first;
                    if ((table.size() == 1) || (roi >= 1)){

                        std::stringstream ss;
                        ss  <<i<<","
                            <<"\""<<tmp_file->get_basename()<<"\""<<","
                            <<roi<<",";

                        if(!res_map.getIsNAAt(i)){
                            ss<<it.second.first<<","
                            <<it.second.second<<",";
                        }
                        else{
                            ss<<"NA,NA,";
                        }
                            ss<<res_ref.getROIClusterData(roi).clusterPop(1)<<","
                            <<res_ref.getROIClusterData(roi).clusterPop(2)<<","
                            <<res_ref.getROIClusterData(roi).clusterPop(3)<<","
                            <<"\""<<comment<<"\""<<","
                            <<"\""<<tmp_file->get_path()<<"\","
                            <<"\""<<res_ref.getROIClusterData(roi).str()<<"\""<<std::endl;

                        fout->write(ss.str());
                    }
                }
            }
        }
        fout->flush ();
        fout->close();

    }
开发者ID:IsaacLuo,项目名称:OpenCFU,代码行数:75,代码来源:Gui_ResultFileWriter.cpp

示例3: writeRows

void Gui_ResultFileWriter::writeRows(const bool detail,const ResultMap& res_map,const std::vector<int>& idxs){
    Glib::RefPtr< Gio::FileOutputStream > fout = m_out_file->append_to();

    if(detail){
        for (auto i : idxs){
            const Result& res_ref = res_map.getResultAt(i);

            const std::string& path = (res_map.getFileFromIdx(i)->get_path());
            const std::string& comment = res_map.getCommentAt(i);

            if(!res_map.getIsNAAt(i)){
                for (unsigned int j=0; j<res_ref.size();++j){
                    std::stringstream ss;
                    const OneObjectRow& oor = res_ref.getRow(j);
                    cv::Scalar col = oor.getBGRMean();

                    cv::Point2f center = (oor.getPoint(0) + oor.getPoint(2) ) * 0.5;
                    ss  <<"\""<<path<<"\""<<","
                        <<oor.isValid()<<","
                        <<center.x<<","
                        <<center.y<<","
                        <<oor.getROI()<<","
                        <<(int)oor.getArea()<<","
                        <<oor.getRadius()<<","
                        <<col[2]<<","
                        <<col[1]<<","
                        <<col[0]<<","
                        <<oor.getHue()<<","
                        <<oor.getSat()<<","
                        <<oor.getNInClust()<<","
                        <<"\""<<comment<<"\""<<std::endl;
                    fout->write(ss.str());
                }
            }
        }
    }
    else{
        for (auto i : idxs){
            const Result& res_ref = res_map.getResultAt(i);
            Glib::RefPtr<Gio::File> tmp_file = res_map.getFileFromIdx(i);

            const std::string& comment = res_map.getCommentAt(i);

            std::stringstream ss;
            ss  <<i<<","
                <<"\""<<tmp_file->get_basename()<<"\""<<",";
            if(!res_map.getIsNAAt(i)){
                ss<<res_ref.getNValid()<<","
                <<res_ref.size() - res_ref.getNValid()<<",";
            }
            else{
                ss<<"NA,NA,";
            }
                ss<<comment<<","
                <<"\""<<tmp_file->get_path()<<"\""<<std::endl;

            fout->write(ss.str());
        }
    }
    fout->flush ();
    fout->close();

}
开发者ID:Kionage,项目名称:OpenCFU,代码行数:63,代码来源:Gui_ResultFileWriter.cpp


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