Update contrib.
1 /* Copyright (c) 2009 The Khronos Group Inc.
3 * Permission is hereby granted, free of charge, to any person obtaining a
4 * copy of this software and/or associated documentation files (the
5 * "Materials"), to deal in the Materials without restriction, including
6 * without limitation the rights to use, copy, modify, merge, publish,
7 * distribute, sublicense, and/or sell copies of the Materials, and to
8 * permit persons to whom the Materials are furnished to do so, subject to
9 * the following conditions:
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Materials.
14 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
39 #define EOC (OWFuint32) 0xFFFFFFFF
44 /*! linked list of free entries */
46 /*! solid chunk of memory containing all the objects;
47 * no book-keeping data here, plain sequentially
48 * stored objects only */
50 /*! index number of the first free object in the pool;
51 * EOC if the pool is empty */
55 /*! number of free (unallocated) objects in the pool */
57 /*! size of an object */
62 * Creates new object pool. Initially all pool's
63 * objects are unallocated.
65 * \param objectSize Size of an individual pool object
66 * \param objectCount Pool capacity (number of objects)
68 * \return New pool or NULL
70 OWF_API_CALL OWF_POOL*
71 OWF_Pool_Create(size_t objectSize, size_t objectCount);
74 * Allocate object from pool. The pool retains ownership of
75 * the object returned by the function.
77 * \param pool Pool from which the object should be allocated
79 * \return Object or NULL
82 OWF_Pool_GetObject(OWF_POOL* pool);
85 * Returns previously allocated object back to the pool.
87 * \param object Object (must be valid pool object)
90 OWF_Pool_PutObject(void* object);
93 * Destroys a pool. Frees all resources allocated by
94 * the pool and invalidates all objects in the pool
95 * (both allocated and unallocated)
97 * \param pool Pool to destroy
100 OWF_Pool_Destroy(OWF_POOL* pool);
108 #endif /* OWFPOOL_H_ */