Implements a QObject belonging to a hardware adapter (derived from DynExp::HardwareAdapterBase) that operates in DynExpCore's worker thread, not in the main user interface thread. This is useful to move e.g. ethernet/serial communication operations from the user interface thread to a worker thread. After construction, QWorker instances have to be moved to the worker thread calling QWorker::MoveToWorkerThread().
More...
|
void | MoveToWorkerThread (DynExp::ItemIDType ID) |
| Moves the instance to DynExpCore's worker thread. Do not call from constructor since derived classes have not been instantiated yet in that case. This would prevent QObjects contained in derived classes to be also moved to the worker thread. More...
|
|
auto | GetOwner () const noexcept |
| Returns this worker instance's owner. More...
|
|
Implements a QObject belonging to a hardware adapter (derived from DynExp::HardwareAdapterBase) that operates in DynExpCore's worker thread, not in the main user interface thread. This is useful to move e.g. ethernet/serial communication operations from the user interface thread to a worker thread. After construction, QWorker instances have to be moved to the worker thread calling QWorker::MoveToWorkerThread().
Definition at line 326 of file QtUtil.h.
◆ OwnerPtrType
◆ QWorker()
Util::QWorker::QWorker |
( |
| ) |
|
|
protecteddefault |
◆ ~QWorker()
Util::QWorker::~QWorker |
( |
| ) |
|
|
protecteddefault |
◆ GetDynExpCore()
◆ GetOwner()
auto Util::QWorker::GetOwner |
( |
| ) |
const |
|
inlinenoexcept |
Returns this worker instance's owner.
- Returns
- Pointer to owning hardware adapter
Definition at line 349 of file QtUtil.h.
◆ MoveToWorkerThread()
Moves the instance to DynExpCore's worker thread. Do not call from constructor since derived classes have not been instantiated yet in that case. This would prevent QObjects contained in derived classes to be also moved to the worker thread.
- Parameters
-
ID | ID of the hardware adapter owning this worker instance |
Definition at line 272 of file QtUtil.cpp.
◆ SetOwner()
Sets the hardware adapter owning this worker instance.
- Parameters
-
Owner | Pointer to the hardware adapter owning this instance |
Definition at line 368 of file QtUtil.h.
◆ DynExp::DynExpCore
◆ HasBeenMovedToWorkerThread
bool Util::QWorker::HasBeenMovedToWorkerThread = false |
|
private |
Indicates whether the worker has already been moved to the worker thread.
Definition at line 370 of file QtUtil.h.
◆ Owner
Pointer to the hardware adapter owning this instance.
Definition at line 371 of file QtUtil.h.
The documentation for this class was generated from the following files: