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

◆ remove_by_type()

template<typename OpClass >
size_t MayaFlux::Yantra::OperationPool::remove_by_type ( )
inline

Remove all operations of a specific type.

Template Parameters
OpClassOperation class type to remove
Returns
Number of operations removed

Definition at line 209 of file OperationPool.hpp.

210 {
211 std::unique_lock lock(m_mutex);
212
213 std::type_index target_type(typeid(OpClass));
214 std::vector<std::string> to_remove;
215
216 for (const auto& [name, info] : m_info) {
217 if (info.type == target_type) {
218 to_remove.push_back(name);
219 }
220 }
221
222 for (const auto& name : to_remove) {
223 m_operations.erase(name);
224 m_info.erase(name);
225
227 m_on_remove_callback(name, target_type);
228 }
229 }
230
231 return to_remove.size();
232 }
std::unordered_map< std::string, PooledOperationInfo > m_info
std::unordered_map< std::string, OperationPtr > m_operations
std::function< void(const std::string &, std::type_index)> m_on_remove_callback

References m_info, m_mutex, m_on_remove_callback, and m_operations.