1 /*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 #include "matrix_event.h"
16 namespace OHOS::DistributedData {
MatrixEvent(int32_t evtId,const std::string & device,uint16_t mask)17 MatrixEvent::MatrixEvent(int32_t evtId, const std::string &device, uint16_t mask)
18 : Event(evtId), mask_(mask), deviceId_(device)
19 {
20 }
21
GetMask() const22 uint16_t MatrixEvent::GetMask() const
23 {
24 return mask_;
25 }
26
GetDeviceId() const27 std::string MatrixEvent::GetDeviceId() const
28 {
29 return deviceId_;
30 }
31
Equals(const Event & event) const32 bool MatrixEvent::Equals(const Event &event) const
33 {
34 auto &evt = static_cast<const MatrixEvent &>(event);
35 return (deviceId_ == evt.deviceId_) && (mask_ == evt.mask_);
36 }
37
SetRefCount(RefCount refCount)38 void MatrixEvent::SetRefCount(RefCount refCount)
39 {
40 refCount_ = std::move(refCount);
41 }
42
StealRefCount() const43 RefCount MatrixEvent::StealRefCount() const
44 {
45 return std::move(refCount_);
46 }
47 } // namespace OHOS::DistributedData