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


C++ DataProvider::receiveInputData方法代码示例

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


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

示例1: execute

 void Send::execute(DataProvider& provider)
 {
     Id2DataPair inputMapper(INPUT);
     provider.receiveInputData(inputMapper);
     
     m_server->send(inputMapper.data());
 }
开发者ID:roteroktober,项目名称:stromx,代码行数:7,代码来源:Send.cpp

示例2: execute

 void CameraBuffer::execute(DataProvider& provider)
 {
     // get the input data
     Id2DataPair inputMapper(INPUT);
     provider.receiveInputData(inputMapper);
     
     // try to get a free buffer
     Data* buffer = 0;
     try
     {
         buffer = m_buffers(0);
     }
     catch(Timeout&)
     {
     }
     
     if(buffer)
     {
         // there was a free buffer
         DataContainer bufferContainer(buffer);
         
         // remember it in the recycling access
         m_buffers.add(bufferContainer);
         
         Id2DataPair outputMapper(OUTPUT, inputMapper.data());
         Id2DataPair bufferMapper(BUFFER, bufferContainer);
         Id2DataPair idMapper(INDEX, DataContainer(new UInt32(m_id)));
         
         // send it to the output (together with the input image and the current index)
         provider.sendOutputData(outputMapper && bufferMapper && idMapper);
     }
     
     // increase the index
     ++m_id;
 }
开发者ID:uboot,项目名称:stromx,代码行数:35,代码来源:CameraBuffer.cpp

示例3: execute

 void Merge::execute(DataProvider& provider)
 {
     if (m_list == 0)
     {
         Id2DataPair dataMapper(INPUT_NUM_ITEMS);
         provider.receiveInputData(dataMapper);
         ReadAccess access(dataMapper.data());
         
         try
         {
             m_numItems = toInt(access.get());
         }
         catch (BadCast&)
         {
             throw InputError(INPUT_NUM_ITEMS, *this, "Number of items must be an integer.");
         }
         
         m_list = new List();
     }
     
     if (m_list->content().size() < m_numItems)
     {
         RecycleAccess recycler;
         {
             Id2DataPair dataMapper(INPUT_DATA);
             provider.receiveInputData(dataMapper);
             recycler.add(dataMapper.data());
         }
         
         Data* data = recycler.get();
         m_list->content().push_back(data);
     }
     
     if (m_list->content().size() == m_numItems)
     {
         DataContainer out(m_list);
         m_list = 0;
         m_numItems = 0;
         Id2DataPair dataMapper(OUTPUT, out);
         
         provider.sendOutputData(dataMapper);
     }
 }
开发者ID:roteroktober,项目名称:stromx,代码行数:43,代码来源:Merge.cpp

示例4: execute

 void ExceptionOperator::execute(DataProvider& provider)
 {
     Id2DataPair input(INPUT);
     
     provider.receiveInputData(input);
     
     provider.sleep(100);
     
     if(m_throwExecute)
         throw OperatorError(*this, "Failed to execute operator.");
 }
开发者ID:joccccc,项目名称:stromx,代码行数:11,代码来源:ExceptionOperator.cpp

示例5: execute

 void ParameterOperator::execute(DataProvider& provider)
 {
     Id2DataPair input1(INPUT_1);
     Id2DataPair input2(INPUT_2);
     
     provider.receiveInputData(input1 && input2);
     
     // execute...
     
     Id2DataPair output1(OUTPUT_1, input1.data());
     Id2DataPair output2(OUTPUT_2, input2.data());
     provider.sendOutputData(output1 && output2);
 }
开发者ID:uboot,项目名称:stromx,代码行数:13,代码来源:ParameterOperator.cpp

示例6: execute

 void WriteGpio::execute(DataProvider& provider)
 {
     runtime::Id2DataPair input(INPUT);
     provider.receiveInputData(input);
     
     runtime::ReadAccess access(input.data());
     int value = access.get<runtime::Bool>();
     
     if (impl::GPIOWrite(static_cast<int>(m_gpio), value))
     {
         throw OperatorError(*this, 
             (boost::format("Failed to write to GPIO %1%.") % m_gpio).str());
     }
 }
开发者ID:joccccc,项目名称:stromx,代码行数:14,代码来源:WriteGpio.cpp

示例7: execute

 void TestOperator::execute(DataProvider& provider)
 {
     if(m_throwException)
     {
         throw InternalError("Funny exception.");
     }
         
     Id2DataPair input1(INPUT_1);
     Id2DataPair input2(INPUT_2);
     
     provider.receiveInputData(input1 && input2);
     
      // execute...
     m_numExecutes++;
     boost::this_thread::sleep_for(boost::chrono::milliseconds(m_sleepTime));
     
     Id2DataPair output1(OUTPUT_1, input1.data());
     Id2DataPair output2(OUTPUT_2, input2.data());
     provider.sendOutputData(output1 && output2);
 }
开发者ID:roteroktober,项目名称:stromx,代码行数:20,代码来源:TestOperator.cpp

