1/* $Id$Revision: */
2
3/*************************************************************************
4 * Copyright (c) 2011 AT&T Intellectual Property
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Eclipse Public License v1.0
7 * which accompanies this distribution, and is available at
8 * http://www.eclipse.org/legal/epl-v10.html
9 *
10 * Contributors: See CVS logs. Details at http://www.graphviz.org/
11 *************************************************************************/
12
13#ifndef VECTOR_H
14#define VECTOR_H
15#include <stdlib.h>
16struct vector_struct {
17 int maxlen;
18 int len;
19 void *v;
20 size_t size_of_elem;
21 void (*deallocator)(void *v);
22};
23
24typedef struct vector_struct *Vector;
25
26/* deallocator works on each element of the vector */
27Vector Vector_new(int maxlen, size_t size_of_elem, void (*deallocator)(void *v));
28
29Vector Vector_add(Vector v, void *stuff);
30
31Vector Vector_reset(Vector v, void *stuff, int i);
32
33void Vector_delete(Vector v);
34
35void* Vector_get(Vector v, int i);
36
37int Vector_get_length(Vector v);
38
39Vector Vector_reset(Vector v, void *stuff, int i);
40
41/*------------- vector of strings ----------- */
42
43typedef Vector StringVector;
44
45Vector StringVector_new(int len, int delete_element_strings);
46Vector StringVector_add(Vector v, char *i);
47void StringVector_delete(Vector v);
48char** StringVector_get(Vector v, int i);
49int StringVector_get_length(Vector v);
50Vector StringVector_reset(Vector v, char *content, int pos);
51void StringVector_fprint(FILE *fp, StringVector v);
52void StringVector_fprint1(FILE *fp, StringVector v);
53StringVector StringVector_part(StringVector v, int n, int *selected_list);
54/*------------- integer vector ----------- */
55
56typedef Vector IntegerVector;
57
58Vector IntegerVector_new(int len);
59Vector IntegerVector_add(Vector v, int i);
60void IntegerVector_delete(Vector v);
61int* IntegerVector_get(Vector v, int i);
62int IntegerVector_get_length(Vector v);
63Vector IntegerVector_reset(Vector v, int content, int pos);
64
65
66
67#endif
68