aboutsummaryrefslogtreecommitdiff
path: root/android/src/org/linaro/glmark2/SceneInfo.java
blob: 7a85e07e19bae4b27ebe522c2d78cd620ea8bb35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
 * Copyright © 2012 Linaro Limited
 *
 * This file is part of the glmark2 OpenGL (ES) 2.0 benchmark.
 *
 * glmark2 is free software: you can redistribute it and/or modify it under the
 * terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * glmark2 is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * glmark2.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Authors:
 *  Alexandros Frantzis
 */
package org.linaro.glmark2;

import android.os.Parcelable;
import android.os.Parcel;
import java.util.ArrayList;

class SceneInfo implements Parcelable {
    static class Option {
        String name;
        String description;
        String defaultValue;
    }

    public SceneInfo(String name) {
        this.name = name;
        this.options = new ArrayList<Option>();
    }

    public void addOption(String name, String description, String defaultValue) {
        Option opt = new Option();
        opt.name = name;
        opt.description = description;
        opt.defaultValue = defaultValue;
        this.options.add(opt);
    }

    public String name;
    public ArrayList<Option> options;

    /* Parcelable interface */
    public static final Parcelable.Creator<SceneInfo> CREATOR =
        new Parcelable.Creator<SceneInfo>() {
            public SceneInfo createFromParcel(Parcel in) {
                return new SceneInfo(in);
            }

            public SceneInfo[] newArray(int size) {
                return new SceneInfo[size];
            }
        };

    public int describeContents() {
        return 0;
    }

    public void writeToParcel(Parcel out, int flags) {
        out.writeString(name);
        out.writeInt(options.size());
        for (Option opt: options) {
            out.writeString(opt.name);
            out.writeString(opt.description);
            out.writeString(opt.defaultValue);
        }
    }

    private SceneInfo(Parcel in) {
        name = in.readString();
        options = new ArrayList<Option>();

        int size = in.readInt();
        for (int i = 0; i < size; i++) {
            Option opt = new Option();
            opt.name = in.readString();
            opt.description = in.readString();
            opt.defaultValue = in.readString();
            options.add(opt);
        }
    }
}