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


C++ DataStorage类代码示例

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


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

示例1: initialiseBank

void ItemBank::initialiseBank() {
	DataStorage* dataStorage = dataStorage->getInstance();

	strToBank(dataStorage->readFromLocalMemory());

	return;
}
开发者ID:cs2103aug2014-t14-3c,项目名称:main,代码行数:7,代码来源:ItemBank.cpp

示例2: computeC2R

void FftClFft::
        computeC2R( Tfr::ChunkData::Ptr input, DataStorage<float>::Ptr output )
{
    unsigned denseWidth = input->size().width;
    unsigned redundantWidth = output->size().width;

    EXCEPTION_ASSERT( denseWidth == redundantWidth/2+1 );

    Tfr::ChunkData::Ptr redundantInput( new Tfr::ChunkData( redundantWidth, input->size().height ));

    {
        Tfr::ChunkElement* in = CpuMemoryStorage::ReadOnly<1>( input ).ptr();
        Tfr::ChunkElement* out = CpuMemoryStorage::WriteAll<1>( redundantInput ).ptr();
        unsigned x;
        for (x=0; x<denseWidth; ++x)
            out[x] = in[x];
        for (; x<redundantWidth; ++x)
            out[x] = conj(in[redundantWidth - x]);
    }

    Tfr::ChunkData::Ptr complexoutput( new Tfr::ChunkData( output->size()));

    computeWithClFft(redundantInput, complexoutput, FftDirection_Inverse);

    ::stftDiscardImag( complexoutput, output );
}
开发者ID:aveminus,项目名称:freq,代码行数:26,代码来源:fftclfft.cpp

示例3: computeR2C

void FftClFft::
        computeR2C( DataStorage<float>::Ptr input, Tfr::ChunkData::Ptr output )
{
    unsigned denseWidth = output->size().width;
    unsigned redundantWidth = input->size().width;

   EXCEPTION_ASSERT( denseWidth == redundantWidth/2+1 );

    // interleave input to complex data
   Tfr::ChunkData::Ptr complexinput( new Tfr::ChunkData( input->size()));
   ::stftToComplex( input, complexinput );

    // make room for full output
    Tfr::ChunkData::Ptr redundantOutput( new Tfr::ChunkData( redundantWidth ));

    // compute
    computeWithClFft(complexinput, redundantOutput, FftDirection_Forward);

    // discard redundant output
    {
        Tfr::ChunkElement* in = CpuMemoryStorage::ReadOnly<1>( redundantOutput ).ptr();
        Tfr::ChunkElement* out = CpuMemoryStorage::WriteAll<1>( output ).ptr();
        unsigned x;
        for (x=0; x<denseWidth; ++x)
            out[x] = in[x];
    }
}
开发者ID:aveminus,项目名称:freq,代码行数:27,代码来源:fftclfft.cpp

示例4: compute

void FftClFft::
        compute(DataStorage<float>::Ptr input, Tfr::ChunkData::Ptr output, DataStorageSize n )
{
    unsigned denseWidth = n.width/2+1;

    EXCEPTION_ASSERT( output->numberOfElements()/denseWidth == n.height );
    EXCEPTION_ASSERT( input->numberOfElements()/n.width == n.height );

    // interleave input to complex data
    Tfr::ChunkData::Ptr complexinput( new Tfr::ChunkData( input->size()));
    ::stftToComplex( input, complexinput );

    // make room for full output
    Tfr::ChunkData::Ptr redundantOutput( new Tfr::ChunkData( n.width*n.height ));

    // compute
    computeWithClFft(complexinput, redundantOutput, n, FftDirection_Forward);

    // discard redundant output
    Tfr::ChunkElement* in = CpuMemoryStorage::ReadOnly<1>( redundantOutput ).ptr();
    Tfr::ChunkElement* out = CpuMemoryStorage::WriteAll<1>( output ).ptr();
#pragma omp parallel for
    for (int i=0; i < (int)n.height; ++i)
    {
        unsigned x;
        for (x=0; x<denseWidth; ++x)
            out[i*denseWidth + x] = in[i*n.width + x];
    }
}
开发者ID:aveminus,项目名称:freq,代码行数:29,代码来源:fftclfft.cpp

示例5: printDataStorage

std::string DataStorageString::
        printDataStorage(DataStorage<float>::ptr data)
{
    EXCEPTION_ASSERT(data);

    std::stringstream ss;
    DataStorageSize sz = data->size ();
    ss << sz;
    float *p = sz.width ? data->getCpuMemory () : 0;

    if (sz.depth>1) {
        for (int z=0; z<sz.depth; ++z) {
            for (int y=0; y<sz.height; ++y) {
                ss << std::endl << "[z:" << z << ", y:" << y << "] = { ";

                float *q = p + y*sz.width + z*sz.height*sz.width;

                if (sz.width)
                    ss << q[0];

                for (int x=1; x<sz.width; ++x)
                    ss << ", " << q[x];

                ss << " }";
            }
        }
    } else if (sz.height>1) {
        for (int y=0; y<sz.height; ++y) {
            ss << std::endl << "[y:" << y << "] = { ";

            float *q = p + y*sz.width;

            if (sz.width)
                ss << q[0];

            for (int x=1; x<sz.width; ++x)
                ss << ", " << q[x];

            ss << " }";
        }
    } else {
        ss << " = { ";

        if (sz.width)
            ss << p[0];

        for (int x=1; x<sz.width; ++x)
            ss << ", " << p[x];

        ss << " }";
    }

    return ss.str ();
}
开发者ID:aveminus,项目名称:freq,代码行数:54,代码来源:datastoragestring.cpp

