• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_SESSION_STACK_H
17 #define OHOS_SESSION_STACK_H
18 
19 #include <string>
20 
21 #include "session_container.h"
22 
23 namespace OHOS::AVSession {
24 class SessionStack : public SessionContainer {
25 public:
26     int32_t AddSession(pid_t pid, const std::string& abilityName, sptr<AVSessionItem>& item) override;
27 
28     std::vector<sptr<AVSessionItem>> RemoveSession(pid_t pid) override;
29 
30     sptr<AVSessionItem> RemoveSession(pid_t pid, const std::string& abilityName) override;
31 
32     sptr<AVSessionItem> RemoveSession(const std::string& sessionId) override;
33 
34     sptr<AVSessionItem> GetSession(pid_t pid, const std::string& abilityName) override;
35 
36     bool PidHasSession(pid_t pid) override;
37 
38     sptr<AVSessionItem> GetSessionById(const std::string& sessionId) override;
39 
40     std::vector<sptr<AVSessionItem>> GetAllSessions() override;
41 
42 private:
43     std::map<std::pair<pid_t, std::string>, sptr<AVSessionItem>> sessions_;
44     std::list<sptr<AVSessionItem>> stack_;
45 };
46 } // namespace OHOS::AVSession
47 #endif // OHOS_SESSION_STACK_H