-unsigned CollCount (Collection* C)
+unsigned CollCount (const Collection* C)
/* Return the number of items in the collection */
{
return C->Count;
+const void* CollConstAt (const Collection* C, unsigned Index)
+/* Return the item at the given index */
+{
+ /* Check the index */
+ PRECONDITION (Index < C->Count);
+
+ /* Return the element */
+ return C->Items[Index];
+}
+
+
+
void* CollLast (Collection* C)
/* Return the last item in a collection */
{
+const void* CollConstLast (const Collection* C)
+/* Return the last item in a collection */
+{
+ /* We must have at least one entry */
+ PRECONDITION (C->Count > 0);
+
+ /* Return the element */
+ return C->Items[C->Count-1];
+}
+
+
+
void CollDelete (Collection* C, unsigned Index)
/* Remove the item with the given index from the collection. This will not
* free the item itself, just the pointer. All items with higher indices
void FreeCollection (Collection* C);
/* Free a collection */
-unsigned CollCount (Collection* C);
+unsigned CollCount (const Collection* C);
/* Return the number of items in the collection */
void CollInsert (Collection* C, void* Item, unsigned Index);
void* CollAt (Collection* C, unsigned Index) attribute ((const));
/* Return the item at the given index */
+const void* CollConstAt (const Collection* C, unsigned Index) attribute ((const));
+/* Return the item at the given index */
+
void* CollLast (Collection* C);
/* Return the last item in a collection */
+const void* CollConstLast (const Collection* C);
+/* Return the last item in a collection */
+
void CollDelete (Collection* C, unsigned Index);
/* Remove the item with the given index from the collection. This will not
* free the item itself, just the pointer. All items with higher indices