blob: 0ac3681bb47af0f7bec313f3d47677e072bbe4fb [file] [log] [blame]
Yifan Hong2a90ffe2018-03-05 17:45:34 -08001/*
2 * Copyright (C) 2018 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#include "MatrixInstance.h"
18
19#include <utility>
20
21namespace android {
22namespace vintf {
23
Yifan Hongcf231a92018-03-13 14:19:13 -070024MatrixInstance::MatrixInstance() = default;
25
26MatrixInstance::MatrixInstance(const MatrixInstance&) = default;
27
28MatrixInstance::MatrixInstance(MatrixInstance&&) = default;
29
30MatrixInstance& MatrixInstance::operator=(const MatrixInstance&) = default;
31
32MatrixInstance& MatrixInstance::operator=(MatrixInstance&&) = default;
33
Yifan Hong2a90ffe2018-03-05 17:45:34 -080034MatrixInstance::MatrixInstance(FqInstance&& fqInstance, VersionRange&& range, bool optional)
35 : mFqInstance(std::move(fqInstance)), mRange(std::move(range)), mOptional(optional) {}
36
37MatrixInstance::MatrixInstance(const FqInstance fqInstance, const VersionRange& range,
38 bool optional)
39 : mFqInstance(fqInstance), mRange(range), mOptional(optional) {}
40
41const std::string& MatrixInstance::package() const {
42 return mFqInstance.getPackage();
43}
44
45const VersionRange& MatrixInstance::versionRange() const {
46 return mRange;
47}
48
49const std::string& MatrixInstance::interface() const {
50 return mFqInstance.getInterface();
51}
52
53const std::string& MatrixInstance::instance() const {
54 return mFqInstance.getInstance();
55}
56
57bool MatrixInstance::optional() const {
58 return mOptional;
59}
60
Yifan Hong075b3632018-03-14 16:03:11 -070061bool MatrixInstance::isSatisfiedBy(const FqInstance& provided) const {
62 return package() == provided.getPackage() &&
63 versionRange().supportedBy(provided.getVersion()) &&
64 interface() == provided.getInterface() && instance() == provided.getInstance();
65}
66
Yifan Hong2a90ffe2018-03-05 17:45:34 -080067} // namespace vintf
68} // namespace android