IncidentReportArgs.h revision 1754d744a7a34731ffc07af1bc3dbfcb06864ab0
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
17#ifndef ANDROID_OS_DUMPSTATE_ARGS_H_
18#define ANDROID_OS_DUMPSTATE_ARGS_H_
19
20#include <binder/Parcel.h>
21#include <binder/Parcelable.h>
22#include <utils/String16.h>
23
24#include <set>
25#include <vector>
26
27namespace android {
28namespace os {
29
30using namespace std;
31
32class IncidentReportArgs : public Parcelable {
33public:
34    IncidentReportArgs();
35    explicit IncidentReportArgs(const IncidentReportArgs& that);
36    virtual ~IncidentReportArgs();
37
38    virtual status_t writeToParcel(Parcel* out) const;
39    virtual status_t readFromParcel(const Parcel* in);
40
41    void setAll(bool all);
42    void addSection(int section);
43    void addHeader(const vector<int8_t>& header);
44
45    inline bool all() const { return mAll; };
46    bool containsSection(int section) const;
47
48    inline const set<int>& sections() const { return mSections; }
49    inline const vector<vector<int8_t>>& headers() const { return mHeaders; }
50
51    void merge(const IncidentReportArgs& that);
52
53private:
54    set<int> mSections;
55    vector<vector<int8_t>> mHeaders;
56    bool mAll;
57};
58
59}
60}
61
62#endif // ANDROID_OS_DUMPSTATE_ARGS_H_
63