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


C++ DataSource类代码示例

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


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

示例1: serializeOutProperties

bool DataSourceXMLSerializer::serializeOutProperties( const DataSource& dataSource, QXmlStreamWriter& stream )
{
    stream.writeAttribute( "DSautoFetch", dataSource.getAutoFetch() ? "1" : "0" );
    stream.writeAttribute( "DSautoFetchDelay", dataSource.getAutoFetchDelay().toString() );
    stream.writeAttribute( "DSasynchronous", dataSource.isAsynchronous() ? "1" : "0" );
    return true;
}
开发者ID:SkySparky,项目名称:QuickProperties,代码行数:7,代码来源:qpsDataSource.cpp

示例2: system_time

void
ActivityView::_Refresh()
{
	bigtime_t lastTimeout = system_time() - RefreshInterval();
	BMessenger target(this);

	while (true) {
		status_t status = acquire_sem_etc(fRefreshSem, 1, B_ABSOLUTE_TIMEOUT,
			lastTimeout + RefreshInterval());
		if (status == B_OK || status == B_BAD_SEM_ID)
			break;
		if (status == B_INTERRUPTED)
			continue;

		SystemInfo info(fSystemInfoHandler);
		lastTimeout += RefreshInterval();

		fSourcesLock.Lock();

		for (uint32 i = fSources.CountItems(); i-- > 0;) {
			DataSource* source = fSources.ItemAt(i);
			DataHistory* values = fValues.ItemAt(i);

			int64 value = source->NextValue(info);
			values->AddValue(info.Time(), value);
		}

		fSourcesLock.Unlock();

		target.SendMessage(B_INVALIDATE);
	}
}
开发者ID:,项目名称:,代码行数:32,代码来源:

示例3: TEST

//TEST(PCL_FeaturesGPU, DISABLED_fpfh_low_level)
TEST(PCL_FeaturesGPU, fpfh_low_level)
{   
    DataSource source;

    source.estimateNormals();
    source.findRadiusNeghbors();
    cout << "max_radius_nn_size: " << source.max_nn_size << endl;
                   
    vector<int> data;
    source.getNeghborsArray(data);
    vector<PointXYZ> normals_for_gpu(source.normals->points.size());    
    std::transform(source.normals->points.begin(), source.normals->points.end(), normals_for_gpu.begin(), DataSource::Normal2PointXYZ());
    
    //uploading data to GPU
    pcl::gpu::FPFHEstimation::PointCloud cloud_gpu;
    cloud_gpu.upload(source.cloud->points);

    pcl::gpu::FPFHEstimation::Normals normals_gpu;
    normals_gpu.upload(normals_for_gpu);             
    
    pcl::gpu::NeighborIndices indices;
    indices.upload(data, source.sizes, source.max_nn_size);
    
    DeviceArray2D<FPFHSignature33> fpfh33_features;
    
    gpu::FPFHEstimation fpfh_gpu;            
    fpfh_gpu.compute(cloud_gpu, normals_gpu, indices, fpfh33_features);

    int stub;
    vector<FPFHSignature33> downloaded;
    fpfh33_features.download(downloaded, stub);

    pcl::FPFHEstimation<PointXYZ, Normal, FPFHSignature33> fe;
    fe.setInputCloud (source.cloud);
    fe.setInputNormals (source.normals);
    fe.setSearchMethod (pcl::search::KdTree<PointXYZ>::Ptr (new pcl::search::KdTree<PointXYZ>));
    //fe.setKSearch (k);
    fe.setRadiusSearch (source.radius);

    PointCloud<FPFHSignature33> fpfhs;
    fe.compute (fpfhs);

    for(size_t i = 0; i < downloaded.size(); ++i)
    {
        FPFHSignature33& gpu = downloaded[i];
        FPFHSignature33& cpu = fpfhs.points[i];
        
        size_t FSize = sizeof(FPFHSignature33)/sizeof(gpu.histogram[0]);                                
        
        float norm = 0, norm_diff = 0;
        for(size_t j = 0; j < FSize; ++j)
        {
            norm_diff += (gpu.histogram[j] - cpu.histogram[j]) * (gpu.histogram[j] - cpu.histogram[j]);
            norm += cpu.histogram[j] * cpu.histogram[j];

            //ASSERT_NEAR(gpu.histogram[j], cpu.histogram[j], 0.03f);
        }
        ASSERT_EQ(norm_diff/norm < 0.01f/FSize, true);
    }
}
开发者ID:2php,项目名称:pcl,代码行数:61,代码来源:test_fpfh.cpp

