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