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


C++ Pointer::isAllocated方法代码示例

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


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

示例1: copyData

    /**
     * @brief copyData This method copies all data from the <b>sourceArray</b> into
     * the current array starting at the target destination tuple offset value.
     *
     * For example if the DataArray has 10 tuples and the destTupleOffset = 5 then
     * then source data will be copied into the destination array starting at
     * destination tuple 5. In psuedo code it would be the following:
     * @code
     *  destArray[5] = sourceArray[0];
     *  destArray[6] = sourceArray[1];
     *  .....
     * @endcode
     * @param destTupleOffset
     * @param sourceArray
     * @return
     */
    bool copyData(size_t destTupleOffset, IDataArray::Pointer sourceArray)
    {

      if(destTupleOffset >= m_Array.size()) { return false; }
      if(!sourceArray->isAllocated()) { return false; }
      if(sourceArray->getNumberOfComponents() != getNumberOfComponents()) { return false; }

      Self* source = dynamic_cast<Self*>(sourceArray.get());
      size_t sourceNTuples = source->getNumberOfTuples();

      for(size_t i = 0; i < sourceNTuples; i++)
      {
        m_Array[destTupleOffset + i] = source->getValue(i);
      }
      return true;
    }
开发者ID:BlueQuartzSoftware,项目名称:SIMPL,代码行数:32,代码来源:StringDataArray.hpp

示例2: copyData

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
bool ModifiedLambertProjectionArray::copyData(size_t destTupleOffset, IDataArray::Pointer sourceArray)
{
  if(!m_IsAllocated) { return false; }
  if(0 == m_ModifiedLambertProjectionArray.size()) { return false; }
  if(destTupleOffset >= m_ModifiedLambertProjectionArray.size()) { return false; }
  if(!sourceArray->isAllocated()) { return false; }
  Self* source = dynamic_cast<Self*>(sourceArray.get());

  if(sourceArray->getNumberOfComponents() != getNumberOfComponents()) { return false; }

  if( sourceArray->getNumberOfTuples()*sourceArray->getNumberOfComponents() + destTupleOffset*getNumberOfComponents() > m_ModifiedLambertProjectionArray.size() ) { return false; }

  size_t sourceNTuples = source->getNumberOfTuples();

  for(size_t i = 0; i < sourceNTuples; i++)
  {
    m_ModifiedLambertProjectionArray[destTupleOffset + i] = (*source)[i];
  }

  return true;
}
开发者ID:ricortiz,项目名称:DREAM3D,代码行数:24,代码来源:ModifiedLambertProjectionArray.cpp


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