Moving in e2sim originally from it/test/simulators
[sim/e2-interface.git] / e2sim / ASN1c / asn_SEQUENCE_OF.h
1 /*****************************************************************************
2 #                                                                            *
3 # Copyright 2019 AT&T Intellectual Property                                  *
4 #                                                                            *
5 # Licensed under the Apache License, Version 2.0 (the "License");            *
6 # you may not use this file except in compliance with the License.           *
7 # You may obtain a copy of the License at                                    *
8 #                                                                            *
9 #      http://www.apache.org/licenses/LICENSE-2.0                            *
10 #                                                                            *
11 # Unless required by applicable law or agreed to in writing, software        *
12 # distributed under the License is distributed on an "AS IS" BASIS,          *
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   *
14 # See the License for the specific language governing permissions and        *
15 # limitations under the License.                                             *
16 #                                                                            *
17 ******************************************************************************/
18
19 /*-
20  * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
21  * Redistribution and modifications are permitted subject to BSD license.
22  */
23 #ifndef ASN_SEQUENCE_OF_H
24 #define ASN_SEQUENCE_OF_H
25
26 #include <asn_SET_OF.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 /*
33  * SEQUENCE OF is the same as SET OF with a tiny difference:
34  * the delete operation preserves the initial order of elements
35  * and thus MAY operate in non-constant time.
36  */
37 #define A_SEQUENCE_OF(type)     A_SET_OF(type)
38
39 #define ASN_SEQUENCE_ADD(headptr, ptr)          \
40         asn_sequence_add((headptr), (ptr))
41
42 /***********************************************
43  * Implementation of the SEQUENCE OF structure.
44  */
45
46 #define asn_sequence_add        asn_set_add
47 #define asn_sequence_empty      asn_set_empty
48
49 /*
50  * Delete the element from the set by its number (base 0).
51  * This is NOT a constant-time operation.
52  * The order of elements is preserved.
53  * If _do_free is given AND the (*free) is initialized, the element
54  * will be freed using the custom (*free) function as well.
55  */
56 void asn_sequence_del(void *asn_sequence_of_x, int number, int _do_free);
57
58 /*
59  * Cope with different conversions requirements to/from void in C and C++.
60  * This is mostly useful for support library.
61  */
62 typedef A_SEQUENCE_OF(void) asn_anonymous_sequence_;
63 #define _A_SEQUENCE_FROM_VOID(ptr)      ((asn_anonymous_sequence_ *)(ptr))
64 #define _A_CSEQUENCE_FROM_VOID(ptr)     ((const asn_anonymous_sequence_ *)(ptr))
65
66 #ifdef __cplusplus
67 }
68 #endif
69
70 #endif  /* ASN_SEQUENCE_OF_H */