Drizzled Public API Documentation

ut0vec.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (C) 2006, 2009, Innobase Oy. All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free Software
7 Foundation; version 2 of the License.
8 
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License along with
14 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15 St, Fifth Floor, Boston, MA 02110-1301 USA
16 
17 *****************************************************************************/
18 
19 /*******************************************************************/
26 #pragma once
27 #ifndef IB_VECTOR_H
28 #define IB_VECTOR_H
29 
30 #include "univ.i"
31 #include "mem0mem.h"
32 
35 
36 /* An automatically resizing vector datatype with the following properties:
37 
38  -Contains void* items.
39 
40  -The items are owned by the caller.
41 
42  -All memory allocation is done through a heap owned by the caller, who is
43  responsible for freeing it when done with the vector.
44 
45  -When the vector is resized, the old memory area is left allocated since it
46  uses the same heap as the new memory area, so this is best used for
47  relatively small or short-lived uses.
48 */
49 
50 /****************************************************************/
53 UNIV_INTERN
56 /*=============*/
57  mem_heap_t* heap,
58  ulint size);
60 /****************************************************************/
62 UNIV_INTERN
63 void
65 /*===========*/
66  ib_vector_t* vec,
67  void* elem);
69 /****************************************************************/
72 UNIV_INLINE
73 ulint
75 /*===========*/
76  const ib_vector_t* vec);
78 /****************************************************************/
81 UNIV_INLINE
82 ibool
84 /*===============*/
85  const ib_vector_t* vec);
87 /****************************************************************/
90 UNIV_INLINE
91 void*
93 /*==========*/
94  ib_vector_t* vec,
95  ulint n);
97 /****************************************************************/
100 UNIV_INLINE
101 void*
103 /*===============*/
104  ib_vector_t* vec);
106 /****************************************************************/
108 UNIV_INLINE
109 void
111 /*==========*/
112  ib_vector_t* vec,
113  ulint n,
114  void* elem);
116 /****************************************************************/
118 UNIV_INLINE
119 void*
121 /*==========*/
122  ib_vector_t* vec);
124 /****************************************************************/
127 UNIV_INLINE
128 void
130 /*===========*/
131  ib_vector_t* vec);
136  void** data;
137  ulint used;
138  ulint total;
139 };
140 
141 #ifndef UNIV_NONINL
142 #include "ut0vec.ic"
143 #endif
144 
145 #endif
UNIV_INLINE void ib_vector_free(ib_vector_t *vec)
UNIV_INLINE void * ib_vector_get_last(ib_vector_t *vec)
UNIV_INLINE void * ib_vector_get(ib_vector_t *vec, ulint n)
UNIV_INLINE void ib_vector_set(ib_vector_t *vec, ulint n, void *elem)
UNIV_INLINE ibool ib_vector_is_empty(const ib_vector_t *vec)
UNIV_INLINE ulint ib_vector_size(const ib_vector_t *vec)
UNIV_INTERN ib_vector_t * ib_vector_create(mem_heap_t *heap, ulint size)
Definition: ut0vec.cc:37
void ** data
Definition: ut0vec.h:136
UNIV_INLINE void * ib_vector_pop(ib_vector_t *vec)
mem_heap_t * heap
Definition: ut0vec.h:135
UNIV_INTERN void ib_vector_push(ib_vector_t *vec, void *elem)
Definition: ut0vec.cc:58