本文整理汇总了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;
}
示例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;
}