示例4: clearDataSource

void clearDataSource(DataSource& _source, bool _data, bool _tiles) {
    if (!m_tileManager) { return; }
    std::lock_guard<std::mutex> lock(m_tilesMutex);

    if (_tiles) { m_tileManager->clearTileSet(_source.id()); }
    if (_data) { _source.clearData(); }

    requestRender();
}
开发者ID:examyes,项目名称:tangram-es,代码行数:9,代码来源:tangram.cpp

示例5: write

/*
* Write the contents of a DataSource into a Pipe
*/
void Pipe::write(DataSource& source)
   {
   SecureVector<byte> buffer(DEFAULT_BUFFERSIZE);
   while(!source.end_of_data())
      {
      size_t got = source.read(&buffer[0], buffer.size());
      write(&buffer[0], got);
      }
   }
开发者ID:BenjaminSchiborr,项目名称:safe,代码行数:12,代码来源:pipe_rw.cpp

示例6: TEST

//TEST(PCL_FeaturesGPU, DISABLED_ppf)
TEST(PCL_FeaturesGPU, ppf)
{   
    DataSource source;

    source.generateIndices();
    source.estimateNormals();
                   
    vector<PointXYZ> normals_for_gpu(source.normals->points.size());    
    std::transform(source.normals->points.begin(), source.normals->points.end(), normals_for_gpu.begin(), DataSource::Normal2PointXYZ());
    
    //uploading data to GPU

    //////////////////////////////////////////////////////////////////////////////////////////////  

    pcl::gpu::PPFEstimation::PointCloud cloud_gpu;
    cloud_gpu.upload(source.cloud->points);

    pcl::gpu::PPFEstimation::Normals normals_gpu;
    normals_gpu.upload(normals_for_gpu);             

    pcl::gpu::PPFEstimation::Indices indices_gpu;
    indices_gpu.upload(*source.indices);

    DeviceArray<PPFSignature> ppf_features;
    
    gpu::PPFEstimation pph_gpu;    
    pph_gpu.setInputCloud(cloud_gpu);
    pph_gpu.setInputNormals(normals_gpu);
    pph_gpu.setIndices(indices_gpu);
    pph_gpu.compute(ppf_features);


    vector<PPFSignature> downloaded;
    ppf_features.download(downloaded);

    pcl::PPFEstimation<PointXYZ, Normal, PPFSignature> fe;
    fe.setInputCloud (source.cloud);
    fe.setInputNormals (source.normals);
    fe.setIndices(source.indices);

    PointCloud<PPFSignature> ppfs;
    fe.compute (ppfs);

    for(size_t i = 0; i < downloaded.size(); ++i)
    {
        PPFSignature& gpu = downloaded[i];
        PPFSignature& cpu = ppfs.points[i];        

        ASSERT_NEAR(gpu.f1, cpu.f1, 0.01f);
        ASSERT_NEAR(gpu.f2, cpu.f2, 0.01f);
        ASSERT_NEAR(gpu.f3, cpu.f3, 0.01f);
        ASSERT_NEAR(gpu.f4, cpu.f4, 0.01f);
        ASSERT_NEAR(gpu.alpha_m, cpu.alpha_m, 0.01f);              
    }
}
开发者ID:Bardo91,项目名称:pcl,代码行数:56,代码来源:test_ppf.cpp

示例7: disReadMemory

/*
 * Disasm memory reader callback
 */
static int disReadMemory(bfd_vma memaddr, bfd_byte *myaddr, unsigned int len,
	struct disassemble_info *info) {

	DataSource *ds = ((DisasmAppData *)info->application_data)->ds;
	if (memaddr + len <= ds->size()) {
		ds->readBytes((char *)myaddr, len, memaddr);
		return 0;
	} else {
		return -1;
	}
}
开发者ID:whatsbcn,项目名称:goback,代码行数:14,代码来源:WorkModeDisasm.cpp

示例8: pmap

