MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ shutdown()

void MayaFlux::Core::SerialInputBackend::shutdown ( )
overridevirtual

Shutdown and release all resources.

Closes all devices and releases backend resources. After this call, initialize() must be called again to use the backend.

Implements MayaFlux::Core::IInputBackend.

Definition at line 106 of file SerialInputBackend.cpp.

107{
108 if (!m_initialized.load()) {
109 return;
110 }
111
112 stop();
113
114 std::vector<std::shared_ptr<SerialDevice>> open;
115 if (const auto roster = m_roster.read()) {
116 for (const auto& [id, entry] : roster->entries) {
117 if (entry.device) {
118 open.push_back(entry.device);
119 }
120 }
121 }
122 m_roster.reset();
123 {
124 std::lock_guard lock(m_reader_mutex);
125 m_records.clear();
126 }
127
128 for (const auto& device : open) {
129 device->close();
130 }
131
132 m_initialized.store(false);
133}
std::vector< ReaderRecord > m_records
Memory::SnapshotCell< Roster > m_roster
void stop() override
Stop listening for input events.
void open(std::span< const float > mask, std::span< float > tmp, std::span< float > dst, uint32_t w, uint32_t h, uint32_t radius)
Morphological opening writing into dst.

References m_initialized, m_reader_mutex, m_records, m_roster, and stop().

Referenced by operator=(), and ~SerialInputBackend().

Here is the call graph for this function:
Here is the caller graph for this function: