|
KiCad PCB EDA Suite
|
Single-slot import queue shared by every native preview front end. More...
#include <model_import_queue.h>
Classes | |
| struct | STATE |
Public Types | |
| using | COMPLETION = std::function<void( std::uint64_t aGeneration, MODEL_IMPORT_RESULT aResult )> |
Public Member Functions | |
| MODEL_IMPORT_QUEUE () | |
| ~MODEL_IMPORT_QUEUE () | |
| MODEL_IMPORT_QUEUE (const MODEL_IMPORT_QUEUE &)=delete | |
| MODEL_IMPORT_QUEUE & | operator= (const MODEL_IMPORT_QUEUE &)=delete |
| std::uint64_t | Submit (std::string aFileName, const MODEL_IMPORT_OPTIONS &aOptions, COMPLETION aCompletion) |
| Supersede any pending or running request with aFileName. | |
| void | Cancel () |
| Abandon the pending and running requests without stopping the worker. | |
| void | Shutdown () |
| Abandon everything and join the worker. | |
| std::uint64_t | CurrentGeneration () const |
| The generation of the most recent Submit(), for hosts that track staleness themselves. | |
Private Attributes | |
| std::shared_ptr< STATE > | m_state |
Single-slot import queue shared by every native preview front end.
A preview host asks for whichever file the user is pointing at now, so only the newest request matters. Submit() therefore cancels the running import and replaces anything still queued, and each request carries a generation the host uses to drop results that arrived too late.
The completion runs on the worker thread. Hosts marshal it to their own loop, because nothing here may depend on wxWidgets, the Win32 message loop or Grand Central Dispatch.
Definition at line 43 of file model_import_queue.h.
| using S3D::MODEL_IMPORT_QUEUE::COMPLETION = std::function<void( std::uint64_t aGeneration, MODEL_IMPORT_RESULT aResult )> |
Definition at line 46 of file model_import_queue.h.
| S3D::MODEL_IMPORT_QUEUE::MODEL_IMPORT_QUEUE | ( | ) |
Definition at line 188 of file model_import_queue.cpp.
References m_state.
Referenced by MODEL_IMPORT_QUEUE(), and operator=().
| S3D::MODEL_IMPORT_QUEUE::~MODEL_IMPORT_QUEUE | ( | ) |
Definition at line 194 of file model_import_queue.cpp.
References Shutdown().
|
delete |
References MODEL_IMPORT_QUEUE().
| void S3D::MODEL_IMPORT_QUEUE::Cancel | ( | ) |
Abandon the pending and running requests without stopping the worker.
Definition at line 207 of file model_import_queue.cpp.
References m_state.
Referenced by operator=().
| std::uint64_t S3D::MODEL_IMPORT_QUEUE::CurrentGeneration | ( | ) | const |
The generation of the most recent Submit(), for hosts that track staleness themselves.
Definition at line 219 of file model_import_queue.cpp.
References m_state.
Referenced by operator=().
|
delete |
References Cancel(), CurrentGeneration(), MODEL_IMPORT_QUEUE(), Shutdown(), and Submit().
| void S3D::MODEL_IMPORT_QUEUE::Shutdown | ( | ) |
Abandon everything and join the worker.
Safe to call more than once, and called by the destructor. Must not be called from a completion.
Definition at line 213 of file model_import_queue.cpp.
References m_state.
Referenced by operator=(), and ~MODEL_IMPORT_QUEUE().
| std::uint64_t S3D::MODEL_IMPORT_QUEUE::Submit | ( | std::string | aFileName, |
| const MODEL_IMPORT_OPTIONS & | aOptions, | ||
| COMPLETION | aCompletion ) |
Supersede any pending or running request with aFileName.
Definition at line 200 of file model_import_queue.cpp.
References m_state.
Referenced by operator=().
|
private |
Definition at line 80 of file model_import_queue.h.
Referenced by Cancel(), CurrentGeneration(), MODEL_IMPORT_QUEUE(), Shutdown(), and Submit().