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

Method GetNumElements

src/Platform/ArrayHandle.cpp:104–122  ·  view source on GitHub ↗

Get the number of elements in a heap array Caller must have a read lock or a write lock on heapLock before calling this!

Source from the content-addressed store, hash-verified

102// Get the number of elements in a heap array
103// Caller must have a read lock or a write lock on heapLock before calling this!
104size_t ArrayHandle::GetNumElements() const noexcept
105{
106#if CHECK_HEAP_LOCKED
107 Heap::heapLock.CheckHasReadOrWriteLock();
108#endif
109 if (slotPtr == nullptr)
110 {
111 return 0;
112 }
113#if CHECK_HANDLES
114 Heap::CheckSlotGood(slotPtr);
115#endif
116 const Heap::StorageSpace *null storage = slotPtr->storage;
117 if (storage == nullptr)
118 {
119 return 0;
120 }
121 return reinterpret_cast<const ArrayStorageSpace*>(_ecv_not_null(storage))->count;
122}
123
124// Retrieve an array element, returning false if the index is out of bounds
125// Caller must have a read lock on heapLock before calling this!

Callers 8

AppendAsStringMethod · 0.80
IsHeapStringArrayTypeMethod · 0.80
THROWSFunction · 0.80
decreaseFunction · 0.80
THROWSFunction · 0.80
THROWSFunction · 0.80
THROWSFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected