MCPcopy Create free account
hub / github.com/Duet3D/RepRapFirmware / GetElementType

Method GetElementType

src/Platform/ArrayHandle.cpp:152–169  ·  view source on GitHub ↗

Retrieve the type of an array element, or TypeCode::None if the index is out of range Caller must have a read lock on heapLock before calling this!

Source from the content-addressed store, hash-verified

150// Retrieve the type of an array element, or TypeCode::None if the index is out of range
151// Caller must have a read lock on heapLock before calling this!
152TypeCode ArrayHandle::GetElementType(size_t index) const noexcept
153{
154#if CHECK_HEAP_LOCKED
155 Heap::heapLock.CheckHasReadOrWriteLock();
156#endif
157 if (slotPtr != nullptr)
158 {
159#if CHECK_HANDLES
160 Heap::CheckSlotGood(slotPtr);
161#endif
162 ArrayStorageSpace * const aSpace = reinterpret_cast<ArrayStorageSpace*>(_ecv_not_null(slotPtr->storage));
163 if (index < aSpace->count)
164 {
165 return aSpace->elements[index].GetType();
166 }
167 }
168 return TypeCode::None;
169}
170
171// Decrease the reference count for the array referred to and delete it if it reaches zero
172void ArrayHandle::Delete() noexcept

Callers 1

IsHeapStringArrayTypeMethod · 0.80

Calls 1

GetTypeMethod · 0.45

Tested by

no test coverage detected