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

◆ remove_if()

size_t MayaFlux::Yantra::OperationPool::remove_if ( const NamePredicate predicate)
inline

Remove operations matching a predicate.

Parameters
predicateFunction to test each name
Returns
Number of operations removed

Definition at line 486 of file OperationPool.hpp.

487 {
488 std::unique_lock lock(m_mutex);
489
490 std::vector<std::string> to_remove;
491
492 for (const auto& [name, _] : m_operations) {
493 if (predicate(name)) {
494 to_remove.push_back(name);
495 }
496 }
497
498 for (const auto& name : to_remove) {
499 auto type = m_info[name].type;
500 m_operations.erase(name);
501 m_info.erase(name);
502
504 m_on_remove_callback(name, type);
505 }
506 }
507
508 return to_remove.size();
509 }
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.