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


C++ CLR_RT_HeapBlock::Dereference方法代码示例

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


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

示例1: memcpy

HRESULT Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_Decryptor::TransformFinalBlockInternal___SZARRAY_U1__SZARRAY_U1__I4__I4( CLR_RT_StackFrame& stack )
{
    TINYCLR_HEADER();

    CLR_RT_HeapBlock*       pThis     = stack.This();
    CLR_RT_HeapBlock_Array* pData     = stack.Arg1().DereferenceArray(); 
    CLR_INT32               offset    = stack.Arg2().NumericByRef().s4;
    CLR_INT32               len       = stack.Arg3().NumericByRef().s4;
    CLR_RT_HeapBlock*       pSession  = pThis[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_SessionContainer::FIELD__m_session].Dereference();
    CLR_UINT32              decrSize  = 0;
    CK_SESSION_HANDLE       hSession;
    CLR_RT_HeapBlock        hbRef;
    CLR_RT_HeapBlock*       pRet;
    CLR_UINT32              maxOut;

    FAULT_ON_NULL_ARG(pData);
    FAULT_ON_NULL_ARG(pSession);

    if((offset + len) > (CLR_INT32)pData->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE);

    hSession  = (CK_SESSION_HANDLE)pSession[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_Session::FIELD__m_handle].NumericByRef().s4;

    if(hSession == CK_SESSION_HANDLE_INVALID) TINYCLR_SET_AND_LEAVE(CLR_E_OBJECT_DISPOSED);

    CRYPTOKI_CHECK_RESULT(stack, C_Decrypt(hSession, pData->GetElement(offset), len, NULL, (CK_ULONG_PTR)&decrSize));

    maxOut = decrSize;

    TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance(hbRef, decrSize, g_CLR_RT_WellKnownTypes.m_UInt8));

    CRYPTOKI_CHECK_RESULT(stack, C_Decrypt(hSession, pData->GetElement(offset), len, hbRef.DereferenceArray()->GetFirstElement(), (CK_ULONG_PTR)&decrSize));

    if(decrSize < maxOut)
    {
        CLR_RT_HeapBlock refSmall;
        
        TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance(refSmall, decrSize, g_CLR_RT_WellKnownTypes.m_UInt8));

        memcpy(refSmall.DereferenceArray()->GetFirstElement(), hbRef.DereferenceArray()->GetFirstElement(), decrSize);

        pRet = refSmall.Dereference();
    }
    else
    {
        pRet = hbRef.Dereference();
    }

    stack.SetResult_Object(pRet);

    TINYCLR_NOCLEANUP();
}
开发者ID:AustinWise,项目名称:Netduino-Micro-Framework,代码行数:51,代码来源:security_pkcs11_native_Microsoft_SPOT_Cryptoki_Decryptor.cpp

示例2: GetType___SystemType__STRING

HRESULT Library_corlib_native_System_Reflection_Assembly::GetType___SystemType__STRING( CLR_RT_StackFrame& stack )
{
    NATIVE_PROFILE_CLR_CORE();
    TINYCLR_HEADER();
    
    CLR_RT_Assembly_Instance assm;
    CLR_RT_TypeDef_Index     td;
    CLR_RT_HeapBlock*        hbRef;
    CLR_RT_HeapBlock*        hbObj;
    LPCSTR                   szClass = stack.Arg1().RecoverString(); 
    CLR_RT_HeapBlock*        hbAsm = stack.Arg0().Dereference();

    FAULT_ON_NULL(szClass);
    FAULT_ON_NULL(hbAsm);

    TINYCLR_CHECK_HRESULT(GetTypeDescriptor( *hbAsm, assm ));

    hbRef = &stack.PushValueAndClear();
    
    if(g_CLR_RT_TypeSystem.FindTypeDef( szClass, assm.m_assm, td ))
    {
        TINYCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.NewObjectFromIndex(*hbRef, g_CLR_RT_WellKnownTypes.m_TypeStatic));
        
        hbObj = hbRef->Dereference();
        hbObj->SetReflection( td );
    }

    TINYCLR_NOCLEANUP();
}
开发者ID:AustinWise,项目名称:Netduino-Micro-Framework,代码行数:29,代码来源:corlib_native_System_Reflection_Assembly.cpp

示例3: GetValuePtr

