diff options
| author | David Turner <digit@android.com> | 2011-05-19 03:42:23 -0700 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2011-05-19 03:42:23 -0700 |
| commit | e11d8abc254f55fe579fa09885188777284f1c1d (patch) | |
| tree | dd9d7e30f5c9dba45ab0201bfec36f58adc506d0 | |
| parent | 45398e0b8f049db30c015a70af17fc61d8030412 (diff) | |
| parent | d143387d72e502d5d00ce12163edc40fcfaf9d2d (diff) | |
| download | android_development-e11d8abc254f55fe579fa09885188777284f1c1d.tar.gz android_development-e11d8abc254f55fe579fa09885188777284f1c1d.tar.bz2 android_development-e11d8abc254f55fe579fa09885188777284f1c1d.zip | |
am d143387d: am 1c53e616: am fd6ed4dd: Merge "adding functionality to get the local name of an object from it\'s local name"
* commit 'd143387d72e502d5d00ce12163edc40fcfaf9d2d':
adding functionality to get the local name of an object from it's local name
| -rw-r--r-- | tools/emulator/opengl/host/libs/Translator/GLcommon/objectNameManager.cpp | 26 | ||||
| -rw-r--r-- | tools/emulator/opengl/host/libs/Translator/include/GLcommon/objectNameManager.h | 12 |
2 files changed, 38 insertions, 0 deletions
diff --git a/tools/emulator/opengl/host/libs/Translator/GLcommon/objectNameManager.cpp b/tools/emulator/opengl/host/libs/Translator/GLcommon/objectNameManager.cpp index d49849888..32f97c26a 100644 --- a/tools/emulator/opengl/host/libs/Translator/GLcommon/objectNameManager.cpp +++ b/tools/emulator/opengl/host/libs/Translator/GLcommon/objectNameManager.cpp @@ -112,6 +112,20 @@ NameSpace::getGlobalName(unsigned int p_localName) return 0; } +unsigned int +NameSpace::getLocalName(unsigned int p_globalName) +{ + for(NamesMap::iterator it = m_localToGlobalMap.begin(); it != m_localToGlobalMap.end();it++){ + if((*it).second == p_globalName){ + // object found - return its local name + return (*it).first; + } + } + + // object does not exist; + return 0; +} + void NameSpace::deleteName(unsigned int p_localName) { @@ -190,6 +204,18 @@ ShareGroup::getGlobalName(NamedObjectType p_type, unsigned int p_localName) return globalName; } +unsigned int +ShareGroup::getLocalName(NamedObjectType p_type, unsigned int p_globalName) +{ + if (p_type >= NUM_OBJECT_TYPES) return 0; + + mutex_lock(&m_lock); + unsigned int localName = m_nameSpace[p_type]->getLocalName(p_globalName); + mutex_unlock(&m_lock); + + return localName; +} + void ShareGroup::deleteName(NamedObjectType p_type, unsigned int p_localName) { diff --git a/tools/emulator/opengl/host/libs/Translator/include/GLcommon/objectNameManager.h b/tools/emulator/opengl/host/libs/Translator/include/GLcommon/objectNameManager.h index ea6afc036..2afc4bcb0 100644 --- a/tools/emulator/opengl/host/libs/Translator/include/GLcommon/objectNameManager.h +++ b/tools/emulator/opengl/host/libs/Translator/include/GLcommon/objectNameManager.h @@ -74,6 +74,12 @@ private: unsigned int getGlobalName(unsigned int p_localName); // + // getLocaalName - returns the local name of an object or 0 if the object + // does not exist. + // + unsigned int getLocalName(unsigned int p_globalName); + + // // deleteName - deletes and object from the namespace as well as its // global name from the global name space. // @@ -125,6 +131,12 @@ public: unsigned int getGlobalName(NamedObjectType p_type, unsigned int p_localName); // + // getLocalName - retrieves the "local" name of an object or 0 if the + // object does not exist. + // + unsigned int getLocalName(NamedObjectType p_type, unsigned int p_globalName); + + // // deleteName - deletes and object from the namespace as well as its // global name from the global name space. // |
