diff options
author | Jens Lorenz <jlorenz@de.adit-jv.com> | 2017-03-14 08:57:55 +0100 |
---|---|---|
committer | Jens Lorenz <jlorenz@de.adit-jv.com> | 2017-04-11 21:35:42 +0200 |
commit | b3075389aa61c019fdb5d904abab84532f178250 (patch) | |
tree | 106743918481ff3f88a34b33ea7d33e3cdcb8336 | |
parent | 71eab93f9cd67b2e0343700552adf988c420f174 (diff) | |
download | audiomanager-b3075389aa61c019fdb5d904abab84532f178250.tar.gz |
AMCore: Fix parameter names of increaseID & getNextConnectionID
The functions are used in a generic way which should be covered by the parameter names.
Signed-off-by: Jens Lorenz <jlorenz@de.adit-jv.com>
-rw-r--r-- | AudioManagerCore/include/CAmDatabaseHandlerMap.h | 9 | ||||
-rw-r--r-- | AudioManagerCore/src/CAmDatabaseHandlerMap.cpp | 30 |
2 files changed, 19 insertions, 20 deletions
diff --git a/AudioManagerCore/include/CAmDatabaseHandlerMap.h b/AudioManagerCore/include/CAmDatabaseHandlerMap.h index 3909b05..3686027 100644 --- a/AudioManagerCore/include/CAmDatabaseHandlerMap.h +++ b/AudioManagerCore/include/CAmDatabaseHandlerMap.h @@ -442,13 +442,12 @@ private: * A common method implementing the logic for static and dynamic IDs except main connection ID. * * @param resultID Pointer to an output variable. - * @param sourceID Pointer to ID, which will be manipulated. + * @param elementID Pointer to ID, which will be manipulated. * @param desiredStaticID Not 0 for static IDs and 0 for dynamic IDs. - * Usually the static IDs are in interval [1 , DYNAMIC_ID_BOUNDARY]. Default is 0. - * @param preferedStaticIDBoundary A limit for a given dynamic ID. Default is DYNAMIC_ID_BOUNDARY. + * Usually the static IDs are in interval [1 , DYNAMIC_ID_BOUNDARY-1]. Default is 0. * @return TRUE on successfully changed ID. */ - bool increaseID(int16_t & resultID, AmIdentifier & sourceID, int16_t const desiredStaticID); + bool increaseID(int16_t & resultID, AmIdentifier & elementID, int16_t const desiredStaticID); /** * \brief Increases the main connection ID. * @@ -478,7 +477,7 @@ private: AmMappedData::print(iter->second, output); } private: - template <typename TMapKey,class TMapObject> bool getNextConnectionID(int16_t & resultID, AmIdentifier & sourceID, + template <typename TMapKey,class TMapObject> bool getNextConnectionID(int16_t & resultID, AmIdentifier & connID, const std::unordered_map<TMapKey, TMapObject> & map); }; diff --git a/AudioManagerCore/src/CAmDatabaseHandlerMap.cpp b/AudioManagerCore/src/CAmDatabaseHandlerMap.cpp index 83419b9..d398a1e 100644 --- a/AudioManagerCore/src/CAmDatabaseHandlerMap.cpp +++ b/AudioManagerCore/src/CAmDatabaseHandlerMap.cpp @@ -384,17 +384,17 @@ void CAmDatabaseHandlerMap::AmCrossfader::getDescription (std::string & outStrin outString = fmt.str(); } -bool CAmDatabaseHandlerMap::AmMappedData::increaseID(int16_t & resultID, AmIdentifier & sourceID, +bool CAmDatabaseHandlerMap::AmMappedData::increaseID(int16_t & resultID, AmIdentifier & elementID, int16_t const desiredStaticID = 0) { - if( desiredStaticID > 0 && desiredStaticID < sourceID.mMin ) + if( desiredStaticID > 0 && desiredStaticID < elementID.mMin ) { resultID = desiredStaticID; return true; } - else if( sourceID.mCurrentValue < sourceID.mMax ) //The last used value is 'limit' - 1. e.g. SHRT_MAX - 1, SHRT_MAX is reserved. + else if( elementID.mCurrentValue < elementID.mMax ) //The last used value is 'limit' - 1. e.g. SHRT_MAX - 1, SHRT_MAX is reserved. { - resultID = sourceID.mCurrentValue++; + resultID = elementID.mCurrentValue++; return true; } else @@ -402,31 +402,31 @@ bool CAmDatabaseHandlerMap::AmMappedData::increaseID(int16_t & resultID, AmIdent resultID = -1; return false; } - } +} -template <typename TMapKey,class TMapObject> bool CAmDatabaseHandlerMap::AmMappedData::getNextConnectionID(int16_t & resultID, AmIdentifier & sourceID, +template <typename TMapKey,class TMapObject> bool CAmDatabaseHandlerMap::AmMappedData::getNextConnectionID(int16_t & resultID, AmIdentifier & connID, const std::unordered_map<TMapKey, TMapObject> & map) { TMapKey nextID; - int16_t const lastID = sourceID.mCurrentValue; - if( sourceID.mCurrentValue < sourceID.mMax ) - nextID = sourceID.mCurrentValue++; + int16_t const lastID = connID.mCurrentValue; + if( connID.mCurrentValue < connID.mMax ) + nextID = connID.mCurrentValue++; else - nextID = sourceID.mCurrentValue = sourceID.mMin; + nextID = connID.mCurrentValue = connID.mMin; bool notFreeIDs = false; while( existsObjectWithKeyInMap(nextID, map) ) { - if( sourceID.mCurrentValue < sourceID.mMax ) - nextID = sourceID.mCurrentValue++; + if( connID.mCurrentValue < connID.mMax ) + nextID = connID.mCurrentValue++; else { - sourceID.mCurrentValue = sourceID.mMin; - nextID = sourceID.mCurrentValue++; + connID.mCurrentValue = connID.mMin; + nextID = connID.mCurrentValue; } - if( sourceID.mCurrentValue == lastID ) + if( connID.mCurrentValue == lastID ) { notFreeIDs = true; break; |