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


C++ V_SAFE_DELETE函数代码示例

本文整理汇总了C++中V_SAFE_DELETE函数的典型用法代码示例。如果您正苦于以下问题:C++ V_SAFE_DELETE函数的具体用法?C++ V_SAFE_DELETE怎么用?C++ V_SAFE_DELETE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: RecurseDestroy

void RecurseDestroy(CCObject * pObj)
{
  if (pObj == NULL) return;
  if (pObj->isOfClass(CCObject::ClassOfCCDictionary))
  {
    CCDictionary * pDict = (CCDictionary *)pObj;
    CCDictionary::const_iterator itDict = pDict->begin();
    while(itDict != pDict->end())
    {
      RecurseDestroy(itDict->second);
      itDict++;
    }
    pDict->erase(pDict->begin(), pDict->end());
    V_SAFE_DELETE(pDict);
  }
  else if (pObj->isOfClass(CCObject::ClassOfCCArray))
  {
    CCArray * pArray = (CCArray *)pObj;
    int iCount = (int)pArray->size();
    for (int i = 0; i < iCount; i++)
    {
      RecurseDestroy((*pArray)[i]);
    }
    V_SAFE_DELETE(pArray);
  }
  else if (pObj->isOfClass(CCObject::ClassOfCCString))
  {
    CCString * pString = (CCString*)pObj;
    V_SAFE_DELETE(pString);
  }
  else
  {
    V_SAFE_DELETE(pObj);
  }
}
开发者ID:nkligang,项目名称:ccbi2ccb,代码行数:35,代码来源:plistHelper.cpp

示例2: V_SAFE_DELETE

bool VRSDClient::StopProfiling(unsigned int* puiProfilingResultCount /*= NULL*/)
{
  if(!m_bProfilingEnabled)
    return false;

  Vision::Callbacks.OnEditorModeChanged -= this;

  // tell the client language implementation that we are stopping to profile (just in case it has something special to do)
  if(GetClientLanguageImplementation()->StopProfiling())
  {
    m_bProfilingEnabled = false;

    if(puiProfilingResultCount)
      *puiProfilingResultCount = m_pProfilingInformations.GetValidSize();

    Vision::Error.SystemMessage("Stopped script profiling.");
    if(!SendProfilingResults())
      Vision::Error.Warning("Couldn't transmit profiling results!");
    else
      Vision::Error.SystemMessage("Sent profiling results.");

    V_SAFE_DELETE(m_pProfilingStack);

    unsigned int uiArraySize = m_pProfilingInformations.GetValidSize();
    for(unsigned int i = 0; i < uiArraySize; i++)
      V_SAFE_DELETE(m_pProfilingInformations[i]);

    m_pProfilingInformations.Reset();

    return true;
  }

  return false;
}
开发者ID:cDoru,项目名称:projectanarchy,代码行数:34,代码来源:VRSDClient.cpp

示例3: V_SAFE_DELETE

VPlayableCharacterComponent::~VPlayableCharacterComponent()
{
  V_SAFE_DELETE(m_pInputMap);

#if defined(SUPPORTS_MULTITOUCH)
  V_SAFE_DELETE(m_pVirtualThumbStick);
#endif

  Vision::Callbacks.OnVideoChanged -= this;
}
开发者ID:cDoru,项目名称:projectanarchy,代码行数:10,代码来源:VPlayableCharacterComponent.cpp

示例4: Serialize

