vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 1 | /*- |
| 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 | |
| 10 | /* |
| 11 | * SEQUENCE OF is the same as SET OF with a tiny difference: |
| 12 | * the delete operation preserves the initial order of elements |
| 13 | * and thus MAY operate in non-constant time. |
| 14 | */ |
| 15 | #define A_SEQUENCE_OF(type) A_SET_OF(type) |
| 16 | |
| 17 | #define ASN_SEQUENCE_ADD(headptr, ptr) \ |
| 18 | asn_sequence_add((headptr), (ptr)) |
| 19 | |
| 20 | /*********************************************** |
| 21 | * Implementation of the SEQUENCE OF structure. |
| 22 | */ |
| 23 | |
| 24 | #define asn_sequence_add asn_set_add |
| 25 | #define asn_sequence_empty asn_set_empty |
| 26 | |
| 27 | /* |
| 28 | * Delete the element from the set by its number (base 0). |
| 29 | * This is NOT a constant-time operation. |
| 30 | * The order of elements is preserved. |
| 31 | * If _do_free is given AND the (*free) is initialized, the element |
| 32 | * will be freed using the custom (*free) function as well. |
| 33 | */ |
| 34 | void asn_sequence_del(void *asn_sequence_of_x, int number, int _do_free); |
| 35 | |
vlm | f06c214 | 2005-07-02 20:22:20 +0000 | [diff] [blame] | 36 | /* |
| 37 | * Cope with different conversions requirements to/from void in C and C++. |
| 38 | * This is mostly useful for support library. |
| 39 | */ |
| 40 | typedef A_SEQUENCE_OF(void) asn_anonymous_sequence_; |
| 41 | #define _A_SEQUENCE_FROM_VOID(ptr) ((asn_anonymous_sequence_ *)(ptr)) |
| 42 | #define _A_CSEQUENCE_FROM_VOID(ptr) ((const asn_anonymous_sequence_ *)(ptr)) |
| 43 | |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 44 | #endif /* ASN_SEQUENCE_OF_H */ |