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
16#ifndef OHOS_DISTRIBUTED_ABILITY_MANAGER_NOTIFIER_INFO_H
17#define OHOS_DISTRIBUTED_ABILITY_MANAGER_NOTIFIER_INFO_H
18
19#include <functional>
20#include <iosfwd>
21#include <map>
22#include <memory>
23#include <string>
24
25#include "connect_status_info.h"
26#include "iremote_object.h"
27#include "notifier_death_recipient.h"
28#include "refbase.h"
29
30namespace OHOS {
31namespace DistributedSchedule {
32class NotifierInfo {
33public:
34    NotifierInfo() = default;
35    ~NotifierInfo() = default;
36
37    using NotifierMap = std::map<std::string, sptr<IRemoteObject>>;
38    sptr<IRemoteObject> GetNotifier(const std::string& cbType) const;
39    void SetNotifier(const std::string& cbType, const sptr<IRemoteObject>& notifier);
40    void DeleteNotifier(const std::string& cbType);
41    bool QueryNotifier(const sptr<IRemoteObject>& notifier) const;
42    bool IsNotifierMapEmpty();
43    void RemoveDeathRecipient(const sptr<IRemoteObject::DeathRecipient>& notifierDeathRecipient,
44        const std::string& cbType = std::string());
45    std::shared_ptr<ConnectStatusInfo> GetConnectStatusInfo() const;
46    void SetConnectStatusInfo(const std::shared_ptr<ConnectStatusInfo>& connectStatusInfo);
47private:
48    NotifierMap notifierMap_;
49    std::shared_ptr<ConnectStatusInfo> connectStatusInfo_;
50};
51} // namespace DistributedSchedule
52} // namespace OHOS
53#endif // OHOS_DISTRIBUTED_ABILITY_MANAGER_NOTIFIER_INFO_H