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


C++ DataFile::channelIDs方法代码示例

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


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

示例1: openForReWrite

// not threadsafe
bool DataFile::openForReWrite(const DataFile & other, const QString & filename, const QVector<unsigned> & chanNumSubset)
{
	if (!other.isOpenForRead()) {
		Error() << "INTERNAL ERROR: First parameter to DataFile::openForReWrite() needs to be another DataFile that is opened for reading.";
		return false;
	}
	if (isOpen()) closeAndFinalize();
	
	QString outputFile (filename);
	if (!QFileInfo(outputFile).isAbsolute())
        outputFile = mainApp()->outputDirectory() + "/" + outputFile; 
    
    Debug() << "outdir: " << mainApp()->outputDirectory() << " outfile: " << outputFile;
    
	dataFile.close();  metaFile.close();
    dataFile.setFileName(outputFile);
    metaFile.setFileName(metaFileForFileName(outputFile));
	
    if (!dataFile.open(QIODevice::WriteOnly|QIODevice::Truncate) ||
        !metaFile.open(QIODevice::WriteOnly|QIODevice::Truncate)) {
        Error() << "Failed to open either one or both of the data and meta files for " << outputFile;
        return false;
    }
	
//    badData = other.badData;
    badData.clear();
	mode = Output;
	const int nOnChans = chanNumSubset.size();
	params = other.params;
	params["outputFile"] = outputFile;
    params.remove("badData"); // rebuild this as we write!
	scanCt = 0;
	nChans = nOnChans;
	sha.Reset();
	sRate = other.sRate;
	range = other.range;
    writeRateAvg = 0.;
    nWritesAvg = 0;
    nWritesAvgMax = /*unsigned(sRate/10.)*/10;
    if (!nWritesAvgMax) nWritesAvgMax = 1;
	// compute save channel subset fudge
	const QVector<unsigned> ocid = other.channelIDs();
	chanIds.clear();
	customRanges.clear();
	chanDisplayNames.clear();
	QString crStr(""), cdnStr("");
	foreach (unsigned i, chanNumSubset) {
		if (i < unsigned(ocid.size())) {
			chanIds.push_back(ocid[i]);
			if (i < (unsigned)other.customRanges.size()) customRanges.push_back(other.customRanges[i]);
			else customRanges.push_back(range);
			if (i < (unsigned)other.chanDisplayNames.size()) chanDisplayNames.push_back(other.chanDisplayNames[i]);
			else chanDisplayNames.push_back(QString("Ch ") + QString::number(i));
			crStr.append(QString("%3%1:%2").arg(customRanges.back().min,0,'f',9).arg(customRanges.back().max,0,'f',9).arg(crStr.length() ? "," : ""));
			if (cdnStr.length()) cdnStr.append(",");
			cdnStr.append(QString(chanDisplayNames.back()).replace(",",""));
		} else 
			Error() << "INTERNAL ERROR: The chanNumSubset passet to DataFile::openForRead must be a subset of channel numbers (indices, not IDs) to use in the rewrite.";
	}
	params["saveChannelSubset"] = ConfigureDialogController::generateAIChanString(chanIds);
	params["nChans"] = nChans;
	if (params.contains("chanDisplayNames")) params["chanDisplayNames"] = cdnStr;
	if (params.contains("customRanges")) params["customRanges"] = crStr;
	pd_chanId = other.pd_chanId;
	
	return true;
}
开发者ID:cculianu,项目名称:SpikeGL,代码行数:68,代码来源:DataFile.cpp


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