![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Stream/ThreadSafeInstruments.h>
Non-templated and fully abstract base class for ThreadSafeInstruments. More...
Non-templated and fully abstract base class for ThreadSafeInstruments.
This type is intended for the use in TrackingStream implementations.
Provides a basic interface to manage a set of TrackingInstruments in a thread-safe way.
Public Member Functions | |
virtual std::vector< TrackingInstrument > | instruments () const =0 |
Returns a vector of tracking instruments. | |
virtual std::optional< TrackingInstrument > | mainInstrument () const =0 |
Returns the main tracking instrument, if any. | |
virtual InstrumentUpdate | setMain (unsigned int index)=0 |
Sets the main tracking instrument by index. | |
virtual InstrumentUpdate | setMainById (const std::string &id)=0 |
Sets the main tracking instrument by tracking ID. | |
virtual unsigned int | mainIndex () const =0 |
Returns the index of the main tracking instrument. | |
virtual const std::string & | mainId () const =0 |
Returns the ID of the main tracking instrument. | |
virtual std::string | mainName () const =0 |
Returns the name of the main tracking instrument. | |
virtual void | setActive (const std::string &id, bool active)=0 |
Sets the active flag of an instrument. | |
virtual bool | isActive (const std::string &id) const =0 |
Returns whether a tracking instrument is active. | |
virtual InstrumentUpdate | create (TrackerID trackerID, bool active=true)=0 |
Creates a new instrument with the given TrackerID and active state. | |
virtual InstrumentUpdate | createWithPrefix (const std::string &prefix, const std::string &name, const std::string &modelNum="", bool active=true)=0 |
Creates a new instrument with the given name and optional model number and active state. | |
virtual InstrumentUpdate | remove (const std::string &id)=0 |
Removes the instrument with the given ID. | |
virtual InstrumentUpdate | clear ()=0 |
Clears the entire instrument list and resets the main instrument selection. | |
virtual InstrumentUpdate | prepareUpdate (unsigned long long timestamp)=0 |
Prepares a subsequent tracking update by setting the device timestamp, resetting the matrix to identity, and setting the quality and status flag to zero for all instruments. | |
virtual InstrumentUpdate | update (const std::string &id, mat4 matrix, double quality, unsigned long long timestamp=0, int statusFlags=0x0)=0 |
Updates the instrument with the specified ID to the new tracking matrix and quality, and an optional timestamp and status flag. | |
virtual InstrumentUpdate | modify (const std::string &id, const std::function< void(const std::string &, TrackingInstrument &)> &fun)=0 |
Accessor method to apply a function to a specific instrument with the given ID. | |
virtual InstrumentUpdate | modifyAll (const std::function< void(const std::string &, TrackingInstrument &)> &fun)=0 |
Accessor method to apply a function to all instruments. | |
virtual int | size () const =0 |
Returns the number of instruments. | |
virtual std::optional< TrackingInstrument > | find (const std::string &id) const =0 |
Finds a specific tracking instrument by ID. | |
|
pure virtual |
Returns a vector of tracking instruments.
Implemented in ThreadSafeInstruments< Special >, ThreadSafeInstruments< ImFusion::FakeTrackingStream::Device >, and ThreadSafeInstruments< ImFusion::NDITrackingInstrumentInfo >.
|
pure virtual |
Returns the main tracking instrument, if any.
Implemented in ThreadSafeInstruments< Special >, ThreadSafeInstruments< ImFusion::FakeTrackingStream::Device >, and ThreadSafeInstruments< ImFusion::NDITrackingInstrumentInfo >.
|
pure virtual |
Sets the main tracking instrument by index.
Implemented in ThreadSafeInstruments< Special >, ThreadSafeInstruments< ImFusion::FakeTrackingStream::Device >, and ThreadSafeInstruments< ImFusion::NDITrackingInstrumentInfo >.
|
pure virtual |
Sets the main tracking instrument by tracking ID.
Implemented in ThreadSafeInstruments< Special >, ThreadSafeInstruments< ImFusion::FakeTrackingStream::Device >, and ThreadSafeInstruments< ImFusion::NDITrackingInstrumentInfo >.
|
pure virtual |
Returns the index of the main tracking instrument.
Implemented in ThreadSafeInstruments< Special >, ThreadSafeInstruments< ImFusion::FakeTrackingStream::Device >, and ThreadSafeInstruments< ImFusion::NDITrackingInstrumentInfo >.
|
pure virtual |
Returns the ID of the main tracking instrument.
Implemented in ThreadSafeInstruments< Special >, ThreadSafeInstruments< ImFusion::FakeTrackingStream::Device >, and ThreadSafeInstruments< ImFusion::NDITrackingInstrumentInfo >.
|
pure virtual |
Returns the name of the main tracking instrument.
Implemented in ThreadSafeInstruments< Special >, ThreadSafeInstruments< ImFusion::FakeTrackingStream::Device >, and ThreadSafeInstruments< ImFusion::NDITrackingInstrumentInfo >.
|
pure virtual |
Sets the active flag of an instrument.
Implemented in ThreadSafeInstruments< Special >, ThreadSafeInstruments< ImFusion::FakeTrackingStream::Device >, and ThreadSafeInstruments< ImFusion::NDITrackingInstrumentInfo >.
|
pure virtual |
Returns whether a tracking instrument is active.
Implemented in ThreadSafeInstruments< Special >, ThreadSafeInstruments< ImFusion::FakeTrackingStream::Device >, and ThreadSafeInstruments< ImFusion::NDITrackingInstrumentInfo >.
|
pure virtual |
Creates a new instrument with the given TrackerID and active state.
Implemented in ThreadSafeInstruments< Special >, ThreadSafeInstruments< ImFusion::FakeTrackingStream::Device >, and ThreadSafeInstruments< ImFusion::NDITrackingInstrumentInfo >.
|
pure virtual |
Creates a new instrument with the given name and optional model number and active state.
Auto-assigns a new unique ID based on a tracking stream-specific prefix. It assigns an ID of the form "prefix-<number>" with the smallest available positive number.
Implemented in ThreadSafeInstruments< Special >, ThreadSafeInstruments< ImFusion::FakeTrackingStream::Device >, and ThreadSafeInstruments< ImFusion::NDITrackingInstrumentInfo >.
|
pure virtual |
Removes the instrument with the given ID.
Updates the main instrument to the first instrument in the list if the removed instrument was the main instrument.
Implemented in ThreadSafeInstruments< Special >, ThreadSafeInstruments< ImFusion::FakeTrackingStream::Device >, and ThreadSafeInstruments< ImFusion::NDITrackingInstrumentInfo >.
|
pure virtual |
Clears the entire instrument list and resets the main instrument selection.
The main instrument ID is reset to "".
Implemented in ThreadSafeInstruments< Special >, ThreadSafeInstruments< ImFusion::FakeTrackingStream::Device >, and ThreadSafeInstruments< ImFusion::NDITrackingInstrumentInfo >.
|
pure virtual |
Prepares a subsequent tracking update by setting the device timestamp, resetting the matrix to identity, and setting the quality and status flag to zero for all instruments.
This is a convenience method intended to be used when the stream's tracking update iterates over received tracking data, where we cannot be sure that all tracking instruments are included.
Implemented in ThreadSafeInstruments< Special >, ThreadSafeInstruments< ImFusion::FakeTrackingStream::Device >, and ThreadSafeInstruments< ImFusion::NDITrackingInstrumentInfo >.
|
pure virtual |
Updates the instrument with the specified ID to the new tracking matrix and quality, and an optional timestamp and status flag.
Implemented in ThreadSafeInstruments< Special >, ThreadSafeInstruments< ImFusion::FakeTrackingStream::Device >, and ThreadSafeInstruments< ImFusion::NDITrackingInstrumentInfo >.
|
pure virtual |
Accessor method to apply a function to a specific instrument with the given ID.
Calls fun(id, ti)
on the TrackingInstrument ti
that has the identifier id
. This method allows modification of the members of the TrackingInstrument beyond the provided default methods (e.g., update, prepareUpdate, setActive, etc.).
Example usage in a tracking stream class:
Implemented in ThreadSafeInstruments< Special >, ThreadSafeInstruments< ImFusion::FakeTrackingStream::Device >, and ThreadSafeInstruments< ImFusion::NDITrackingInstrumentInfo >.
|
pure virtual |
Accessor method to apply a function to all instruments.
Calls fun(id, ti)
on all the TrackingInstruments ti
with identifier id
.
Example usage in a tracking stream class:
Implemented in ThreadSafeInstruments< Special >, ThreadSafeInstruments< ImFusion::FakeTrackingStream::Device >, and ThreadSafeInstruments< ImFusion::NDITrackingInstrumentInfo >.
|
pure virtual |
Returns the number of instruments.
Implemented in ThreadSafeInstruments< Special >, ThreadSafeInstruments< ImFusion::FakeTrackingStream::Device >, and ThreadSafeInstruments< ImFusion::NDITrackingInstrumentInfo >.
|
pure virtual |
Finds a specific tracking instrument by ID.
Implemented in ThreadSafeInstruments< Special >, ThreadSafeInstruments< ImFusion::FakeTrackingStream::Device >, and ThreadSafeInstruments< ImFusion::NDITrackingInstrumentInfo >.