本文整理汇总了C++中CLR_RT_HeapBlock_Array::ClearElements方法的典型用法代码示例。如果您正苦于以下问题:C++ CLR_RT_HeapBlock_Array::ClearElements方法的具体用法?C++ CLR_RT_HeapBlock_Array::ClearElements怎么用?C++ CLR_RT_HeapBlock_Array::ClearElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLR_RT_HeapBlock_Array
的用法示例。
在下文中一共展示了CLR_RT_HeapBlock_Array::ClearElements方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Clear
HRESULT CLR_RT_HeapBlock_Queue::Clear()
{
NATIVE_PROFILE_CLR_CORE();
TINYCLR_HEADER();
CLR_RT_HeapBlock_Array* array = GetArray();
CLR_INT32 size = GetSize();
CLR_INT32 head = Head();
CLR_INT32 tail = GetTail();
if(size > 0)
{
if(head < tail)
{
TINYCLR_CHECK_HRESULT(array->ClearElements( head, size ));
}
else
{
TINYCLR_CHECK_HRESULT(array->ClearElements( head, array->m_numOfElements - head ));
TINYCLR_CHECK_HRESULT(array->ClearElements( 0 , tail ));
}
SetSize( 0 );
}
SetHead( 0 );
SetTail( 0 );
TINYCLR_NOCLEANUP();
}
示例2: CreateInstance
HRESULT CLR_RT_HeapBlock_Array::CreateInstance( CLR_RT_HeapBlock& reference, CLR_UINT32 length, const CLR_RT_ReflectionDef_Index& reflex )
{
NATIVE_PROFILE_CLR_CORE();
TINYCLR_HEADER();
CLR_RT_HeapBlock_Array* pArray;
CLR_RT_TypeDef_Index cls;
CLR_RT_TypeDef_Instance inst;
reference.SetObjectReference( NULL );
if((CLR_INT32)length < 0) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE);
if(reflex.m_kind != REFLECTION_TYPE)
{
TINYCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
}
if(reflex.m_levels == 1)
{
cls = reflex.m_data.m_type;
}
else
{
cls = g_CLR_RT_WellKnownTypes.m_Array;
}
if(inst.InitializeFromIndex( cls ) == false)
{
TINYCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
}
else
{
CLR_DataType dt = (CLR_DataType)inst.m_target->dataType;
const CLR_RT_DataTypeLookup& dtl = c_CLR_RT_DataTypeLookup[ dt ];
if(dtl.m_sizeInBytes == CLR_RT_DataTypeLookup::c_NA)
{
TINYCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
}
pArray = (CLR_RT_HeapBlock_Array*)g_CLR_RT_ExecutionEngine.ExtractHeapBlocksForArray( inst, length, reflex ); CHECK_ALLOCATION(pArray);
reference.SetObjectReference( pArray );
TINYCLR_SET_AND_LEAVE(pArray->ClearElements( 0, length ));
}
TINYCLR_NOCLEANUP();
}