diff --git a/src/common/lookups/TalkgroupRulesLookup.cpp b/src/common/lookups/TalkgroupRulesLookup.cpp index b19ba67f..2cbac3e5 100644 --- a/src/common/lookups/TalkgroupRulesLookup.cpp +++ b/src/common/lookups/TalkgroupRulesLookup.cpp @@ -58,9 +58,9 @@ TalkgroupRulesLookup::TalkgroupRulesLookup(const std::string& filename, uint32_t m_acl(acl), m_stop(false), m_verbose(verbose), + m_groupVoice(), m_groupHangTime(5U), - m_sendTalkgroups(false), - m_groupVoice() + m_sendTalkgroups(false) { /* stub */ } @@ -308,6 +308,22 @@ bool TalkgroupRulesLookup::getACL() return m_acl; } +/* Gets a snapshot of the group voice rules. */ + +std::vector TalkgroupRulesLookup::groupVoice() const +{ + std::lock_guard lock(s_mutex); + return m_groupVoice; +} + +/* Replaces the group voice rules. */ + +void TalkgroupRulesLookup::groupVoice(std::vector val) +{ + std::lock_guard lock(s_mutex); + m_groupVoice = val; +} + // --------------------------------------------------------------------------- // Private Class Members // --------------------------------------------------------------------------- diff --git a/src/common/lookups/TalkgroupRulesLookup.h b/src/common/lookups/TalkgroupRulesLookup.h index f98d8858..32d7c7ce 100644 --- a/src/common/lookups/TalkgroupRulesLookup.h +++ b/src/common/lookups/TalkgroupRulesLookup.h @@ -641,6 +641,17 @@ namespace lookups */ bool getACL(); + /** + * @brief Gets a snapshot of the group voice rules. + * @return List of group voice rules. + */ + std::vector groupVoice() const; + /** + * @brief Replaces the group voice rules. + * @param[in] val List of group voice rules. + */ + void groupVoice(std::vector val); + /** * @brief Returns the filename used to load this lookup table. * @return std::string Full-path to the lookup table file. @@ -676,6 +687,8 @@ namespace lookups bool m_verbose; + std::vector m_groupVoice; + static std::mutex s_mutex; //!< Mutex used for change locking. static bool s_locked; //!< Flag used for read locking (prevents find lookups), should be used when atomic operations (add/erase/etc) are being used. @@ -700,10 +713,6 @@ namespace lookups * @brief Flag indicating whether or not the network layer should send the talkgroups to peers. */ DECLARE_PROPERTY_PLAIN(bool, sendTalkgroups); - /** - * @brief List of group voice rules. - */ - DECLARE_PROPERTY_PLAIN(std::vector, groupVoice); }; } // namespace lookups