blob: 369d466ea75b7a6206367c59498cf4a4fd44575c [file] [log] [blame]
Ilya Moiseenkoc115fba2011-08-01 10:53:18 -07001/*
2 * ccn_indexbuf.h
3 * Abstraction
4 *
5 * Created by Ilya on 7/29/11.
6 * Copyright 2011 __MyCompanyName__. All rights reserved.
7 *
8 */
9
10/**
11 * @file ccn/indexbuf.h
12 *
13 * Expandable buffer of non-negative values.
14 *
15 * Part of the CCNx C Library.
16 *
17 * Copyright (C) 2008, 2009 Palo Alto Research Center, Inc.
18 *
19 * This library is free software; you can redistribute it and/or modify it
20 * under the terms of the GNU Lesser General Public License version 2.1
21 * as published by the Free Software Foundation.
22 * This library is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 * Lesser General Public License for more details. You should have received
26 * a copy of the GNU Lesser General Public License along with this library;
27 * if not, write to the Free Software Foundation, Inc., 51 Franklin Street,
28 * Fifth Floor, Boston, MA 02110-1301 USA.
29 */
30
31#ifndef CCN_INDEXBUF_DEFINED
32#define CCN_INDEXBUF_DEFINED
33
34#include <stddef.h>
35
36struct ccn_indexbuf {
37 size_t n;
38 size_t limit;
39 size_t *buf;
40};
41
42struct ccn_indexbuf *ccn_indexbuf_create(void);
43void ccn_indexbuf_destroy(struct ccn_indexbuf **cbp);
44size_t *ccn_indexbuf_reserve(struct ccn_indexbuf *c, size_t n);
45int ccn_indexbuf_append(struct ccn_indexbuf *c, const size_t *p, size_t n);
46int ccn_indexbuf_append_element(struct ccn_indexbuf *c, size_t v);
47int ccn_indexbuf_member(struct ccn_indexbuf *x, size_t val);
48void ccn_indexbuf_remove_element(struct ccn_indexbuf *x, size_t val);
49int ccn_indexbuf_set_insert(struct ccn_indexbuf *x, size_t val);
50int ccn_indexbuf_remove_first_match(struct ccn_indexbuf *x, size_t val);
51void ccn_indexbuf_move_to_end(struct ccn_indexbuf *x, size_t val);
52void ccn_indexbuf_move_to_front(struct ccn_indexbuf *x, size_t val);
53
54#endif