MCPcopy Create free account
hub / github.com/apache/thrift / SectionTracker

Class SectionTracker

compiler/cpp/tests/catch/catch.hpp:6192–6244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6190 };
6191
6192 class SectionTracker : public TrackerBase {
6193 std::vector<std::string> m_filters;
6194 public:
6195 SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent )
6196 : TrackerBase( nameAndLocation, ctx, parent )
6197 {
6198 if( parent ) {
6199 while( !parent->isSectionTracker() )
6200 parent = &parent->parent();
6201
6202 SectionTracker& parentSection = static_cast<SectionTracker&>( *parent );
6203 addNextFilters( parentSection.m_filters );
6204 }
6205 }
6206 virtual ~SectionTracker();
6207
6208 virtual bool isSectionTracker() const CATCH_OVERRIDE { return true; }
6209
6210 static SectionTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ) {
6211 SectionTracker* section = CATCH_NULL;
6212
6213 ITracker& currentTracker = ctx.currentTracker();
6214 if( ITracker* childTracker = currentTracker.findChild( nameAndLocation ) ) {
6215 assert( childTracker );
6216 assert( childTracker->isSectionTracker() );
6217 section = static_cast<SectionTracker*>( childTracker );
6218 }
6219 else {
6220 section = new SectionTracker( nameAndLocation, ctx, &currentTracker );
6221 currentTracker.addChild( section );
6222 }
6223 if( !ctx.completedCycle() )
6224 section->tryOpen();
6225 return *section;
6226 }
6227
6228 void tryOpen() {
6229 if( !isComplete() && (m_filters.empty() || m_filters[0].empty() || m_filters[0] == m_nameAndLocation.name ) )
6230 open();
6231 }
6232
6233 void addInitialFilters( std::vector<std::string> const& filters ) {
6234 if( !filters.empty() ) {
6235 m_filters.push_back(""); // Root - should never be consulted
6236 m_filters.push_back(""); // Test Case - not a section filter
6237 m_filters.insert( m_filters.end(), filters.begin(), filters.end() );
6238 }
6239 }
6240 void addNextFilters( std::vector<std::string> const& filters ) {
6241 if( filters.size() > 1 )
6242 m_filters.insert( m_filters.end(), ++filters.begin(), filters.end() );
6243 }
6244 };
6245
6246 class IndexTracker : public TrackerBase {
6247 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