From b3075389aa61c019fdb5d904abab84532f178250 Mon Sep 17 00:00:00 2001 From: Jens Lorenz Date: Tue, 14 Mar 2017 08:57:55 +0100 Subject: 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 --- AudioManagerCore/include/CAmDatabaseHandlerMap.h | 9 ++++--- 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 bool getNextConnectionID(int16_t & resultID, AmIdentifier & sourceID, + template bool getNextConnectionID(int16_t & resultID, AmIdentifier & connID, const std::unordered_map & 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 bool CAmDatabaseHandlerMap::AmMappedData::getNextConnectionID(int16_t & resultID, AmIdentifier & sourceID, +template bool CAmDatabaseHandlerMap::AmMappedData::getNextConnectionID(int16_t & resultID, AmIdentifier & connID, const std::unordered_map & 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; -- cgit v1.2.1