void VScriptComponent::Serialize( VArchive &ar )
{
  char iLocalVersion = VERSION_CURRENT;
  IVObjectComponent::Serialize(ar);

  if (ar.IsLoading())
  {
    ar >> iLocalVersion;
    if (iLocalVersion<VERSION_INITIAL||iLocalVersion>VERSION_CURRENT)
      hkvLog::FatalError("Invalid script serialization version - please re-export scene.");

    // This is a workaround for [#21287] : This component must be immediately added to the owner's component list,
    // otherwise script function calls on it create a new script component which results in one object having two script components
    // [8.1: need to serialize it here]
    VisTypedEngineObject_cl *pOwner = ar.ReadObject<VisTypedEngineObject_cl>();
    if (pOwner != NULL && !pOwner->Components().Contains(this))
      ((VObjectComponentCollection &)pOwner->Components()).Add(this);
    // additionally we have to temporarily pretend the owner is set:
    m_pOwner = pOwner;

    m_iScriptRefID = LUA_REFNIL;
    VScriptInstance *pInstance = NULL;
    ar >> pInstance;
    // we shouldn't call SetScriptInstance since it calls the Lua OnCreate function, which may try to access the object
    //SetScriptInstance(pInstance);
    m_spInstance = pInstance;

    if(iLocalVersion >= VERSION_CUSTOM_EXPOSED_MEMBERS)
    {
      int iNumOfSerializedMembers;
      ar >> iNumOfSerializedMembers;

      m_CustomExposeVars.Clear();

      // read all members storead as Name+Type
      for(int i = 0;i < iNumOfSerializedMembers; i++)
      {
        char szBuffer1[64];
        char szBuffer2[64];
        bool bAllocated1 = false;
        bool bAllocated2 = false;
        const char *szName = ar.ReadEncryptedString(szBuffer1, 64, bAllocated1);
        const char *szValue = ar.ReadEncryptedString(szBuffer2, 64, bAllocated2);

        m_CustomExposeVars.Add(VScriptMember(szName, szValue));

        if(bAllocated1) V_SAFE_DELETE(szName);
        if(bAllocated2) V_SAFE_DELETE(szValue);
      }
    }
开发者ID:Arpit007,项目名称:projectanarchy,代码行数:50,代码来源:VScriptComponent.cpp

示例5: StopProfiling

bool VRSDClient::StartProfiling()
{
  if(m_bProfilingEnabled)
  {
    StopProfiling();
    return false;
  }

  Vision::Callbacks.OnEditorModeChanged += this;

  // tell the client language implementation that we are now profiling (just in case it has something special to do)
  if(GetClientLanguageImplementation()->StartProfiling())
  {
    V_SAFE_DELETE(m_pProfilingStack);
    m_pProfilingStack = new VPListStack<VRSDProfilingSample*>();
    m_bProfilingEnabled = true;

    Vision::Error.SystemMessage("Starting script profiling..");

    return true;
  }

  /// \todo Editor Play Mode starten
//  if(!Vision::Editor.IsPlaying())
//    Vision::Editor.SetMode(VisEditorManager_cl::EDITORMODE_PLAYING_IN_EDITOR);

  return false;
}
开发者ID:cDoru,项目名称:projectanarchy,代码行数:28,代码来源:VRSDClient.cpp

示例6: VRSDProfilingSample

void VRSDClient::HandleScriptEventForProfiling(VRSDScriptEvent* pScriptEvent)
{
  if(!pScriptEvent)
    return;

  const char* pFileName = pScriptEvent->pFileName ? pScriptEvent->pFileName : "";
  const char* pFunctionName = pScriptEvent->pFunctionName ? pScriptEvent->pFunctionName : "";
  int iLineDefined = pScriptEvent->iLineDefined;


  // Note: This code is not very memory friendly..
  if(pScriptEvent->eEventType == VRSDScriptEvent::EVENT_ENTER_FUNCTION)
  {
    m_pProfilingStack->Push(new VRSDProfilingSample(pFileName, pFunctionName, pScriptEvent->iLineDefined));
  }
  else if(pScriptEvent->eEventType == VRSDScriptEvent::EVENT_LEAVE_FUNCTION)
  {
    // safe guard
    if(!m_pProfilingStack->IsEmpty())
    {
      uint64 uiStopTime = VGLGetTimer();
      VRSDProfilingSample* pSample = m_pProfilingStack->Pop();

      uint64 uiTimeTaken = uiStopTime - pSample->m_uiStartTime;

      // Store the profiling information
      UpdateProfilingInformation(pFileName, iLineDefined == -1 ? "(native)" : pFunctionName, iLineDefined, uiTimeTaken);

      V_SAFE_DELETE(pSample);
    }
  }
}
开发者ID:cDoru,项目名称:projectanarchy,代码行数:32,代码来源:VRSDClient.cpp

示例7: VScopedRendererNodeDeinit

void VRendererNodeCommon::OnHandleCallback(IVisCallbackDataObject_cl *pData)
{
  if (pData->m_pSender == &Vision::Callbacks.OnBeforeVideoChanged)
  {
    if (GetFinalTargetContext() != NULL && RendersIntoBackBuffer() && IsInitialized())
    {
      m_pDeinitDuringVideoResize = new VScopedRendererNodeDeinit(this);
    }
  }
  else if (pData->m_pSender == &Vision::Callbacks.OnVideoChanged)
  {
    V_SAFE_DELETE(m_pDeinitDuringVideoResize);
  }
#if defined(_VISION_WIN32) && defined(_VR_DX9)
  else if (pData->m_pSender == &Vision::Callbacks.OnEnterForeground)
  {
    if(IsInitialized())
    {
      InitializePostProcessors();
    }
  }
#endif
  else if (pData->m_pSender == &Vision::Callbacks.OnUpdateSceneFinished)
  {
    UpdateTimeOfDay();
  }
}
开发者ID:Arpit007,项目名称:projectanarchy,代码行数:27,代码来源:VRendererNodeCommon.cpp

示例8: V_SAFE_DELETE

void VStringInputMapManager::Release()
{
  for(unsigned int i=0; i<(unsigned int)m_instances.GetSize(); i++)
  {
    V_SAFE_DELETE(m_instances[i]);
  }
}
开发者ID:Arpit007,项目名称:projectanarchy,代码行数:7,代码来源:VStringInputMapManager.cpp

示例9: VFmodEventSoundTriggerInfo_t

bool VFmodAnimationEventSoundTrigger::CommonInit()
{
  // Initialize base component
  if (!IVAnimationEventTrigger::CommonInit())
    return false;

  // Fill the event trigger info
  if (m_iEventTriggerInfoCount <= 0)
  {
    VFmodEventSoundTriggerInfo_t* info = NULL;
    if(m_pActiveTriggerInfo == NULL) //make sure it does not get created more than once
    {
      // Create new list with only one entry and set properties
      info = new VFmodEventSoundTriggerInfo_t();
    }
    else
    {
      info = (VFmodEventSoundTriggerInfo_t*)m_pActiveTriggerInfo;
    }
    // Get sound resource
    info->m_spSoundResource = VFmodManager::GlobalManager().LoadSoundResource(SoundFilename, VFMOD_RESOURCEFLAG_DEFAULT);
    if (info->m_spSoundResource == NULL || !GetEventTriggerInfoBaseData(info)) //set sequence and event id
    {
      V_SAFE_DELETE(info);
      m_pActiveTriggerInfo = NULL;
      return false;
    }
    // Set it as the active event trigger info
    m_pActiveTriggerInfo = info;
  }
  
  return true;
}
开发者ID:RexBaribal,项目名称:projectanarchy,代码行数:33,代码来源:VFmodAnimationEventSoundTrigger.cpp

示例10: V_SAFE_DELETE

VThrowItemComponent::~VThrowItemComponent()
{
  // Register Callback
  Vision::Callbacks.OnUpdateSceneBegin -= this;

  V_SAFE_DELETE(m_pInputMap);
}
开发者ID:RexBaribal,项目名称:projectanarchy,代码行数:7,代码来源:VThrowItemComponent.cpp

示例11: DestroyMap

 inline void DestroyMap(VStringInputMap * pMap)
 {
   if (pMap != NULL)
   {
     V_SAFE_DELETE(pMap);
   }
 }
开发者ID:Alagong,项目名称:projectanarchy,代码行数:7,代码来源:VScriptInput_wrapper.hpp

示例12: FreeCustomTextureRefs

void VRendererNodeCommon::DeInitializeSharedFeatures()
{
  FreeCustomTextureRefs(m_spSceneDepthTechnique);
  FreeCustomTextureRefs(m_spDepthOnlyTechnique);

  m_spColorReadTarget = NULL;
  m_spDepthReadTarget = NULL;
  m_spSceneDepthTechnique = NULL;
  m_spDepthOnlyTechnique = NULL;

  V_SAFE_DELETE(m_pColorBufferResolver);

#ifdef _VISION_XENON
  FreeCustomTextureRefs(m_spDepthOnlyTechnique360);
  if(m_bDepthRestoreInitialized)
  {
    VisHiZHelper_cl::DestroyFastDepthRestore(m_fastRestoreData);
    m_bDepthRestoreInitialized = false;
  }
  m_spDepthOnlyTechnique360 = NULL;
#endif

#ifdef _VISION_PS3
  m_spDummyDepthTexture = NULL;
#endif
}
开发者ID:Arpit007,项目名称:projectanarchy,代码行数:26,代码来源:VRendererNodeCommon.cpp

示例13: VBufferResolver

void VRendererNodeCommon::UpdateColorBufferResolver()
{
  const bool bNeedsColorResolver = m_ObjectsUsingResolvedColorBuffer.GetCount() > 0;
  if (bNeedsColorResolver)
  {
    if (m_pColorBufferResolver == NULL)
    {
      m_pColorBufferResolver = new VBufferResolver(this, GetReferenceContext(), m_uiResolveColorBufferRenderHook);
      if (!m_pColorBufferResolver->Initialize(VBufferResolver::VIM_CreateNewResolveBuffer))
      {
        V_SAFE_DELETE(m_pColorBufferResolver);
        return;
      }
    }

    if(m_iAutomaticResolveCounter > 0)
    {
      m_pColorBufferResolver->SetRenderHook(m_uiResolveColorBufferRenderHook);
    }
    else
    {
      m_pColorBufferResolver->SetRenderHook(VRH_INVALID);
    }
  }
  else
  {
    // If we have an existing color buffer resolver, just disable it - it's very likely we will need it again later.
    if(m_pColorBufferResolver)
    {
      m_pColorBufferResolver->SetRenderHook(VRH_INVALID);
    }
  }
}
开发者ID:Arpit007,项目名称:projectanarchy,代码行数:33,代码来源:VRendererNodeCommon.cpp

示例14: VisionRunFunction

extern "C" bool VisionRunFunction()
{
    VASSERT(VAppIOS::s_pAppInstance != NULL);
    if ((VAppIOS::s_pStartupModules != NULL) && (VAppIOS::s_pStartupModules->GetSize() > 0))
    {
        if (VAppIOS::ProcessStartupModule(0))
            return true;

        delete VAppIOS::s_pStartupModules->GetAt(0).m_pModule;
        VAppIOS::s_pStartupModules->RemoveAt(0);


        if(static_cast<VAppIOS*>(VAppBase::Get())->WantsToQuit())
        {
            V_SAFE_DELETE(static_cast<VAppIOS*>(VAppBase::Get())->m_pAppImpl);
            return false;
        }

        if (VAppIOS::s_pStartupModules->GetSize() > 0)
            VAppIOS::s_pStartupModules->GetAt(0).m_pModule->Init();
        else
            VAppIOS::s_pAppInstance->AppInit();

        return true;
    }
    else
    {
        return VAppIOS::s_pAppInstance->AppRun();
    }
}
开发者ID:romance-ii,项目名称:projectanarchy,代码行数:30,代码来源:VAppIOS.cpp

示例15: while

void VAppBase::ProcessStartupModules()
{
  if (s_pStartupModules == NULL)
    return;

  while (s_pStartupModules->GetSize() > 0 && !VAppBase::Get()->WantsToQuit())
  {
    VStartupModule* pModule = s_pStartupModules->GetAt(0).m_pModule;
    s_pStartupModules->RemoveAt(0);

    pModule->Init();

    // Run the startup module as long it returns true
    bool bResult = true;
    while (bResult)
    {
      bResult &= VAppBase::Get()->PlatformRun();
      bResult = bResult && pModule->Run();
    }

    pModule->DeInit();
    delete pModule;
  }

  V_SAFE_DELETE(s_pStartupModules);
}
开发者ID:Niobij,项目名称:AnarchoidTemplate,代码行数:26,代码来源:VAppBase.cpp


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