示例8: execute

 void Split::execute(DataProvider& provider)
 {
     if (m_storedItems.size() == 0)
     {
         RecycleAccess recycle;
         {
             Id2DataPair input(INPUT);
             provider.receiveInputData(input);
             recycle.add(input.data());
         }
         Data* data = recycle.get();
         List* list = data_cast<List>(data);
         
         if (list == 0)
             throw InputError(INPUT, *this, "Input data must be a 'List' object.");
         
         for (std::vector<Data*>::iterator iter = list->content().begin();
              iter != list->content().end(); ++iter)
         {
             m_storedItems.push_back(DataContainer(*iter));
         }
         
         uint64_t size = list->content().size();
         list->content().clear();
         delete list;
         
         DataContainer outNumItems(new UInt64(size));
         Id2DataPair dataMapper(OUTPUT_NUM_ITEMS, outNumItems);
         
         provider.sendOutputData(dataMapper);
     }
     
     if (m_storedItems.size() != 0)
     {
         DataContainer outData = m_storedItems.front();
         Id2DataPair dataMapper(OUTPUT_DATA, outData);
         m_storedItems.pop_front();
         
         provider.sendOutputData(dataMapper);
     }
 }
开发者ID:roteroktober,项目名称:stromx,代码行数:41,代码来源:Split.cpp

示例9: execute

 void Flicker::execute(DataProvider& provider)
 {
     Id2DataPair inputDataMapper(INPUT);
     provider.receiveInputData(inputDataMapper);
     
     DataContainer container = inputDataMapper.data();
     WriteAccess access(container);
     runtime::Image& image = access.get<runtime::Image>();
     
     switch(image.depth())
     {
     case 1:
         applyFlicker<uint8_t>(m_amount, image);
         break;
     case 2:
         applyFlicker<uint16_t>(m_amount, image);
         break;
     default:
         throw WrongInputType(INPUT, *this);
     }
     
     Id2DataPair outputDataMapper(OUTPUT, container);
     provider.sendOutputData( outputDataMapper);
 }
开发者ID:roteroktober,项目名称:stromx,代码行数:24,代码来源:Flicker.cpp

示例10: execute

 void ConvertPixelType::execute(DataProvider& provider)
 {
     if (m_dataFlow == MANUAL)
     {
         Id2DataPair srcMapper(SOURCE);
         Id2DataPair destMapper(DESTINATION);
         provider.receiveInputData(srcMapper && destMapper);
         
         if(srcMapper.data() == destMapper.data())
             throw InputError(DESTINATION, *this, "Destination image must not be the same image as the source image."); 
         
         ReadAccess src(srcMapper.data());
         WriteAccess dest(destMapper.data());
         
         const runtime::Image& srcImage = src.get<runtime::Image>();
         runtime::Image& destImage = dest.get<runtime::Image>();
         
         runtime::Image::PixelType pixelType = runtime::Image::PixelType((unsigned int)(m_pixelType));
         
         unsigned int destImageSize = srcImage.width() * srcImage.height() * getDestPixelSize(pixelType);
         unsigned int destImageStride = srcImage.width() * getDestPixelSize(pixelType);
         
         if(destImage.bufferSize() < destImageSize)
             throw InputError(DESTINATION, *this, "Destination image is too small.");
         
         destImage.initializeImage(srcImage.width(), srcImage.height(), destImageStride, destImage.buffer(), pixelType);
         
         if((srcImage.pixelType() == runtime::Image::RGB_24 || srcImage.pixelType() == runtime::Image::BGR_24)
         && (pixelType == runtime::Image::BAYERBG_8 || pixelType == runtime::Image::BAYERGB_8))
         {
             // this case is not handled by OpenCV
             rgbToBayer(srcImage, destImage);
         }
         else
         {
             // use OpenCV for conversion
             openCvConversion(srcImage, destImage);
         }
         
         Id2DataPair outputMapper(OUTPUT, destMapper.data());
         provider.sendOutputData( outputMapper);
     }
     else // allocate destination data on the fly
     {
         Id2DataPair srcMapper(SOURCE);
         provider.receiveInputData(srcMapper);
         
         ReadAccess src(srcMapper.data());
         
         const runtime::Image& srcImage = src.get<runtime::Image>();
         
         runtime::Image::PixelType pixelType = runtime::Image::PixelType((unsigned int)(m_pixelType));
         
         runtime::Image* destImage = new cvsupport::Image(srcImage.width(), srcImage.height(), pixelType);
         DataContainer destContainer(destImage);
         
         if((srcImage.pixelType() == runtime::Image::RGB_24 || srcImage.pixelType() == runtime::Image::BGR_24)
         && (pixelType == runtime::Image::BAYERBG_8 || pixelType == runtime::Image::BAYERGB_8))
         {
             // this case is not handled by OpenCV
             rgbToBayer(srcImage, *destImage);
         }
         else
         {
             // use OpenCV for conversion
             openCvConversion(srcImage, *destImage);
         }
         
         Id2DataPair outputMapper(OUTPUT, destContainer);
         provider.sendOutputData( outputMapper);
     }
 }
开发者ID:sparsebase,项目名称:stromx,代码行数:72,代码来源:ConvertPixelType.cpp


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