CLR_INT64* Library_corlib_native_System_TimeSpan::GetValuePtr( CLR_RT_HeapBlock& ref )
{
    NATIVE_PROFILE_CLR_CORE();
    CLR_RT_HeapBlock* obj = &ref;
    CLR_DataType      dt  = obj->DataType();

    if(dt == DATATYPE_OBJECT || dt == DATATYPE_BYREF)
    {
        obj = obj->Dereference(); if(!obj) return NULL;

        dt = obj->DataType();
    }

    if(dt == DATATYPE_TIMESPAN)
    {
        return (CLR_INT64*)&obj->NumericByRef().s8;
    }

    if(dt == DATATYPE_I8)
    {
        return (CLR_INT64*)&obj->NumericByRef().s8;
    }

    if(dt == DATATYPE_VALUETYPE && obj->ObjectCls().m_data == g_CLR_RT_WellKnownTypes.m_TimeSpan.m_data)
    {
        return (CLR_INT64*)&obj[ FIELD__m_ticks ].NumericByRef().s8;
    }

    return NULL;
}
开发者ID:AustinWise,项目名称:Netduino-Micro-Framework,代码行数:30,代码来源:corlib_native_System_TimeSpan.cpp

示例4:

HRESULT Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_FindObjectEnum::FindObjectsInit___VOID__SZARRAY_MicrosoftSPOTCryptokiCryptokiAttribute( CLR_RT_StackFrame& stack )
{
    TINYCLR_HEADER();
    CLR_RT_HeapBlock*       pThis      = stack.This();
    CLR_RT_HeapBlock_Array* pAttribs   = stack.Arg1().DereferenceArray();
    CLR_RT_HeapBlock*       pAttrib;
    CLR_RT_HeapBlock*       pSession   = pThis[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_FindObjectEnum::FIELD__m_session].Dereference();
    CK_SESSION_HANDLE       hSession;
    CK_ATTRIBUTE            attribs[20];
    CLR_UINT32              i;

    FAULT_ON_NULL_ARG(pAttribs);
    FAULT_ON_NULL(pSession);

    if(pAttribs->m_numOfElements > ARRAYSIZE(attribs)) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE);

    hSession = pSession[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_Session::FIELD__m_handle].NumericByRef().u4;
    pAttrib  = (CLR_RT_HeapBlock*)pAttribs->GetFirstElement();

    for(i=0; i<pAttribs->m_numOfElements; i++)
    {
        CLR_RT_HeapBlock*       pElement    = pAttrib->Dereference();  FAULT_ON_NULL(pElement);
        CLR_RT_HeapBlock_Array* pValueArray = pElement[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_CryptokiAttribute::FIELD__Value].DereferenceArray();  FAULT_ON_NULL(pValueArray);

        attribs[i].type       = pElement[Library_security_pkcs11_native_Microsoft_SPOT_Cryptoki_CryptokiAttribute::FIELD__Type].NumericByRef().u4;
        attribs[i].pValue     = pValueArray->GetFirstElement();
        attribs[i].ulValueLen = pValueArray->m_numOfElements;

        pAttrib++;
    }

    CRYPTOKI_CHECK_RESULT(stack, C_FindObjectsInit(hSession, attribs, pAttribs->m_numOfElements));

    TINYCLR_NOCLEANUP();
}
开发者ID:AustinWise,项目名称:Netduino-Micro-Framework,代码行数:35,代码来源:security_pkcs11_native_Microsoft_SPOT_Cryptoki_FindObjectEnum.cpp

示例5: POST_PROCESS_EXCEPTION

void CLR_RT_DUMP::POST_PROCESS_EXCEPTION( CLR_RT_HeapBlock& ref )
{
    // socket exceptions have an extra field (ErrorCode), so lets display that as well
    if (CLR_RT_ExecutionEngine::IsInstanceOf( ref, g_CLR_RT_WellKnownTypes.m_SocketException ))
    {
        CLR_RT_HeapBlock* obj = ref.Dereference();
        if(obj != NULL)

        {
            CLR_INT32 errorCode = obj[ Library_system_sockets_System_Net_Sockets_SocketException::FIELD___errorCode ].NumericByRef().s4;
            CLR_Debug::Printf( "    #### SocketException ErrorCode = %d\r\n", errorCode ); 
        }
    }
}
开发者ID:Wampamba-Nooh,项目名称:MicroFrameworkSDK-Mono,代码行数:14,代码来源:Info.cpp

示例6: GetAssemblies___STATIC__SZARRAY_mscorlibSystemReflectionAssembly

