MCPcopy Create free account
hub / github.com/cirquit/trdrop / SectionTracker

Class SectionTracker

ext/catch.hpp:6106–6158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6104 };
6105
6106 class SectionTracker : public TrackerBase {
6107 std::vector<std::string> m_filters;
6108 public:
6109 SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent )
6110 : TrackerBase( nameAndLocation, ctx, parent )
6111 {
6112 if( parent ) {
6113 while( !parent->isSectionTracker() )
6114 parent = &parent->parent();
6115
6116 SectionTracker& parentSection = static_cast<SectionTracker&>( *parent );
6117 addNextFilters( parentSection.m_filters );
6118 }
6119 }
6120 virtual ~SectionTracker();
6121
6122 virtual bool isSectionTracker() const CATCH_OVERRIDE { return true; }
6123
6124 static SectionTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ) {
6125 SectionTracker* section = CATCH_NULL;
6126
6127 ITracker& currentTracker = ctx.currentTracker();
6128 if( ITracker* childTracker = currentTracker.findChild( nameAndLocation ) ) {
6129 assert( childTracker );
6130 assert( childTracker->isSectionTracker() );
6131 section = static_cast<SectionTracker*>( childTracker );
6132 }
6133 else {
6134 section = new SectionTracker( nameAndLocation, ctx, &currentTracker );
6135 currentTracker.addChild( section );
6136 }
6137 if( !ctx.completedCycle() )
6138 section->tryOpen();
6139 return *section;
6140 }
6141
6142 void tryOpen() {
6143 if( !isComplete() && (m_filters.empty() || m_filters[0].empty() || m_filters[0] == m_nameAndLocation.name ) )
6144 open();
6145 }
6146
6147 void addInitialFilters( std::vector<std::string> const& filters ) {
6148 if( !filters.empty() ) {
6149 m_filters.push_back(""); // Root - should never be consulted
6150 m_filters.push_back(""); // Test Case - not a section filter
6151 std::copy( filters.begin(), filters.end(), std::back_inserter( m_filters ) );
6152 }
6153 }
6154 void addNextFilters( std::vector<std::string> const& filters ) {
6155 if( filters.size() > 1 )
6156 std::copy( filters.begin()+1, filters.end(), std::back_inserter( m_filters ) );
6157 }
6158 };
6159
6160 class IndexTracker : public TrackerBase {
6161 int m_size;

Callers

nothing calls this directly

Calls 5

findChildMethod · 0.80
addChildMethod · 0.80
completedCycleMethod · 0.80
tryOpenMethod · 0.80
isSectionTrackerMethod · 0.45

Tested by

no test coverage detected