void
Decoder::decodeNestedTemplate(
   DataSource & source,
   Messages::ValueMessageBuilder & messageBuilder,
   Messages::FieldIdentityCPtr & identity)
{
  Codecs::PresenceMap pmap(getTemplateRegistry()->presenceMapBits());
  if(this->verboseOut_)
  {
    pmap.setVerbose(verboseOut_);
  }

  static const std::string pmp("PMAP");
  source.beginField(pmp);
  pmap.decode(source);

  static const std::string tid("templateID");
  source.beginField(tid);
  if(pmap.checkNextField())
  {
    template_id_t id;
    FieldInstruction::decodeUnsignedInteger(source, *this, id, tid);
    setTemplateId(id);
  }
  if(verboseOut_)
  {
    (*verboseOut_) << "Nested Template ID: " << getTemplateId() << std::endl;
  }
  Codecs::TemplateCPtr templatePtr;
  if(getTemplateRegistry()->getTemplate(getTemplateId(), templatePtr))
  {
    if(templatePtr->getReset())
    {
      reset(false);
    }
    Messages::ValueMessageBuilder & groupBuilder(
      messageBuilder.startGroup(
        identity,
        templatePtr->getApplicationType(),
        templatePtr->getApplicationTypeNamespace(),
        templatePtr->fieldCount()));

    decodeSegmentBody(source, pmap, templatePtr, groupBuilder);
    messageBuilder.endGroup(identity, groupBuilder);
  }
  else
  {
    std::string error =  "Unknown template ID:";
    error += boost::lexical_cast<std::string>(getTemplateId());
    reportError("[ERR D9]", error);
  }
  return;
}
开发者ID:JianchengZh,项目名称:quickfast,代码行数:53,代码来源:Decoder.cpp

示例9: readPoint

		bool Parser::readPoint( DataSource& dataSource, Byte* point, Size pointSize )
		{
			Size readLength = min( pointSize, (Size)m_header.pointRecordLength );
			//if( m_header.pointRecordLength > pointSize )
			//	return assert(false), false; //< TODO: error reporting
			
			dataSource->read( (Byte*)point, readLength );			
			if ( readLength < m_header.pointRecordLength )
				dataSource->ignore( m_header.pointRecordLength-readLength ); //, Ignore the rest of this points data!

			return dataSource.valid();
		}
开发者ID:TheDesignHutch,项目名称:TDHLidarParser,代码行数:12,代码来源:LASDataParser.cpp

示例10: load

    bool load( const CacheId& cacheId, DataSource& dataSource )
    {
        const DataType dataType = dataSource.getVolumeInfo().dataType;
        if( dataType == DT_UNDEFINED )
            LBTHROW( std::runtime_error( "Undefined data type" ));

        const NodeId nodeId( cacheId );
        _data = dataSource.getData( nodeId );
        if( !_data )
            return false;
        return true;
    }
开发者ID:bilgili,项目名称:Livre,代码行数:12,代码来源:DataObject.cpp

示例11: recData

void TermMgrModel::recData()
{
	json::Value jsonModleData;
	QString sValue;
	DataSource dataSorce;
	dataSorce.query(e_Term_Data, sValue);
	if (sValue.size())
	{
		jsonModleData = json::Deserialize(sValue.toStdString());
	}
	if (json::ArrayVal != jsonModleData.GetType())
	{
		json::Array jArray;
		json::Object jObject;
		jObject["id"] = QUuid::createUuid().toString().mid(1, 36).toStdString();
		jObject["orgid"] = "";
		jObject["merchno"] = "440380310000001";
		jObject["termno"] = "10023496";
		jObject["termkey"] = "1234567890abcdef1234567890abcdef";
		jObject["termkeylen"] = 32;
		jObject["date"] = "2015-12-07";
		jArray.push_back(jObject);

		jObject["id"] = QUuid::createUuid().toString().mid(1, 36).toStdString();
		jObject["orgid"] = "";
		jObject["merchno"] = "440380310000002";
		jObject["termno"] = "10023497";
		jObject["termkey"] = "1234567890abcdef1234567890abcdef";
		jObject["termkeylen"] = 32;
		jObject["date"] = "2015-12-07";
		jArray.push_back(jObject);
		jsonModleData = jArray;
	}
	listData.clear();
	if (json::NULLVal != jsonModleData.GetType() && 0 < jsonModleData.size())
	{
		int i = 0;
		for ( ; i < jsonModleData.size(); i++)
		{
			listData.push_back(TERMDATA());
			if (jsonModleData[i].HasKey("id")) listData[i].sId = QString(jsonModleData[i]["id"].ToString().c_str());
			if (jsonModleData[i].HasKey("orgid")) listData[i].sOrgid = QString(jsonModleData[i]["orgid"].ToString().c_str());
			if (jsonModleData[i].HasKey("merchno")) listData[i].sMerchno = QString(jsonModleData[i]["merchno"].ToString().c_str());
			if (jsonModleData[i].HasKey("termno")) listData[i].sTermno = QString(jsonModleData[i]["termno"].ToString().c_str());
			if (jsonModleData[i].HasKey("termkey")) listData[i].sTermkey = QString(jsonModleData[i]["termkey"].ToString().c_str());
			if (jsonModleData[i].HasKey("termkeylen")) listData[i].nTermkeylen = jsonModleData[i]["termkeylen"].ToInt();
			if (jsonModleData[i].HasKey("date")) listData[i].sDate = QString(jsonModleData[i]["date"].ToString().c_str());
			
		}		
	}
	refreshModel();
}
开发者ID:vagabond1132,项目名称:Code,代码行数:52,代码来源:termmgrmodel.cpp

