• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware.tests.baz@1.0;
18
19interface IBase {
20    enum SomeBaseEnum : int32_t {
21        grrr = 1,
22    };
23
24    struct Foo {
25        struct Bar {
26            float z;
27            string s;
28        };
29
30        enum FooEnum : int8_t {
31            first = 1,
32            second = 2,
33        };
34
35        int32_t x;
36        vec<Bar> aaa;
37        Bar y;
38    };
39
40    struct MoreThanOneArrayField {
41        /**
42         * Generated (Java) code used to redeclare the same variable name
43         * multiple times in the same scope, this test ensures that that's no
44         * longer the case.
45         */
46        string[3] one;
47        string[5] two;
48    };
49
50    typedef string[3] ThreeStrings;
51    typedef string[5] FiveStrings;
52
53    struct StringMatrix3x5 {
54        FiveStrings[3] s;
55    };
56
57    struct StringMatrix5x3 {
58        ThreeStrings[5] s;
59    };
60
61    typedef uint8_t[6] MacAddress;
62
63    struct VectorOfArray {
64        vec<MacAddress> addresses;
65    };
66
67    enum BitField : uint8_t {
68        V0 = 1 << 0,
69        V1 = 1 << 1,
70        V2 = 1 << 2,
71        V3 = 1 << 3,
72    };
73
74    struct MyMask {
75        bitfield<BitField> value;
76    };
77
78    typedef bitfield<BitField> Mask;
79
80    typedef uint8_t[128] ByteOneDim;
81    typedef uint8_t[8][128] ByteTwoDim;
82    typedef uint8_t[8][16][128] ByteThreeDim;
83
84    typedef bool[128] BooleanOneDim;
85    typedef bool[8][128] BooleanTwoDim;
86    typedef bool[8][16][128] BooleanThreeDim;
87
88    typedef double[128] DoubleOneDim;
89    typedef double[8][128] DoubleTwoDim;
90    typedef double[8][16][128] DoubleThreeDim;
91
92    struct LotsOfPrimitiveArrays {
93        ByteOneDim byte1;
94        ByteTwoDim byte2;
95        ByteThreeDim byte3;
96        BooleanOneDim boolean1;
97        BooleanTwoDim boolean2;
98        BooleanThreeDim boolean3;
99        DoubleOneDim double1;
100        DoubleTwoDim double2;
101        DoubleThreeDim double3;
102    };
103
104    someBaseMethod();
105
106    someBoolMethod(bool x) generates (bool y);
107    someBoolArrayMethod(bool[3] x) generates (bool[4] y);
108    someBoolVectorMethod(vec<bool> x) generates (vec<bool> y);
109
110    someOtherBaseMethod(Foo foo) generates (Foo result);
111    someMethodWithFooArrays(Foo[2] fooInput) generates (Foo[2] fooOutput);
112    someMethodWithFooVectors(vec<Foo> fooInput) generates (vec<Foo> fooOutput);
113
114    someMethodWithVectorOfArray(VectorOfArray in) generates (VectorOfArray out);
115
116    someMethodTakingAVectorOfArray(vec<MacAddress> in)
117        generates (vec<MacAddress> out);
118
119    transpose(StringMatrix5x3 in) generates (StringMatrix3x5 out);
120    transpose2(ThreeStrings[5] in) generates (FiveStrings[3] out);
121
122    takeAMask(BitField bf, bitfield<BitField> first, MyMask second, Mask third)
123            generates (BitField out, uint8_t f, uint8_t s, uint8_t t);
124
125    testArrays(LotsOfPrimitiveArrays in) generates (LotsOfPrimitiveArrays out);
126    testByteVecs(vec<ByteOneDim> in) generates (vec<ByteOneDim> out);
127    testBooleanVecs(vec<BooleanOneDim> in) generates (vec<BooleanOneDim> out);
128    testDoubleVecs(vec<DoubleOneDim> in) generates (vec<DoubleOneDim> out);
129};
130