#include #include #include test::DRC_TEST_PROVIDER::DRC_TEST_PROVIDER() : m_drcEngine( nullptr ), m_enable( false ) { } void test::DRC_TEST_PROVIDER::Enable( bool enable ) { m_enable = enable; } bool test::DRC_TEST_PROVIDER::IsEnabled() const { return m_enable; } const wxString test::DRC_TEST_PROVIDER::GetName() const { return ""; } const wxString test::DRC_TEST_PROVIDER::GetDescription() const { return ""; } void test::DRC_TEST_PROVIDER::Report( DRC_ITEM* item ) { item->SetViolatingTest( this ); m_drcEngine->Report( item, nullptr ); } void test::DRC_TEST_PROVIDER::ReportWithMarker( DRC_ITEM* item, VECTOR2I aMarkerPos ) { item->SetViolatingTest( this ); m_drcEngine->Report( item, nullptr ); // fixme: create marker } void test::DRC_TEST_PROVIDER::ReportWithMarker( DRC_ITEM* item, wxPoint aMarkerPos ) { item->SetViolatingTest( this ); m_drcEngine->Report( item, nullptr ); // fixme: create marker } void test::DRC_TEST_PROVIDER::ReportProgress( double aProgress ) { m_drcEngine->ReportProgress( aProgress ); } void test::DRC_TEST_PROVIDER::ReportStage ( const wxString& aStageName, int index, int total ) { m_drcEngine->ReportStage( aStageName, index, total ); ReportAux( aStageName ); } void test::DRC_TEST_PROVIDER::ReportAux( const wxString fmt, ... ) { va_list vargs; va_start( vargs, fmt ); wxString str; str.PrintfV( fmt, vargs ); va_end( vargs ); m_drcEngine->ReportAux( str ); } bool test::DRC_TEST_PROVIDER::isErrorLimitExceeded( int error_code ) { // fixme: implement error limit (or timeout) return false; } EDA_UNITS test::DRC_TEST_PROVIDER::userUnits() const { return m_drcEngine->UserUnits(); } void test::DRC_TEST_PROVIDER::accountCheck( test::DRC_RULE* ruleToTest ) { auto it = m_stats.find( ruleToTest ); if( it == m_stats.end() ) m_stats[ ruleToTest ] = 1; else it->second++; } void test::DRC_TEST_PROVIDER::reportRuleStatistics() { m_drcEngine->ReportAux("Rule hit statistics: "); for( auto stat : m_stats ) { m_drcEngine->ReportAux( wxString::Format( " - rule '%s': %d hits ", stat.first->GetName().c_str(), stat.second ) ); } }