\doxysection{vector.\+h}
\label{vector_8h_source}\index{include/osmocom/vty/vector.h@{include/osmocom/vty/vector.h}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{1 }
\DoxyCodeLine{3 \textcolor{comment}{/*}}
\DoxyCodeLine{4 \textcolor{comment}{ * Copyright (C) 1997, 98 Kunihiro Ishiguro}}
\DoxyCodeLine{5 \textcolor{comment}{ *}}
\DoxyCodeLine{6 \textcolor{comment}{ * This file is part of GNU Zebra.}}
\DoxyCodeLine{7 \textcolor{comment}{ *}}
\DoxyCodeLine{8 \textcolor{comment}{ * GNU Zebra is free software; you can redistribute it and/or modify it}}
\DoxyCodeLine{9 \textcolor{comment}{ * under the terms of the GNU General Public License as published by the}}
\DoxyCodeLine{10 \textcolor{comment}{ * Free Software Foundation; either version 2, or (at your option) any}}
\DoxyCodeLine{11 \textcolor{comment}{ * later version.}}
\DoxyCodeLine{12 \textcolor{comment}{ *}}
\DoxyCodeLine{13 \textcolor{comment}{ * GNU Zebra is distributed in the hope that it will be useful, but}}
\DoxyCodeLine{14 \textcolor{comment}{ * WITHOUT ANY WARRANTY; without even the implied warranty of}}
\DoxyCodeLine{15 \textcolor{comment}{ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU}}
\DoxyCodeLine{16 \textcolor{comment}{ * General Public License for more details.}}
\DoxyCodeLine{17 \textcolor{comment}{ */}}
\DoxyCodeLine{18 }
\DoxyCodeLine{19 \textcolor{preprocessor}{\#pragma once}}
\DoxyCodeLine{20 }
\DoxyCodeLine{21 \textcolor{comment}{/* struct for vector */}}
\DoxyCodeLine{22 \textcolor{keyword}{struct }\_vector \{}
\DoxyCodeLine{23         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} active;      \textcolor{comment}{/* number of active slots */}}
\DoxyCodeLine{24         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} alloced;    \textcolor{comment}{/* number of allocated slot */}}
\DoxyCodeLine{25         \textcolor{keywordtype}{void} **index;              \textcolor{comment}{/* index to data */}}
\DoxyCodeLine{26 \};}
\DoxyCodeLine{27 \textcolor{keyword}{typedef} \textcolor{keyword}{struct }\_vector *vector;}
\DoxyCodeLine{28 }
\DoxyCodeLine{29 \textcolor{preprocessor}{\#define VECTOR\_MIN\_SIZE 1}}
\DoxyCodeLine{30 }
\DoxyCodeLine{31 \textcolor{comment}{/* (Sometimes) usefull macros.  This macro convert index expression to}}
\DoxyCodeLine{32 \textcolor{comment}{ array expression. */}}
\DoxyCodeLine{33 \textcolor{comment}{/* Reference slot at given index, caller must ensure slot is active */}}
\DoxyCodeLine{34 \textcolor{preprocessor}{\#define vector\_slot(V,I)  ((V)-\/>index[(I)])}}
\DoxyCodeLine{35 \textcolor{comment}{/* Number of active slots.}}
\DoxyCodeLine{36 \textcolor{comment}{ * Note that this differs from vector\_count() as it the count returned}}
\DoxyCodeLine{37 \textcolor{comment}{ * will include any empty slots}}
\DoxyCodeLine{38 \textcolor{comment}{ */}}
\DoxyCodeLine{39 \textcolor{preprocessor}{\#define vector\_active(V) ((V)-\/>active)}}
\DoxyCodeLine{40 }
\DoxyCodeLine{41 \textcolor{comment}{/* Prototypes. */}}
\DoxyCodeLine{42 vector vector\_init(\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} size);}
\DoxyCodeLine{43 \textcolor{keywordtype}{void} vector\_ensure(vector v, \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} num);}
\DoxyCodeLine{44 \textcolor{keywordtype}{int} vector\_empty\_slot(vector v);}
\DoxyCodeLine{45 \textcolor{keywordtype}{int} vector\_set(vector v, \textcolor{keywordtype}{void} *val);}
\DoxyCodeLine{46 \textcolor{keywordtype}{int} vector\_set\_index(vector v, \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} i, \textcolor{keywordtype}{void} *val);}
\DoxyCodeLine{47 \textcolor{keywordtype}{void} vector\_unset(vector v, \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} i);}
\DoxyCodeLine{48 \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} vector\_count(vector v);}
\DoxyCodeLine{49 \textcolor{keywordtype}{void} vector\_only\_wrapper\_free(vector v);}
\DoxyCodeLine{50 \textcolor{keywordtype}{void} vector\_only\_index\_free(\textcolor{keywordtype}{void} *index);}
\DoxyCodeLine{51 \textcolor{keywordtype}{void} vector\_free(vector v);}
\DoxyCodeLine{52 vector vector\_copy(vector v);}
\DoxyCodeLine{53 }
\DoxyCodeLine{54 \textcolor{keywordtype}{void} *vector\_lookup(vector, \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int});}
\DoxyCodeLine{55 \textcolor{keywordtype}{void} *vector\_lookup\_ensure(vector, \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int});}
\DoxyCodeLine{56 }
\DoxyCodeLine{57 \textcolor{keyword}{extern} \textcolor{keywordtype}{void} *tall\_vty\_vec\_ctx;}

\end{DoxyCode}
