BVB Source Codes

CRYENGINE Show CodeCoverageTracker.cpp Source code

Return Download CRYENGINE: download CodeCoverageTracker.cpp Source code - Download CRYENGINE Source code - Type:.cpp
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. // -------------------------------------------------------------------------
  4. //  File name:   CodeCoverageTracker.cpp
  5. //  Created:     18/06/2008 by Matthew
  6. //  Description: Defines code coverage check points
  7. //               and a central class to track their registration
  8. // -------------------------------------------------------------------------
  9. //  History:
  10. //
  11. ////////////////////////////////////////////////////////////////////////////
  12.  
  13. #include "StdAfx.h"
  14.  
  15. #if !defined(_RELEASE)
  16.  
  17.         #include "CodeCoverageTracker.h"
  18.         #include "CodeCoverageManager.h"
  19.  
  20. // CCodeCoverageCheckPoint constructor
  21. CCodeCoverageCheckPoint::CCodeCoverageCheckPoint(const char* label) : m_nCount(0), m_psLabel(label)
  22. {
  23.         assert(label);
  24.         // Register self with central manager
  25.         if (gAIEnv.pCodeCoverageTracker)
  26.                 gAIEnv.pCodeCoverageTracker->Register(this);
  27. }
  28.  
  29. // CCodeCoverageTracker constructor
  30. CCodeCoverageTracker::CCodeCoverageTracker(void)
  31. {
  32.         for (int i = 0; i < 3; ++i)
  33.                 m_pMostRecent[i] = NULL;
  34.         m_nLastEntry = 0;
  35. }
  36.  
  37. // CCodeCoverageTracker operations
  38. CCodeCoverageCheckPoint* CCodeCoverageTracker::GetCheckPoint(const char* sLabel) const
  39. {
  40.         assert(sLabel);
  41.         CheckPointMap::const_iterator it(m_mCheckPoints.find(sLabel));
  42.         return (it != m_mCheckPoints.end() ? it->second : NULL);
  43. }
  44.  
  45. void CCodeCoverageTracker::Register(CCodeCoverageCheckPoint* pPoint)
  46. {
  47.         assert(pPoint);
  48.  
  49.         m_vecCheckPoints.push_back(pPoint);
  50.  
  51.         /*
  52.            if (!gAIEnv.pCodeCoverageManager || !gAIEnv.pCodeCoverageManager->IsContextValid())
  53.            {
  54.            // At this point the CodeCoverageManager is not in a valid state.
  55.            // We keep track of points encountered in a temporary list for now
  56.            m_vecCheckPoints.push_back(pPoint);
  57.            }
  58.            else
  59.            {
  60.            // Add it to the map
  61.            // And, ensure that no other checkpoint has the same name
  62.            CheckPointMap::iterator it = m_mCheckPoints.find(pPoint->GetLabel());
  63.            assert (it == m_mCheckPoints.end());
  64.            if (gAIEnv.pCodeCoverageManager->IsExpected(pPoint->GetLabel()))
  65.             m_mCheckPoints.insert(std::make_pair(pPoint->GetLabel(), pPoint));
  66.            else
  67.             m_vecCheckPoints.push_back(pPoint);
  68.  
  69.            // Store this label so it can be retrieved by the renderer for the code coverage
  70.            m_pMostRecent[m_nLastEntry++] = pPoint->GetLabel();
  71.            if (3 == m_nLastEntry)
  72.             m_nLastEntry = 0;
  73.  
  74.            //gEnv->pLog->Log("Registered checkpoint: %s", pPoint->m_psLabel);
  75.            }
  76.          */
  77.         m_pMostRecent[m_nLastEntry++] = pPoint->GetLabel();
  78.         if (3 == m_nLastEntry)
  79.                 m_nLastEntry = 0;
  80. }
  81.  
  82. void CCodeCoverageTracker::Clear()
  83. {
  84.         for (CheckPointMap::iterator it = m_mCheckPoints.begin(); it != m_mCheckPoints.end(); ++it)
  85.                 it->second->Reset();
  86. }
  87.  
  88. void CCodeCoverageTracker::Reset()
  89. {
  90.         Clear();
  91.         m_mCheckPoints.clear();
  92. }
  93.  
  94. int CCodeCoverageTracker::GetTotalRegistered()
  95. {
  96.         return (int)m_mCheckPoints.size();
  97. }
  98.  
  99. void CCodeCoverageTracker::GetMostRecentAndReset(const char* pRet[3])
  100. {
  101.         for (int i = 0; i < 3; ++i)
  102.         {
  103.                 pRet[i] = m_pMostRecent[i];
  104.                 m_pMostRecent[i] = NULL;
  105.         }
  106. }
  107.  
  108. #endif //_RELEASE
  109.  
downloadCodeCoverageTracker.cpp Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top