diff options
author | Jens Lorenz <jlorenz@de.adit-jv.com> | 2015-07-31 10:48:39 +0200 |
---|---|---|
committer | Christian Linke <christian.linke@bmw.de> | 2015-08-04 13:15:39 +0100 |
commit | d269c3c9681739189780bbf95de89dc3edfab347 (patch) | |
tree | 95d7c50a934a34ba5cbf43940aae05345231ee17 /AudioManagerDaemon/include/CAmDatabaseHandlerMap.h | |
parent | 63efb86fd9273828d3792c0e0c66e32bbeee617b (diff) | |
download | audiomanager-d269c3c9681739189780bbf95de89dc3edfab347.tar.gz |
Implemented filtering of duplicated notification configuration types on registration of source and sink elements
Signed-off-by: Jens Lorenz <jlorenz@de.adit-jv.com>
Diffstat (limited to 'AudioManagerDaemon/include/CAmDatabaseHandlerMap.h')
-rw-r--r-- | AudioManagerDaemon/include/CAmDatabaseHandlerMap.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/AudioManagerDaemon/include/CAmDatabaseHandlerMap.h b/AudioManagerDaemon/include/CAmDatabaseHandlerMap.h index bd2df16..e0faa38 100644 --- a/AudioManagerDaemon/include/CAmDatabaseHandlerMap.h +++ b/AudioManagerDaemon/include/CAmDatabaseHandlerMap.h @@ -448,7 +448,23 @@ public: return std::find_if(mMappedData.mConnectionMap.begin(), mMappedData.mConnectionMap.end(),[&](const std::pair<am_connectionID_t, am_Connection_Database_s>& rConnection){ return (rConnection.second.sinkID == comp.sinkID ||rConnection.second.sourceID ==comp.sourceID);})!=mMappedData.mConnectionMap.end(); } - + void filterDuplicateNotificationConfigurationTypes(std::vector<am_NotificationConfiguration_s> & list) + { + std::vector<am_NotificationConfiguration_s> oldList(list); + list.clear(); + std::for_each(oldList.begin(), oldList.end(), [&](am_NotificationConfiguration_s & provided) { + std::vector<am_NotificationConfiguration_s>::iterator found = + std::find_if(list.begin(), list.end(), [&](am_NotificationConfiguration_s & stored) { + if (provided.type == stored.type) { + stored = provided; + return true; + } + return false; + } ); + if (found == list.end()) + list.push_back(provided); + } ); + } CAmDatabaseObserver *mpDatabaseObserver; //!< pointer to the Observer ListConnectionFormat mListConnectionFormat; //!< list of connection formats |