replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / resource / csdk / connectivity / common / inc / uarraylist.h
index 7e8403a..cf1085b 100644 (file)
@@ -40,7 +40,7 @@ typedef struct u_arraylist_t
 {
     void **data;
     uint32_t length;
-    uint32_t size;
+    uint32_t capacity;
 } u_arraylist_t;
 
 /**
@@ -58,6 +58,29 @@ u_arraylist_t *u_arraylist_create();
 void u_arraylist_free(u_arraylist_t **list);
 
 /**
+ * Request that the list prepare room for the specified number of entries.
+ * If count is greater than the current internal storage size then an
+ * an attempt will be made to reallocate room for at least count items.
+ *
+ * In other cases there will be no effect.
+ *
+ * This call will not affect the length used and cannot be used to remove
+ * entries.
+ * @param list the list to operate on.
+ * @param count the size to attempt to reserve room for.
+ * @return true if success, false otherwise.
+ */
+bool u_arraylist_reserve(u_arraylist_t *list, size_t count);
+
+/**
+ * Request that the storage in the list be reduced to fit its current length.
+ *
+ * The request is non-binding, and may not affect the entries in the list.
+ * @param list the list to operate on.
+ */
+void u_arraylist_shrink_to_fit(u_arraylist_t *list);
+
+/**
  * Returns the data of the index from the array list.
  * @param[in] list         pointer of array list.
  * @param[in] index        index of array list.
@@ -66,6 +89,15 @@ void u_arraylist_free(u_arraylist_t **list);
 void *u_arraylist_get(const u_arraylist_t *list, uint32_t index);
 
 /**
+ * Returns the index of the data from the array list.
+ * @param[in] list         pointer of array list.
+ * @param[in] data         pointer of data.
+ * @param[out]index        index of array list.
+ * @return true if success, false otherwise.
+ */
+bool u_arraylist_get_index(const u_arraylist_t *list, const void *data,  uint32_t *index);
+
+/**
  * Add data in the array list.
  * @param[in] list        pointer of array list.
  * @param[in] data        pointer of data.