blob: 3e133c3d56786a9a2119ee5fa8fb50e825d6b6c5 [file] [log] [blame]
Alexander Afanasyevc74a6022011-08-15 20:01:35 -07001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
Ilya Moiseenkoc115fba2011-08-01 10:53:18 -07002/*
Alexander Afanasyev6b997c52011-08-08 12:55:25 -07003 * Copyright (c) 2011 University of California, Los Angeles
Ilya Moiseenkoc115fba2011-08-01 10:53:18 -07004 *
Alexander Afanasyev6b997c52011-08-08 12:55:25 -07005 * 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 Moiseenkoc115fba2011-08-01 10:53:18 -07008 *
Alexander Afanasyev6b997c52011-08-08 12:55:25 -07009 * 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 Moiseenkoc115fba2011-08-01 10:53:18 -070019 */
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
47struct ccn_indexbuf {
48 size_t n;
49 size_t limit;
50 size_t *buf;
51};
52
53struct ccn_indexbuf *ccn_indexbuf_create(void);
54void ccn_indexbuf_destroy(struct ccn_indexbuf **cbp);
55size_t *ccn_indexbuf_reserve(struct ccn_indexbuf *c, size_t n);
56int ccn_indexbuf_append(struct ccn_indexbuf *c, const size_t *p, size_t n);
57int ccn_indexbuf_append_element(struct ccn_indexbuf *c, size_t v);
58int ccn_indexbuf_member(struct ccn_indexbuf *x, size_t val);
59void ccn_indexbuf_remove_element(struct ccn_indexbuf *x, size_t val);
60int ccn_indexbuf_set_insert(struct ccn_indexbuf *x, size_t val);
61int ccn_indexbuf_remove_first_match(struct ccn_indexbuf *x, size_t val);
62void ccn_indexbuf_move_to_end(struct ccn_indexbuf *x, size_t val);
63void ccn_indexbuf_move_to_front(struct ccn_indexbuf *x, size_t val);
64
65#endif