KiCad PCB EDA Suite
Loading...
Searching...
No Matches
S3D::MODEL_IMPORT_QUEUE Class Reference

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
 

Detailed Description

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.

Member Typedef Documentation

◆ COMPLETION

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.

Constructor & Destructor Documentation

◆ MODEL_IMPORT_QUEUE() [1/2]

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=().

◆ ~MODEL_IMPORT_QUEUE()

S3D::MODEL_IMPORT_QUEUE::~MODEL_IMPORT_QUEUE ( )

Definition at line 194 of file model_import_queue.cpp.

References Shutdown().

◆ MODEL_IMPORT_QUEUE() [2/2]

S3D::MODEL_IMPORT_QUEUE::MODEL_IMPORT_QUEUE ( const MODEL_IMPORT_QUEUE & )
delete

References MODEL_IMPORT_QUEUE().

Member Function Documentation

◆ Cancel()

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=().

◆ CurrentGeneration()

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=().

◆ operator=()

MODEL_IMPORT_QUEUE & S3D::MODEL_IMPORT_QUEUE::operator= ( const MODEL_IMPORT_QUEUE & )
delete

◆ Shutdown()

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().

◆ Submit()

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.

Returns
the generation stamped on the new request, or 0 once the queue has been shut down.

Definition at line 200 of file model_import_queue.cpp.

References m_state.

Referenced by operator=().

Member Data Documentation

◆ m_state

std::shared_ptr<STATE> S3D::MODEL_IMPORT_QUEUE::m_state
private

Definition at line 80 of file model_import_queue.h.

Referenced by Cancel(), CurrentGeneration(), MODEL_IMPORT_QUEUE(), Shutdown(), and Submit().


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