HRESULT Library_spot_native_Microsoft_SPOT_Reflection::GetAssemblies___STATIC__SZARRAY_mscorlibSystemReflectionAssembly( CLR_RT_StackFrame& stack )
{
    NATIVE_PROFILE_CLR_CORE();
    TINYCLR_HEADER();

    CLR_RT_HeapBlock& top    = stack.PushValueAndClear();

#if defined(TINYCLR_APPDOMAINS)
    TINYCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.GetCurrentAppDomain()->GetAssemblies( top ));
#else
    int               count  = 0;
    CLR_RT_HeapBlock* pArray = NULL;

    for(int pass=0; pass<2; pass++)
    {
        TINYCLR_FOREACH_ASSEMBLY(g_CLR_RT_TypeSystem)
        {
            if(pASSM->m_header->flags & CLR_RECORD_ASSEMBLY::c_Flags_Patch) continue;

            if(pass == 0)
            {
                count++;
            }
            else
            {
                CLR_RT_HeapBlock* hbObj;
                CLR_RT_Assembly_Index idx; idx.Set( pASSM->m_idx );

                TINYCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.NewObjectFromIndex(*pArray, g_CLR_RT_WellKnownTypes.m_Assembly));
                hbObj = pArray->Dereference();
                
                hbObj->SetReflection( idx ); 

                pArray++;
            }
        }
        TINYCLR_FOREACH_ASSEMBLY_END();

        if(pass == 0)
        {
            TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance( top, count, g_CLR_RT_WellKnownTypes.m_Assembly ));

            pArray = (CLR_RT_HeapBlock*)top.DereferenceArray()->GetFirstElement();
        }
    }
#endif //TINYCLR_APPDOMAINS

    TINYCLR_NOCLEANUP();
}
开发者ID:EddieGarmon,项目名称:netduino-netmf,代码行数:49,代码来源:spot_native_Microsoft_SPOT_Reflection.cpp

示例7: AddEntry

HRESULT CLR_RT_HeapBlock_XmlNameTable::AddEntry( CLR_RT_HeapBlock_String*& str, CLR_INT32 hashCode )
{
    TINYCLR_HEADER();
    
    CLR_RT_HeapBlock                     newEntryHB;
    CLR_RT_HeapBlock_XmlNameTable_Entry* newEntry;
    CLR_RT_HeapBlock*                    entryHB;

    CLR_INT32                            count;  

    // create a new instance of the Entry object
    TINYCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.NewObjectFromIndex( newEntryHB, g_CLR_RT_WellKnownTypes.m_XmlNameTable_Entry ));
    
    newEntry = (CLR_RT_HeapBlock_XmlNameTable_Entry*)newEntryHB.Dereference();
    
    // attach it to the front of the bucket
    entryHB = (CLR_RT_HeapBlock*)GetEntries()->GetElement( GetMask() & hashCode );

    newEntry->SetStr( str );
    newEntry->SetHashCode( hashCode );
    newEntry->SetNext( (CLR_RT_HeapBlock_XmlNameTable_Entry*)entryHB->Dereference() );
    
    entryHB->SetObjectReference( newEntry );

    count = GetCount() + 1;
    
    SetCount( count );

    // if we reach the threshold, we'll grow the buckets
    if(count == GetMask())
    {
        Grow();
    }

    TINYCLR_NOCLEANUP();
}
开发者ID:EddieGarmon,项目名称:netduino-netmf,代码行数:36,代码来源:XmlNameTable.cpp

示例8: Grow

