Alexander Afanasyev | 6b997c5 | 2011-08-08 12:55:25 -0700 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
Ilya Moiseenko | c115fba | 2011-08-01 10:53:18 -0700 | [diff] [blame] | 2 | /* |
Alexander Afanasyev | 6b997c5 | 2011-08-08 12:55:25 -0700 | [diff] [blame] | 3 | * Copyright (c) 2011 University of California, Los Angeles |
Ilya Moiseenko | c115fba | 2011-08-01 10:53:18 -0700 | [diff] [blame] | 4 | * |
Alexander Afanasyev | 6b997c5 | 2011-08-08 12:55:25 -0700 | [diff] [blame] | 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License version 2 as |
| 7 | * published by the Free Software Foundation; |
Ilya Moiseenko | c115fba | 2011-08-01 10:53:18 -0700 | [diff] [blame] | 8 | * |
Alexander Afanasyev | 6b997c5 | 2011-08-08 12:55:25 -0700 | [diff] [blame] | 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | * |
| 18 | * Author: Ilya Moiseenko <iliamo@cs.ucla.edu> |
Ilya Moiseenko | c115fba | 2011-08-01 10:53:18 -0700 | [diff] [blame] | 19 | */ |
| 20 | |
| 21 | /** |
| 22 | * @file ccn/indexbuf.h |
| 23 | * |
| 24 | * Expandable buffer of non-negative values. |
| 25 | * |
| 26 | * Part of the CCNx C Library. |
| 27 | * |
| 28 | * Copyright (C) 2008, 2009 Palo Alto Research Center, Inc. |
| 29 | * |
| 30 | * This library is free software; you can redistribute it and/or modify it |
| 31 | * under the terms of the GNU Lesser General Public License version 2.1 |
| 32 | * as published by the Free Software Foundation. |
| 33 | * This library is distributed in the hope that it will be useful, |
| 34 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 35 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 36 | * Lesser General Public License for more details. You should have received |
| 37 | * a copy of the GNU Lesser General Public License along with this library; |
| 38 | * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, |
| 39 | * Fifth Floor, Boston, MA 02110-1301 USA. |
| 40 | */ |
| 41 | |
| 42 | #ifndef CCN_INDEXBUF_DEFINED |
| 43 | #define CCN_INDEXBUF_DEFINED |
| 44 | |
| 45 | #include <stddef.h> |
| 46 | |
| 47 | struct ccn_indexbuf { |
| 48 | size_t n; |
| 49 | size_t limit; |
| 50 | size_t *buf; |
| 51 | }; |
| 52 | |
| 53 | struct ccn_indexbuf *ccn_indexbuf_create(void); |
| 54 | void ccn_indexbuf_destroy(struct ccn_indexbuf **cbp); |
| 55 | size_t *ccn_indexbuf_reserve(struct ccn_indexbuf *c, size_t n); |
| 56 | int ccn_indexbuf_append(struct ccn_indexbuf *c, const size_t *p, size_t n); |
| 57 | int ccn_indexbuf_append_element(struct ccn_indexbuf *c, size_t v); |
| 58 | int ccn_indexbuf_member(struct ccn_indexbuf *x, size_t val); |
| 59 | void ccn_indexbuf_remove_element(struct ccn_indexbuf *x, size_t val); |
| 60 | int ccn_indexbuf_set_insert(struct ccn_indexbuf *x, size_t val); |
| 61 | int ccn_indexbuf_remove_first_match(struct ccn_indexbuf *x, size_t val); |
| 62 | void ccn_indexbuf_move_to_end(struct ccn_indexbuf *x, size_t val); |
| 63 | void ccn_indexbuf_move_to_front(struct ccn_indexbuf *x, size_t val); |
| 64 | |
| 65 | #endif |