示例12: _

DataSource*
ActivityView::FindDataSource(const DataSource* search)
{
	BAutolock _(fSourcesLock);

	for (int32 i = fSources.CountItems(); i-- > 0;) {
		DataSource* source = fSources.ItemAt(i);
		if (!strcmp(source->Name(), search->Name()))
			return source;
	}

	return NULL;
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例13: maybe_BER

/*
* Do heuristic tests for BER data
*/
bool maybe_BER(DataSource& source)
   {
   uint8_t first_u8;
   if(!source.peek_byte(first_u8))
      {
      BOTAN_ASSERT_EQUAL(source.read_byte(first_u8), 0, "Expected EOF");
      throw Stream_IO_Error("ASN1::maybe_BER: Source was empty");
      }

   if(first_u8 == (SEQUENCE | CONSTRUCTED))
      return true;
   return false;
   }
开发者ID:Rohde-Schwarz-Cybersecurity,项目名称:botan,代码行数:16,代码来源:asn1_obj.cpp

示例14: processTileData

void TileWorker::processTileData(std::unique_ptr<TileTask> _task,
                                 const std::vector<std::unique_ptr<Style>>& _styles,
                                 const View& _view) {

    m_task = std::move(_task);
    m_free = false;
    m_finished = false;
    m_aborted = false;

    m_future = std::async(std::launch::async, [&]() {
        
        const TileID& tileID = m_task->tileID;
        DataSource* dataSource = m_task->source;
        
        auto tile = std::shared_ptr<MapTile>(new MapTile(tileID, _view.getMapProjection()));

        std::shared_ptr<TileData> tileData;

        if (m_task->parsedTileData) {
            // Data has already been parsed!
            tileData = m_task->parsedTileData;
        } else {
            // Data needs to be parsed
            tileData = dataSource->parse(*tile, m_task->rawTileData);

            // Cache parsed data with the original data source
            dataSource->setTileData(tileID, tileData);
        }
        
		tile->update(0, _view);

        //Process data for all styles
        for(const auto& style : _styles) {
            if(m_aborted) {
                m_finished = true;
                return std::move(tile);
            }
            if(tileData) {
                style->addData(*tileData, *tile, _view.getMapProjection());
            }
        }
        m_finished = true;
        
        requestRender();
        
        // Return finished tile
        return std::move(tile);

    });

}
开发者ID:hextriclosan,项目名称:tangram-es,代码行数:51,代码来源:tileWorker.cpp

示例15: serializeInProperties

bool DataSourceXMLSerializer::serializeInProperties( DataSource& dataSource, QXmlStreamReader& stream )
{
    bool error( false );
    bool dsAutoFetch = ( stream.attributes().value( "DSautoFetch" ).toInt( &error ) == 1 );
    if ( !error )
        dataSource.setAutoFetch( dsAutoFetch );
    QTime dsAutoFetchDelay = ( QTime::fromString( stream.attributes().value( "DSautoFetchDelay" ).toString( ) ) );
    if ( dsAutoFetchDelay.isValid() )
        dataSource.setAutoFetchDelay( dsAutoFetchDelay );
    bool dsAsynchronous = ( stream.attributes().value( "DSasynchronous" ).toInt( &error ) == 1 );
    if ( !error )
        dataSource.setAsynchronous( dsAsynchronous );
    return true;
}
开发者ID:SkySparky,项目名称:QuickProperties,代码行数:14,代码来源:qpsDataSource.cpp


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