示例6:

void mitk::PickingTool::Activated()
{
  DataStorage* dataStorage = this->GetDataStorage();
  m_WorkingData = this->GetWorkingData();

  //add to datastorage and enable interaction
  if (!dataStorage->Exists(m_PointSetNode))
    dataStorage->Add(m_PointSetNode, m_WorkingData);

  // now add result to data tree
  dataStorage->Add(m_ResultNode, m_WorkingData);
}
开发者ID:DiagnosisMultisystems,项目名称:MITK,代码行数:12,代码来源:mitkPickingTool.cpp

示例7: updateItem

void ItemBank::update() {
	vector<string>items;

	for (vector<Item*>::iterator iter = bank.begin(); iter != bank.end(); iter++) {
		items = updateItem(items, *iter);
	}
	
	DataStorage* dataStorage = dataStorage->getInstance();
	dataStorage->writeToFile(items);

	return;
}
开发者ID:cs2103aug2014-t14-3c,项目名称:main,代码行数:12,代码来源:ItemBank.cpp

示例8: TEST

TEST(typed_condition_test, bool_testing)
{
	DataStorage tmp;
	string k1 = "x";
	string k2 = "y";
	tmp.set_value(k1, false);
	tmp.set_value(k2, true);
	TypedCondition<bool> cond(&tmp,k1, true, Operation::EQUAL);
	ASSERT_EQ(cond.evaluate(), false);
	
	tmp.set_value(k1, true);
	TypedCondition<bool> cond2(&tmp,k1, true, Operation::EQUAL);
	ASSERT_EQ(cond2.evaluate(), true);
}
开发者ID:giordi91,项目名称:FSM,代码行数:14,代码来源:conditionUnitTest.cpp

示例9: printDataStorageStats

std::string DataStorageString::
        printDataStorageStats(DataStorage<float>::ptr data)
{
    std::stringstream ss;
    Statistics<float> s(data, false, true);
    ss << "size = " << data->size () << ", min = " << *s.getMin () << ", max = " << *s.getMax ()
       << ", mean = " << s.getMean () << ", std = " << s.getStd ();

    return ss.str();
}
开发者ID:aveminus,项目名称:freq,代码行数:10,代码来源:datastoragestring.cpp

示例10: process

void EIDTag_Processor::process( const XMLCh* const  chars
					, const unsigned int  length 
					, DataStorage&		  dataStorage
					)
{
	displayName();

	//-------------------------------------
	// if the current path matches what we have to save, copy over the data
	// to the data storage
	//-------------------------------------
	if (dataStorage.matchTagPath())
	{
		char*		pChars	= XMLString::transcode(chars);
		CByteArray* pData	= new CByteArray(pChars);
		XMLString::release(&pChars);
		dataStorage.store(dataStorage.getTagPath(), pData);
	}
}
开发者ID:12019,项目名称:svn.gov.pt,代码行数:19,代码来源:XMLParser.cpp

示例11: RemoveFromDataStorage

