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 #ifndef HIAPPEVENT_FRAMEWORKS_NATIVE_LIB_HIAPPEVENT_CACHE_APP_EVENT_BLOCK_H 16 #define HIAPPEVENT_FRAMEWORKS_NATIVE_LIB_HIAPPEVENT_CACHE_APP_EVENT_BLOCK_H 17 18 #include <cstdint> 19 #include <string> 20 #include <utility> 21 #include <vector> 22 23 #include "app_event_block_dao.h" 24 #include "app_event_store.h" 25 26 namespace OHOS { 27 namespace HiviewDFX { 28 class AppEventBlockDao; 29 30 class AppEventBlock { 31 public: 32 AppEventBlock(std::shared_ptr<AppEventStore> store, const std::string& name); ~AppEventBlock()33 ~AppEventBlock() {} 34 int GetStat(std::pair<int, int64_t>& statPair); 35 int Add(const std::string& package); 36 int Remove(int num); 37 int Take(int size, std::vector<std::string>& packages); 38 39 private: 40 std::shared_ptr<AppEventBlockDao> blockDao_; 41 }; 42 } // namespace HiviewDFX 43 } // namespace OHOS 44 #endif // HIAPPEVENT_FRAMEWORKS_NATIVE_LIB_HIAPPEVENT_CACHE_APP_EVENT_BLOCK_H 45