drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
ut0vec.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (C) 2006, 2009, Innobase Oy. All Rights Reserved.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License as published by the Free Software
7Foundation; version 2 of the License.
8
9This program is distributed in the hope that it will be useful, but WITHOUT
10ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13You should have received a copy of the GNU General Public License along with
14this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15St, Fifth Floor, Boston, MA 02110-1301 USA
16
17*****************************************************************************/
18
19/*******************************************************************/
25
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/****************************************************************/
53UNIV_INTERN
56/*=============*/
57 mem_heap_t* heap,
58 ulint size);
59
60/****************************************************************/
62UNIV_INTERN
63void
65/*===========*/
66 ib_vector_t* vec,
67 void* elem);
68
69/****************************************************************/
72UNIV_INLINE
73ulint
75/*===========*/
76 const ib_vector_t* vec);
77
78/****************************************************************/
81UNIV_INLINE
82ibool
84/*===============*/
85 const ib_vector_t* vec);
86
87/****************************************************************/
90UNIV_INLINE
91void*
93/*==========*/
94 ib_vector_t* vec,
95 ulint n);
96
97/****************************************************************/
100UNIV_INLINE
101void*
103/*===============*/
104 ib_vector_t* vec);
105
106/****************************************************************/
108UNIV_INLINE
109void
111/*==========*/
112 ib_vector_t* vec,
113 ulint n,
114 void* elem);
115
116/****************************************************************/
118UNIV_INLINE
119void*
121/*==========*/
122 ib_vector_t* vec);
123
124/****************************************************************/
127UNIV_INLINE
128void
130/*===========*/
131 ib_vector_t* vec);
132
135 mem_heap_t* heap;
136 void** data;
137 ulint used;
138 ulint total;
139};
140
141#ifndef UNIV_NONINL
142#include "ut0vec.ic"
143#endif
144
145#endif
void ** data
Definition ut0vec.h:136
mem_heap_t * heap
Definition ut0vec.h:135
UNIV_INLINE void ib_vector_set(ib_vector_t *vec, ulint n, void *elem)
UNIV_INTERN void ib_vector_push(ib_vector_t *vec, void *elem)
Definition ut0vec.cc:58
UNIV_INLINE ibool ib_vector_is_empty(const ib_vector_t *vec)
UNIV_INTERN ib_vector_t * ib_vector_create(mem_heap_t *heap, ulint size)
Definition ut0vec.cc:37
struct ib_vector_struct ib_vector_t
Definition ut0vec.h:34
UNIV_INLINE void ib_vector_free(ib_vector_t *vec)
UNIV_INLINE void * ib_vector_pop(ib_vector_t *vec)
UNIV_INLINE void * ib_vector_get(ib_vector_t *vec, ulint n)
UNIV_INLINE ulint ib_vector_size(const ib_vector_t *vec)
UNIV_INLINE void * ib_vector_get_last(ib_vector_t *vec)