HRESULT CLR_RT_HeapBlock_XmlNameTable::Grow()
{
    TINYCLR_HEADER();
    
    CLR_RT_HeapBlock_Array*              oldEntries;
    CLR_RT_HeapBlock                     newEntriesHB;
    CLR_RT_HeapBlock_Array*              newEntries;
    CLR_RT_HeapBlock_XmlNameTable_Entry* entry;
    CLR_RT_HeapBlock_XmlNameTable_Entry* next;
    CLR_RT_HeapBlock*                    newEntryHB;

    CLR_UINT32                           i;
    CLR_INT32                            newIndex;
    CLR_INT32                            newMask;

    newMask = GetMask() * 2 + 1;

    // allocate a new instance of Entry array
    TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance( newEntriesHB, newMask + 1, g_CLR_RT_WellKnownTypes.m_XmlNameTable_Entry ));

    newEntries = newEntriesHB.DereferenceArray();
    oldEntries = GetEntries();

    // Go through the old buckets, and resort them
    for(i = 0; i < oldEntries->m_numOfElements; i++)
    {
        entry = (CLR_RT_HeapBlock_XmlNameTable_Entry*)((CLR_RT_HeapBlock*)oldEntries->GetElement( i ))->Dereference();
    
        while(entry != NULL)
        {
            newIndex = entry->GetHashCode() & newMask;
            next = entry->GetNext();
    
            newEntryHB = (CLR_RT_HeapBlock*)newEntries->GetElement( newIndex );
    
            entry->SetNext( (CLR_RT_HeapBlock_XmlNameTable_Entry*)newEntryHB->Dereference() );
    
            newEntryHB->SetObjectReference( entry );
    
            entry = next;
        }
    }

    SetEntries( newEntries );
    SetMask   ( newMask    );

    TINYCLR_NOCLEANUP();
}
开发者ID:EddieGarmon,项目名称:netduino-netmf,代码行数:48,代码来源:XmlNameTable.cpp

示例9: GetValue___OBJECT__OBJECT

HRESULT Library_corlib_native_System_Reflection_RuntimeFieldInfo::GetValue___OBJECT__OBJECT( CLR_RT_StackFrame& stack )
{
    NATIVE_PROFILE_CLR_CORE();
    TINYCLR_HEADER();

    CLR_RT_HeapBlock*          argObj = &stack.Arg1();
    CLR_RT_FieldDef_Instance   instFD;
    CLR_RT_TypeDef_Instance    instTD;
    const CLR_RECORD_FIELDDEF* fd;
    CLR_RT_HeapBlock*          obj;
    CLR_RT_HeapBlock           dst;
                    
    TINYCLR_CHECK_HRESULT(Library_corlib_native_System_Reflection_FieldInfo::Initialize( stack, instFD, instTD, obj ));

    fd = instFD.m_target;
    if(fd->flags & CLR_RECORD_FIELDDEF::FD_NoReflection) // don't allow reflection for fields with NoReflection attribute
    {
        TINYCLR_SET_AND_LEAVE(CLR_E_NOT_SUPPORTED);
    }

    {
        dst.Assign( *obj );

#if defined(TINYCLR_APPDOMAINS)
        //Marshal if necessary.
        if(argObj->IsTransparentProxy())
        {
            _ASSERTE(argObj->DataType() == DATATYPE_OBJECT);
            
            argObj = argObj->Dereference();

            _ASSERTE(argObj != NULL && argObj->DataType() == DATATYPE_TRANSPARENT_PROXY);
    
            TINYCLR_CHECK_HRESULT(argObj->TransparentProxyValidate());
            
            TINYCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.GetCurrentAppDomain()->MarshalObject( *obj, dst, argObj->TransparentProxyAppDomain() ));
        }
#endif

        CLR_RT_HeapBlock& res = stack.PushValueAndAssign( dst );

        TINYCLR_CHECK_HRESULT(res.PerformBoxingIfNeeded());            
    }

    TINYCLR_NOCLEANUP();
}
开发者ID:prabby,项目名称:miniclr,代码行数:46,代码来源:corlib_native_System_Reflection_RuntimeFieldInfo.cpp

示例10: AddNamespace

// Note that prefix and namespaceURI need to be atomized (with nametable) prior to calling AddNamespace
HRESULT CLR_RT_HeapBlock_XmlNamespaceStack::AddNamespace( CLR_RT_HeapBlock_String* prefix, CLR_RT_HeapBlock_String* namespaceURI )
{
    TINYCLR_HEADER();

    CLR_RT_HeapBlock                    ref;
    CLR_RT_HeapBlock_XmlNamespaceEntry* entry;

    TINYCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.NewObjectFromIndex( ref, g_CLR_RT_WellKnownTypes.m_XmlReader_NamespaceEntry ));

    entry = (CLR_RT_HeapBlock_XmlNamespaceEntry*)ref.Dereference();

    entry->SetPrefix      ( prefix       );
    entry->SetNamespaceURI( namespaceURI );

    TINYCLR_SET_AND_LEAVE(Push( entry ));

    TINYCLR_NOCLEANUP();
}
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:19,代码来源:XmlReader.cpp

示例11: GetAppDomain

