1 #ifndef __THREAD_DYNARRAY_H__
2 #define __THREAD_DYNARRAY_H__
8 #include <TTestCaseContext.h>
11 typedef struct s_ThreadEntry
15 TestCaseContext_t context;
16 }s_ThreadEntry_t,* ThreadEntry_t;
18 * s_ThreadDynarray struct declaration.
21 typedef struct s_ThreadDynarray
24 ThreadEntry_t threads;
27 /* Storage capacity */
28 unsigned long capacity;
32 }s_ThreadDynarray_t,* ThreadDynarray_t;
35 * Constructs a ThreadDynarray with the specified capacity.
37 ThreadDynarray_t ThreadDynarray_new(unsigned long capacity);
40 * Destroy the ThreadDynarray
42 void ThreadDynarray_destroy(ThreadDynarray_t ptr);
45 * Returns an const pointer THREAD_entry pointed to by index.
47 ThreadEntry_t const ThreadDynarray_at(ThreadDynarray_t ptr, unsigned long index);
50 * Fill the content of the entry addressed by the __entry with the content
51 * of the entry pointed to by index.
53 void ThreadDynarray_get(ThreadDynarray_t ptr, unsigned long index, ThreadEntry_t const __entry);
56 * Fill the content of the entry pointed to by index with the content of
57 * the entry addressed by __entry.
59 void ThreadDynarray_set(ThreadDynarray_t ptr, unsigned long index, ThreadEntry_t const __entry);
62 * Returns a const pointer to the first entry.
64 ThreadEntry_t const ThreadDynarray_getFront(ThreadDynarray_t ptr);
67 * Returns a const pointer to the last entry.
69 ThreadEntry_t const ThreadDynarray_getBack(ThreadDynarray_t ptr);
72 * Inserts a copy of __entry at the front
74 void ThreadDynarray_pushFront(ThreadDynarray_t ptr, ThreadEntry_t const __entry);
77 * Appends a copy of __entry to the end.
79 void ThreadDynarray_pushBack(ThreadDynarray_t ptr, ThreadEntry_t const __entry);
82 * Inserts __entry at the position pointed to by index.
84 void ThreadDynarray_insert(ThreadDynarray_t ptr, unsigned long index, ThreadEntry_t const __entry);
87 * Deletes the entry pointed to by index. If __entry is not NULL the
88 * fuction saves the entry threads at this address before.
90 void ThreadDynarray_erase(ThreadDynarray_t ptr, unsigned long index,ThreadEntry_t const __entry);
93 * Find the first entry with the same content of the entry addressed by
94 * __entry.The function returns the index of the founded entry, -1 if
95 * no entry is founded.
97 long ThreadDynarray_getIndex(ThreadDynarray_t ptr, ThreadEntry_t const __entry);
100 * Returns true if the entry exist.
102 bool ThreadDynarray_exist(ThreadDynarray_t ptr, ThreadEntry_t const __entry);
104 /* Deletes the first entry with the same content of the entry addressed
105 * by __entry.The function returns true if the entry is deleted, false
106 * if no entry is founded.
108 bool ThreadDynarray_remove(ThreadDynarray_t ptr, ThreadEntry_t const __entry);
111 * Erase all elements of the self.
113 void ThreadDynarray_clear(ThreadDynarray_t ptr);
116 * Resets entry count to zero.
118 void ThreadDynarray_reset(ThreadDynarray_t ptr);
121 * Moves count elements from src index to dst index.
123 void ThreadDynarray_move(ThreadDynarray_t ptr, const unsigned long dst,const unsigned long src,unsigned long count);
125 /* Compare the content of the entry pointed to by index with the content of
126 * the entry addressed by __entry. The function returns true if the contents
129 bool ThreadDynarray_compare(ThreadDynarray_t ptr, const unsigned long index,ThreadEntry_t const __entry);
132 * Returns a reference to a new ThreadDynarray new set is a clone of the self.
134 ThreadDynarray_t ThreadDynarray_clone(ThreadDynarray_t ptr);
137 * Extends the capacity when the container is full.
139 void ThreadDynarray_resize(ThreadDynarray_t ptr);
142 * Returns the number of elements.
144 unsigned long ThreadDynarray_getCount(ThreadDynarray_t ptr);
147 * Returns the current storage capacity of the ThreadDynarray. This is guaranteed
148 * to be at least as large as count().
150 unsigned long ThreadDynarray_getCapacity(ThreadDynarray_t ptr);
153 * Returns upper bound of self (max index).
155 unsigned long ThreadDynarray_getUpperBound(ThreadDynarray_t ptr);
158 * Returns lower bound of self (always zero).
160 unsigned long ThreadDynarray_getLowerBound(ThreadDynarray_t ptr);
163 * Returns the size of the elements.
165 unsigned long ThreadDynarray_getElementSize(ThreadDynarray_t ptr);
168 * Returns true if the size of self is zero.
170 bool ThreadDynarray_isEmpty(ThreadDynarray_t ptr);
173 * Returns true if capacity available.
175 bool ThreadDynarray(ThreadDynarray_t ptr);
178 * Returns true if the container is full.
180 bool ThreadDynarray_is_full(ThreadDynarray_t ptr);
183 * Returns true if capacity available.
185 bool ThreadDynarray_getCapacityAvailable(ThreadDynarray_t ptr);
190 ThreadDynarray_t ThreadDynarray_assign(ThreadDynarray_t src,ThreadDynarray_t dst);
193 * Returns true if the dynamic arrays are equal.
195 bool ThreadDynarray_areEquals(ThreadDynarray_t ptr1,ThreadDynarray_t ptr2);
198 * Returns true if the dynamic arrays are not equal.
200 bool ThreadDynarray_areNotEquals(ThreadDynarray_t ptr1,ThreadDynarray_t ptr2);
202 void ThreadDynarray_lock(ThreadDynarray_t ptr);
204 void ThreadDynarray_unlock(ThreadDynarray_t ptr);
207 #endif /* #ifndef __THREAD_DYNARRAY_H__ */