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


C++ DataAccessor::getRow方法代码示例

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


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

示例1: preprocess

bool BackgroundSuppressionShell::preprocess()
{
   if(mpRaster == NULL)
   {
      return false;
   }
   RasterDataDescriptor *pDesc = static_cast<RasterDataDescriptor*>(mpRaster->getDataDescriptor());
   if(mpTemporaryBuffer.get() == NULL)
   {
      mpTemporaryBuffer.reset(new char[pDesc->getRowCount() * pDesc->getColumnCount() * pDesc->getBytesPerElement()]);
      if(mpTemporaryBuffer.get() == NULL)
      {
         return false;
      }
   }
   DataAccessor frameAccessor = getCurrentFrameAccessor();
   size_t rowSize = pDesc->getColumnCount() * pDesc->getBytesPerElement();
   for(unsigned int row = 0; row < pDesc->getRowCount(); row++)
   {
      if(!frameAccessor.isValid())
      {
         return false;
      }
      memcpy(mpTemporaryBuffer.get() + row * rowSize, frameAccessor->getRow(), rowSize);
      frameAccessor->nextColumn();
   }
   return true;
}
开发者ID:Siddharthk,项目名称:coan,代码行数:28,代码来源:BackgroundSuppressionShell.cpp

示例2: getPage

RasterPage* ConvertToBsqPager::getPage(DataRequest* pOriginalRequest, DimensionDescriptor startRow,
   DimensionDescriptor startColumn, DimensionDescriptor startBand)
{
   VERIFYRV(pOriginalRequest != NULL, NULL);
   if (pOriginalRequest->getWritable())
   {
      return NULL;
   }

   InterleaveFormatType requestedType = pOriginalRequest->getInterleaveFormat();
   DimensionDescriptor stopRow = pOriginalRequest->getStopRow();
   DimensionDescriptor stopColumn = pOriginalRequest->getStopColumn();
   DimensionDescriptor stopBand = pOriginalRequest->getStopBand();

   unsigned int concurrentRows = std::min(pOriginalRequest->getConcurrentRows(),
      stopRow.getActiveNumber() - startRow.getActiveNumber() + 1);
   unsigned int concurrentBands = pOriginalRequest->getConcurrentBands();

   VERIFY(requestedType == BSQ);
   VERIFY(startBand == stopBand && concurrentBands == 1);

   VERIFY(mpRaster != NULL);
   const RasterDataDescriptor* pDd = dynamic_cast<const RasterDataDescriptor*>(mpRaster->getDataDescriptor());
   VERIFY(pDd != NULL);
   InterleaveFormatType interleave = pDd->getInterleaveFormat();

   VERIFY(interleave == BIL || interleave == BIP);

   unsigned int numRows = pDd->getRowCount();
   unsigned int numCols = pDd->getColumnCount();
   unsigned int numBands = pDd->getBandCount();

   if (startRow.getActiveNumber() >= numRows || stopRow.getActiveNumber() >= numRows ||
      startColumn.getActiveNumber() >= numCols || stopColumn.getActiveNumber() >= numCols ||
      startBand.getActiveNumber() >= numBands || stopBand.getActiveNumber() >= numBands)
   {
      return NULL;
   }

   unsigned int cols = stopColumn.getActiveNumber() - startColumn.getActiveNumber() + 1;
   std::auto_ptr<ConvertToBsqPage> pPage(new ConvertToBsqPage(concurrentRows, cols, mBytesPerElement));
   unsigned char* pDst = reinterpret_cast<unsigned char*>(pPage->getRawData());
   if (pDst == NULL)
   {
      return NULL;
   }

   FactoryResource<DataRequest> pRequest;
   pRequest->setRows(startRow, stopRow);
   pRequest->setColumns(startColumn, stopColumn, cols);
   pRequest->setBands(startBand, startBand, 1);
   DataAccessor da = mpRaster->getDataAccessor(pRequest.release());

   if (interleave == BIP)
   {
      for (unsigned int row = 0; row < concurrentRows; ++row)
      {
         for (unsigned int col = 0; col < cols; ++col)
         {
            if (da.isValid() == false)
            {
               return NULL;
            }

            memcpy(pDst, da->getColumn(), mBytesPerElement);
            pDst += mBytesPerElement;
            da->nextColumn();
         }

         da->nextRow();
      }
   }
   else if (interleave == BIL)
   {
      for (unsigned int row = 0; row < concurrentRows; ++row)
      {
         if (da.isValid() == false)
         {
            return NULL;
         }

         memcpy(pDst, da->getRow(), mBytesPerElement * cols);
         pDst += mBytesPerElement * cols;
         da->nextRow();
      }
   }

   return pPage.release();
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:89,代码来源:ConvertToBsqPager.cpp


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