HRESULT Library_corlib_native_System_AppDomain::GetAppDomain( CLR_RT_HeapBlock& ref, CLR_RT_AppDomain*& appDomain, CLR_RT_AppDomain*& appDomainSav, bool fCheckForUnloadingAppDomain )
{
    NATIVE_PROFILE_CLR_CORE();
    TINYCLR_HEADER();

    CLR_RT_HeapBlock*            obj;
    CLR_RT_ObjectToEvent_Source* src;

    //Setting up appDomainSav is guaranteed to be initialized correctly by this function
    appDomainSav = g_CLR_RT_ExecutionEngine.GetCurrentAppDomain();
    
    _ASSERTE(ref.DataType() == DATATYPE_OBJECT);
    
    obj = ref.Dereference(); FAULT_ON_NULL(obj);
    
    if(obj->DataType() == DATATYPE_TRANSPARENT_PROXY)
    {
        appDomain = obj->TransparentProxyAppDomain();

        if(!appDomain) TINYCLR_SET_AND_LEAVE(CLR_E_APPDOMAIN_EXITED);

        obj = obj->TransparentProxyDereference(); FAULT_ON_NULL(obj);
    }

    _ASSERTE(obj->DataType()         == DATATYPE_CLASS                            );
    _ASSERTE(obj->ObjectCls().m_data == g_CLR_RT_WellKnownTypes.m_AppDomain.m_data);
    
    src       = CLR_RT_ObjectToEvent_Source::ExtractInstance( obj[ FIELD__m_appDomain ] ); FAULT_ON_NULL(src);
    appDomain = (CLR_RT_AppDomain*)src->m_eventPtr                                       ; FAULT_ON_NULL(appDomain);
    
    _ASSERTE(appDomain->DataType() == DATATYPE_APPDOMAIN_HEAD);

    if(fCheckForUnloadingAppDomain)
    {
        if(!appDomain->IsLoaded()) TINYCLR_SET_AND_LEAVE(CLR_E_APPDOMAIN_EXITED);        
    }

    (void)g_CLR_RT_ExecutionEngine.SetCurrentAppDomain( appDomain );

    TINYCLR_NOCLEANUP();
}
开发者ID:dienbk7x,项目名称:NetmfSTM32,代码行数:41,代码来源:corlib_native_System_AppDomain.cpp

示例12:

HRESULT Library_spot_hardware_native_Microsoft_SPOT_Hardware_I2CDevice__Configuration::GetInitialConfig(CLR_RT_HeapBlock& ref, I2C_USER_CONFIGURATION& nativeConfig)
{
    NATIVE_PROFILE_CLR_HARDWARE();
    TINYCLR_HEADER();

    CLR_RT_HeapBlock* config = ref.Dereference();
    FAULT_ON_NULL(config);

    nativeConfig.Address   = config[ FIELD__Address      ].NumericByRef().u2;
    nativeConfig.ClockRate = config[ FIELD__ClockRateKhz ].NumericByRef().s4;

    if(nativeConfig.Address > c_MaxI2cAddress)
    {
        TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER);
    }

    if(nativeConfig.ClockRate < c_MimimumClockRateKhz || c_MaximumClockRateKhz < nativeConfig.ClockRate)
    {
        TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER)
    }

    TINYCLR_NOCLEANUP();
}
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:23,代码来源:spot_hardware_native_Microsoft_SPOT_Hardware_I2CDevice__Configuration.cpp

示例13: GetTypes___SZARRAY_SystemType

HRESULT Library_corlib_native_System_Reflection_Assembly::GetTypes___SZARRAY_SystemType( CLR_RT_StackFrame& stack )
{
    NATIVE_PROFILE_CLR_CORE();
    TINYCLR_HEADER();

    CLR_RT_Assembly_Instance assm;
    CLR_RT_HeapBlock*        hbAsm = stack.Arg0().Dereference();

    TINYCLR_CHECK_HRESULT(GetTypeDescriptor( *hbAsm, assm ));

    {
        CLR_RT_Assembly*  pASSM = assm.m_assm;
        CLR_UINT32        num   = pASSM->m_pTablesSize[ TBL_TypeDef ];
        CLR_RT_HeapBlock& top   = stack.PushValue();
        CLR_RT_HeapBlock* hbObj;

        TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance( top, num, g_CLR_RT_WellKnownTypes.m_TypeStatic ));

        if(num)
        {
            CLR_RT_HeapBlock* pArray = (CLR_RT_HeapBlock*)top.DereferenceArray()->GetFirstElement();

            for(CLR_UINT32 i=0; i<num; i++, pArray++)
            {
                CLR_RT_TypeDef_Index idx; idx.Set( pASSM->m_idx, i );

                TINYCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.NewObjectFromIndex(*pArray, g_CLR_RT_WellKnownTypes.m_TypeStatic));
                
                hbObj = pArray->Dereference();
                hbObj->SetReflection( idx );
            }
        }
    }

    TINYCLR_NOCLEANUP();
}
开发者ID:AustinWise,项目名称:Netduino-Micro-Framework,代码行数:36,代码来源:corlib_native_System_Reflection_Assembly.cpp

