Motion Master 6.0.0-alpha.86
Next-generation motion control software
Loading...
Searching...
No Matches
mm::node::DeviceHandle Class Reference

One device, plus the set that keeps it alive. More...

#include <device_manager.h>

Public Member Functions

 DeviceHandle ()=default
 
 DeviceHandle (std::shared_ptr< DeviceSet > set, Device *device)
 
 operator bool () const
 Whether a device was found.
 
Deviceoperator* () const
 
Deviceoperator-> () const
 
Deviceget () const
 The device, or nullptr. For a caller that must pass it on as a pointer.
 

Detailed Description

One device, plus the set that keeps it alive.

What DeviceManager::deviceAt hands back. The handle is the lifetime: while you hold it, the Device it names stays constructed and its parameter map stays put, whatever scan or reset do meanwhile. A bare deviceSet()->find(pos) would dangle the moment the temporary set pointer died, which is the mistake this type exists to make unwritable.

Falsy when the position resolved to no device. Dereferencing then is undefined, exactly as for a null pointer.

Constructor & Destructor Documentation

◆ DeviceHandle() [1/2]

mm::node::DeviceHandle::DeviceHandle ( )
default

◆ DeviceHandle() [2/2]

mm::node::DeviceHandle::DeviceHandle ( std::shared_ptr< DeviceSet set,
Device device 
)
inline

Member Function Documentation

◆ get()

Device * mm::node::DeviceHandle::get ( ) const
inline

The device, or nullptr. For a caller that must pass it on as a pointer.

◆ operator bool()

mm::node::DeviceHandle::operator bool ( ) const
inlineexplicit

Whether a device was found.

◆ operator*()

Device & mm::node::DeviceHandle::operator* ( ) const
inline

◆ operator->()

Device * mm::node::DeviceHandle::operator-> ( ) const
inline

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