KiCad PCB EDA Suite
Loading...
Searching...
No Matches
KI_TEST::CACHED_BOARD_LOADER Class Referenceabstract

Manager for caching loaded boards in memory, to avoid repeatedly loading and parsing the same board. More...

#include <board_test_utils.h>

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

Public Member Functions

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.
 

Protected Member Functions

BOARDgetCachedBoard (PCB_IO &aIoPlugin, const std::string &aFilePath, bool aForceReload, REPORTER *aReporter)
 
virtual BOARDgetCachedBoard (const std::string &aFilePath, bool aForceReload, REPORTER *aReporter)=0
 Implementation of the board loader (probably plug in the PCB_IO plugin here)
 

Private Attributes

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

Detailed Description

Manager for caching loaded boards in memory, to avoid repeatedly loading and parsing the same board.

Generally, you might want to use a singleton instance of this class for each PCB_IO plugin.

This class can learn additional features such as load profiling, or cache eviction policies.

Definition at line 320 of file board_test_utils.h.

Member Function Documentation

◆ GetCachedBoard()

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

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]

virtual BOARD * KI_TEST::CACHED_BOARD_LOADER::getCachedBoard ( const std::string & aFilePath,
bool aForceReload,
REPORTER * aReporter )
protectedpure virtual

Implementation of the board loader (probably plug in the PCB_IO plugin here)

Implemented in KI_TEST::ALLEGRO_CACHED_LOADER.

◆ getCachedBoard() [2/2]

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

◆ LoadAndCache()

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

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_boardCache

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

Definition at line 347 of file board_test_utils.h.

Referenced by getCachedBoard().


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