1
0
Fork 0

use a single vector for all callback tokens

This commit is contained in:
Kevin Matz 2022-12-11 16:53:54 -05:00
parent b5f3e63b36
commit 27179b4e00
2 changed files with 3 additions and 5 deletions

View File

@ -107,9 +107,9 @@ std::shared_ptr<Universe> UniverseArbitrator::addNewSource(const DATA::data_head
if (!ok)
return nullptr;
auto univ = itr->second;
source_data_tokens.push_back(univ->onDataChange(
cb_tokens_.push_back(univ->onDataChange(
std::bind(&sACN::UniverseArbitrator::dataChangedNotifier, this, std::placeholders::_1)));
source_status_tokens.push_back(univ->onStatusChange(
cb_tokens_.push_back(univ->onStatusChange(
std::bind(&sACN::UniverseArbitrator::doStatusCallbacks, this)));
}

View File

@ -92,11 +92,9 @@ protected:
private:
std::unordered_map<DATA::data_header, std::shared_ptr<Universe>> sources_;
std::vector<std::shared_ptr<void>> source_data_tokens; //!< source universe data change tokens
std::vector<std::shared_ptr<void>> cb_tokens_; //!< source universe callback tokens
std::vector<std::weak_ptr<std::function<void()>>> cb_sourceListChange; //!< list of calback functions
std::vector<std::shared_ptr<void>> source_status_tokens; //!< source universe data change tokens
bool hold_last_look_;
std::shared_ptr<Universe> dominant_() const;