blob: e678f0347221f96698668bf6d8461655f8e40d82 [file] [log] [blame]
Lev Walkinf15320b2004-06-03 03:38:44 +00001/*-
2 * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
3 * Redistribution and modifications are permitted subject to BSD license.
4 */
5#ifndef ASN_SEQUENCE_OF_H
6#define ASN_SEQUENCE_OF_H
7
8#include <asn_SET_OF.h>
9
Lev Walkin21b41ac2005-07-24 09:03:44 +000010#ifdef __cplusplus
11extern "C" {
12#endif
13
Lev Walkinf15320b2004-06-03 03:38:44 +000014/*
15 * SEQUENCE OF is the same as SET OF with a tiny difference:
16 * the delete operation preserves the initial order of elements
17 * and thus MAY operate in non-constant time.
18 */
19#define A_SEQUENCE_OF(type) A_SET_OF(type)
20
21#define ASN_SEQUENCE_ADD(headptr, ptr) \
22 asn_sequence_add((headptr), (ptr))
23
24/***********************************************
25 * Implementation of the SEQUENCE OF structure.
26 */
27
28#define asn_sequence_add asn_set_add
29#define asn_sequence_empty asn_set_empty
30
31/*
32 * Delete the element from the set by its number (base 0).
33 * This is NOT a constant-time operation.
34 * The order of elements is preserved.
35 * If _do_free is given AND the (*free) is initialized, the element
36 * will be freed using the custom (*free) function as well.
37 */
38void asn_sequence_del(void *asn_sequence_of_x, int number, int _do_free);
39
Lev Walkin089b8e92005-07-02 20:22:20 +000040/*
41 * Cope with different conversions requirements to/from void in C and C++.
42 * This is mostly useful for support library.
43 */
44typedef A_SEQUENCE_OF(void) asn_anonymous_sequence_;
45#define _A_SEQUENCE_FROM_VOID(ptr) ((asn_anonymous_sequence_ *)(ptr))
46#define _A_CSEQUENCE_FROM_VOID(ptr) ((const asn_anonymous_sequence_ *)(ptr))
47
Lev Walkin21b41ac2005-07-24 09:03:44 +000048#ifdef __cplusplus
49}
50#endif
51
Lev Walkinf15320b2004-06-03 03:38:44 +000052#endif /* ASN_SEQUENCE_OF_H */