KiCad PCB EDA Suite
Loading...
Searching...
No Matches
KI_TEST::ALLEGRO_CACHED_LOADER Class Reference

Singleton class to load Allegro boards and cache them in memory, to avoid repeatedly loading and parsing the same board files for multiple tests. More...

#include <allegro_test_utils.h>

Inheritance diagram for KI_TEST::ALLEGRO_CACHED_LOADER:
KI_TEST::CACHED_BOARD_LOADER

Public Member Functions

 ~ALLEGRO_CACHED_LOADER ()
 
BOARDLoadAndCache (const std::string &aFilePath, REPORTER *aReporter)
 Load (or reload) board for the given file path and send the load messages to the given reporter.
 
BOARDGetCachedBoard (const std::string &aFilePath)
 Get a cached board for the given file path, or load it if not already cached, without forcing a reload.
 

Static Public Member Functions

static ALLEGRO_CACHED_LOADERGetInstance ()
 Get the singleton instance of the Allegro board cache loader.
 

Protected Member Functions

BOARDgetCachedBoard (const std::string &aFilePath, bool aForceReload, REPORTER *aReporter) override
 Implementation of CACHED_BOARD_LOADER interface with our Allegro PCB_IO plugin.
 
BOARDgetCachedBoard (PCB_IO &aIoPlugin, const std::string &aFilePath, bool aForceReload, REPORTER *aReporter)
 

Private Member Functions

 ALLEGRO_CACHED_LOADER ()
 

Private Attributes

std::unique_ptr< PCB_IO_ALLEGROm_allegroPlugin
 
std::map< std::string, std::unique_ptr< BOARD > > m_boardCache
 

Detailed Description

Singleton class to load Allegro boards and cache them in memory, to avoid repeatedly loading and parsing the same board files for multiple tests.

Definition at line 34 of file allegro_test_utils.h.

Constructor & Destructor Documentation

◆ ~ALLEGRO_CACHED_LOADER()

KI_TEST::ALLEGRO_CACHED_LOADER::~ALLEGRO_CACHED_LOADER ( )

Definition at line 68 of file allegro_test_utils.cpp.

◆ ALLEGRO_CACHED_LOADER()

KI_TEST::ALLEGRO_CACHED_LOADER::ALLEGRO_CACHED_LOADER ( )
private

Definition at line 62 of file allegro_test_utils.cpp.

References m_allegroPlugin.

Referenced by GetInstance().

Member Function Documentation

◆ GetCachedBoard()

BOARD * KI_TEST::CACHED_BOARD_LOADER::GetCachedBoard ( const std::string & aFilePath)
inherited

Get a cached board for the given file path, or load it if not already cached, without forcing a reload.

Definition at line 877 of file board_test_utils.cpp.

References getCachedBoard().

Referenced by ALLEGRO_COMPREHENSIVE_FIXTURE::GetCachedBoard(), and RunBoardExpectations().

◆ getCachedBoard() [1/2]

BOARD * KI_TEST::ALLEGRO_CACHED_LOADER::getCachedBoard ( const std::string & aFilePath,
bool aForceReload,
REPORTER * aReporter )
overrideprotectedvirtual

Implementation of CACHED_BOARD_LOADER interface with our Allegro PCB_IO plugin.

Implements KI_TEST::CACHED_BOARD_LOADER.

Definition at line 80 of file allegro_test_utils.cpp.

References KI_TEST::CACHED_BOARD_LOADER::getCachedBoard(), and m_allegroPlugin.

◆ getCachedBoard() [2/2]

BOARD * KI_TEST::CACHED_BOARD_LOADER::getCachedBoard ( PCB_IO & aIoPlugin,
const std::string & aFilePath,
bool aForceReload,
REPORTER * aReporter )
protectedinherited

◆ GetInstance()

KI_TEST::ALLEGRO_CACHED_LOADER & KI_TEST::ALLEGRO_CACHED_LOADER::GetInstance ( )
static

Get the singleton instance of the Allegro board cache loader.

Definition at line 73 of file allegro_test_utils.cpp.

References ALLEGRO_CACHED_LOADER().

Referenced by ALLEGRO_COMPREHENSIVE_FIXTURE::GetCachedBoard(), RunBoardExpectations(), and RunBoardLoad().

◆ LoadAndCache()

BOARD * KI_TEST::CACHED_BOARD_LOADER::LoadAndCache ( const std::string & aFilePath,
REPORTER * aReporter )
inherited

Load (or reload) board for the given file path and send the load messages to the given reporter.

Parameters
aFilePaththe file path to load
aReporterthe reporter to capture load messages, or nullptr to ignore messages
Returns
a pointer to the cached board, or nullptr if loading failed

Definition at line 883 of file board_test_utils.cpp.

References getCachedBoard().

Referenced by RunBoardLoad().

Member Data Documentation

◆ m_allegroPlugin

std::unique_ptr<PCB_IO_ALLEGRO> KI_TEST::ALLEGRO_CACHED_LOADER::m_allegroPlugin
private

Definition at line 53 of file allegro_test_utils.h.

Referenced by ALLEGRO_CACHED_LOADER(), and getCachedBoard().

◆ m_boardCache

std::map<std::string, std::unique_ptr<BOARD> > KI_TEST::CACHED_BOARD_LOADER::m_boardCache
privateinherited

Definition at line 347 of file board_test_utils.h.

Referenced by getCachedBoard().


The documentation for this class was generated from the following files: