/* * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef OHOS_SESSION_STACK_H #define OHOS_SESSION_STACK_H #include #include "session_container.h" namespace OHOS::AVSession { class SessionStack : public SessionContainer { public: int32_t AddSession(pid_t pid, const std::string& abilityName, sptr& item) override; std::vector> RemoveSession(pid_t pid) override; sptr RemoveSession(pid_t pid, const std::string& abilityName) override; sptr RemoveSession(const std::string& sessionId) override; sptr GetSession(pid_t pid, const std::string& abilityName) override; std::vector> GetSessionsByPid(pid_t pid) override; bool PidHasSession(pid_t pid) override; sptr GetSessionById(const std::string& sessionId) override; std::vector> GetAllSessions() override; void UpdateSessionSort(sptr& item) override; bool IsEmpty() override; int32_t getAllSessionNum() override; private: std::map, sptr> sessions_; std::list> stack_; std::recursive_mutex sessionStackLock_; }; } // namespace OHOS::AVSession #endif // OHOS_SESSION_STACK_H