void mitk::LiveWireTool2D::RemoveHelperObjects()
{
  DataStorage *dataStorage = m_ToolManager->GetDataStorage();

  if (!m_EditingContours.empty())
    std::for_each(m_EditingContours.begin(), m_EditingContours.end(), RemoveFromDataStorage(dataStorage));

  if (!m_WorkingContours.empty())
    std::for_each(m_WorkingContours.begin(), m_WorkingContours.end(), RemoveFromDataStorage(dataStorage));

  if (m_EditingContourNode.IsNotNull())
    dataStorage->Remove(m_EditingContourNode);

  if (m_LiveWireContourNode.IsNotNull())
    dataStorage->Remove(m_LiveWireContourNode);

  if (m_ContourModelNode.IsNotNull())
    dataStorage->Remove(m_ContourModelNode);

  mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
开发者ID:pollen-metrology,项目名称:MITK,代码行数:21,代码来源:mitkLiveWireTool2D.cpp

示例12: inverse

void FftClFft::
        inverse(Tfr::ChunkData::Ptr input, DataStorage<float>::Ptr output, DataStorageSize n )
{
    unsigned denseWidth = n.width/2+1;
    unsigned redundantWidth = n.width;
    unsigned batchcount1 = output->numberOfElements()/redundantWidth,
             batchcount2 = input->numberOfElements()/denseWidth;

    EXCEPTION_ASSERT( batchcount1 == batchcount2 );
    EXCEPTION_ASSERT( (denseWidth-1)*2 == redundantWidth );
    EXCEPTION_ASSERT( redundantWidth*n.height == output->numberOfElements() );

    Tfr::ChunkData::Ptr redundantInput( new Tfr::ChunkData( n.height*redundantWidth ));

    {
        Tfr::ChunkElement* in = CpuMemoryStorage::ReadOnly<1>( input ).ptr();
        Tfr::ChunkElement* out = CpuMemoryStorage::WriteAll<1>( redundantInput ).ptr();
#pragma omp parallel for
        for (int i=0; i < (int)n.height; ++i)
        {
            unsigned x;
            for (x=0; x<denseWidth; ++x)
                out[i*redundantWidth + x] = in[i*denseWidth + x];
            for (; x<redundantWidth; ++x)
                out[i*redundantWidth + x] = conj(in[i*denseWidth + redundantWidth - x]);
        }
    }

    Tfr::ChunkData::Ptr complexoutput( new Tfr::ChunkData( output->size()));

    computeWithClFft(redundantInput, complexoutput, DataStorageSize( redundantWidth, n.height), FftDirection_Inverse);

    ::stftDiscardImag( complexoutput, output );

    TIME_STFT ComputationSynchronize();
}
开发者ID:aveminus,项目名称:freq,代码行数:36,代码来源:fftclfft.cpp

示例13:

DataStorage::SetOfObjects::Pointer AbstractFileReader::Read(DataStorage& ds)
{
  DataStorage::SetOfObjects::Pointer result = DataStorage::SetOfObjects::New();
  std::vector<BaseData::Pointer> data = this->Read();
  for (std::vector<BaseData::Pointer>::iterator iter = data.begin();
       iter != data.end(); ++iter)
  {
    mitk::DataNode::Pointer node = mitk::DataNode::New();
    node->SetData(*iter);
    this->SetDefaultDataNodeProperties(node, this->GetInputLocation());
    ds.Add(node);
    result->InsertElement(result->Size(), node);
  }
  return result;
}
开发者ID:riecker,项目名称:MITK,代码行数:15,代码来源:mitkAbstractFileReader.cpp

示例14: if

void mitk::PickingTool::OnPointAdded()
{
  if (m_WorkingData != this->GetWorkingData())
  {
    DataStorage *dataStorage = this->GetDataStorage();

    if (dataStorage->Exists(m_PointSetNode))
    {
      dataStorage->Remove(m_PointSetNode);
      dataStorage->Add(m_PointSetNode, this->GetWorkingData());
    }

    if (dataStorage->Exists(m_ResultNode))
    {
      dataStorage->Remove(m_ResultNode);
      dataStorage->Add(m_ResultNode, this->GetWorkingData());
    }

    m_WorkingData = this->GetWorkingData();
  }

  // Perform region growing/picking

  int timeStep =
    mitk::BaseRenderer::GetInstance(mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget1"))->GetTimeStep();

  mitk::PointSet::PointType seedPoint = m_PointSet->GetPointSet(timeStep)->GetPoints()->Begin().Value();

  // as we want to pick a region from our segmentation image use the working data from ToolManager
  mitk::Image::Pointer orgImage = dynamic_cast<mitk::Image *>(m_ToolManager->GetWorkingData(0)->GetData());

  if (orgImage.IsNotNull())
  {
    if (orgImage->GetDimension() == 4)
    { // there may be 4D segmentation data even though we currently don't support that
      mitk::ImageTimeSelector::Pointer timeSelector = mitk::ImageTimeSelector::New();
      timeSelector->SetInput(orgImage);
      timeSelector->SetTimeNr(timeStep);
      timeSelector->UpdateLargestPossibleRegion();
      mitk::Image *timedImage = timeSelector->GetOutput();

      AccessByItk_2(timedImage, StartRegionGrowing, timedImage->GetGeometry(), seedPoint);
    }
    else if (orgImage->GetDimension() == 3)
    {
      AccessByItk_2(orgImage, StartRegionGrowing, orgImage->GetGeometry(), seedPoint);
    }
    this->m_PointSet->Clear();
  }
}
开发者ID:pollen-metrology,项目名称:MITK,代码行数:50,代码来源:mitkPickingTool.cpp

示例15: saveClicked

void  MainWindow::saveClicked()
{
    DataStorage storage;
    QString filename = QFileDialog::getSaveFileName(this,
                                                    tr("Save File..."),
                                                    QString(), tr("Plot files (*.plot);;All Files (*)"));

    if(!filename.isEmpty()) {
        storage.setFunctionIndex(_plotControlWidget->getSelectedFunctionIndex());
        storage.setFunctionParams(_plotControlWidget->getFunctionParameters());
        storage.setValueFrom(_plotControlWidget->getValueFrom());
        storage.setValueTo(_plotControlWidget->getValueTo());
        storage.setStep(_plotControlWidget->getValueStep());

        storage.setPoints(_points->getPoints());

        if(!storage.save(filename)) {
            QMessageBox::warning(this, "Warning!", "Could not save file with results!");
        }\
    }
}
开发者ID:elgris,项目名称:TestTask,代码行数:21,代码来源:mainwindow.cpp


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