示例14: Dequeue

HRESULT CLR_RT_HeapBlock_Queue::Dequeue( CLR_RT_HeapBlock*& value )
{
    NATIVE_PROFILE_CLR_CORE();
    TINYCLR_HEADER();

    CLR_RT_HeapBlock_Array* array   = GetArray();
    CLR_INT32               size    = GetSize();
    CLR_INT32               head    = Head();
    CLR_RT_HeapBlock*       removed;

    if(size == 0) TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_OPERATION);

    removed = (CLR_RT_HeapBlock*)array->GetElement( head );

    value = removed->Dereference();

    removed->SetObjectReference( NULL );

    SetHead( (head + 1) % array->m_numOfElements );
    
    SetSize( size - 1 );

    TINYCLR_NOCLEANUP();
}
开发者ID:EddieGarmon,项目名称:netduino-netmf,代码行数:24,代码来源:CLR_RT_HeapBlock_Queue.cpp

示例15: Process

HRESULT CLR_RT_XmlState_BetweenElements::Process( CLR_RT_XmlState* st )
{
    TINYCLR_HEADER();
    CLR_RT_XmlState_BetweenElements* state = &st->BetweenElements;

    CLR_RT_HeapBlock_XmlReader* reader   = state->reader;
    CLR_RT_HeapBlock_Stack*     xmlNodes = reader->GetXmlNodes();
    CLR_RT_HeapBlock_XmlNode*   xmlNode;

    CLR_UINT8* buffer = state->buffer;

    if(state->fromEndElement)
    {
        CLR_UINT32 namespaceCount;
        bool hasXmlSpace;
        bool hasXmlLang;
        
        CLR_RT_HeapBlock* tmp;

        _ASSERTE(xmlNodes->GetSize() > 0);
        _ASSERTE(reader->GetXmlSpaces()->GetSize() > 0);
        _ASSERTE(reader->GetXmlLangs()->GetSize() > 0);
        
        xmlNodes->Peek( (CLR_RT_HeapBlock*&)xmlNode );

        xmlNode->GetFlags( namespaceCount, hasXmlSpace, hasXmlLang );

        reader->GetNamespaces()->PopScope( namespaceCount );

        if(hasXmlSpace)
        {
            reader->GetXmlSpaces()->Pop( tmp );
        }

        if(hasXmlLang)
        {
            reader->GetXmlLangs()->Pop( tmp );
        }

        reader->SetIsEmptyElement( false );
    }
    else
    {
        CLR_RT_HeapBlock xmlNodeHB;

        TINYCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.NewObjectFromIndex( xmlNodeHB, g_CLR_RT_WellKnownTypes.m_XmlReader_XmlNode ));

        xmlNode = (CLR_RT_HeapBlock_XmlNode*)xmlNodeHB.Dereference();

        TINYCLR_CHECK_HRESULT(xmlNodes->Push( xmlNode ));
    }

    xmlNode->Clear();

    TINYCLR_CHECK_HRESULT(reader->GetAttributes()->Clear());

    if(*buffer == '<')
    {
        CLR_RT_XmlState_NewTag::Setup( st );
    }
    else if(c_XmlCharType[ *buffer ] & XmlCharType_Space)
    {
        CLR_RT_XmlState_InValue::SetupWhitespace( st, buffer );
    }
    else
    {
        if(state->docState != XmlDocState_MainDocument)
        {
            TINYCLR_SET_AND_LEAVE(XML_E_INVALID_ROOT_DATA);
        }
        
        CLR_RT_XmlState_InValue::SetupText( st, buffer, false );
    }

    TINYCLR_NOCLEANUP();
}
开发者ID:EddieGarmon,项目名称:netduino-netmf,代码行数:76,代码来源:XmlState_BetweenElements.cpp


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