MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / find

Method find

Engine/source/console/simDictionary.cpp:110–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110SimObject* SimNameDictionary::find(StringTableEntry name)
111{
112#ifndef USE_NEW_SIMDICTIONARY
113 // NULL is a valid lookup - it will always return NULL
114 if (!hashTable)
115 return NULL;
116
117 Mutex::lockMutex(mutex);
118
119 S32 idx = HashPointer(name) % hashTableSize;
120 SimObject *walk = hashTable[idx];
121 while (walk)
122 {
123 if (walk->getName() == name)
124 {
125 Mutex::unlockMutex(mutex);
126 return walk;
127 }
128 walk = walk->nextNameObject;
129 }
130
131 Mutex::unlockMutex(mutex);
132 return NULL;
133#else
134 Mutex::lockMutex(mutex);
135 StringDictDef::iterator it = root.find(name);
136 SimObject* f = (it == root.end() ? NULL : it->second);
137 Mutex::unlockMutex(mutex);
138 return f;
139#endif
140}
141
142void SimNameDictionary::remove(SimObject* obj)
143{

Callers 1

removeMethod · 0.45

Calls 5

HashPointerFunction · 0.85
getIdMethod · 0.65
U32Enum · 0.50
getNameMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected