1 /* 2 * Copyright (c) 2021 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 #include "event_processor_example5.h" 17 18 #include "event_source_example.h" 19 #include "plugin_factory.h" 20 21 namespace OHOS { 22 namespace HiviewDFX { 23 REGISTER_PROXY(EventProcessorExample5); EventProcessorExample5()24EventProcessorExample5::EventProcessorExample5() 25 { 26 std::unique_lock<std::mutex> lock(EventSourceExample::mutex_); 27 printf("EventProcessorExample5::EventProcessorExample5()\n"); 28 EventSourceExample::count.insert("EventProcessorExample5"); 29 } 30 ~EventProcessorExample5()31EventProcessorExample5::~EventProcessorExample5() 32 { 33 std::unique_lock<std::mutex> lock(EventSourceExample::mutex_); 34 printf("EventProcessorExample5::~EventProcessorExample5()\n"); 35 EventSourceExample::count.erase("EventProcessorExample5"); 36 } 37 CanProcessEvent(std::shared_ptr<Event> event)38bool EventProcessorExample5::CanProcessEvent(std::shared_ptr<Event> event) 39 { 40 printf("EventProcessorExample5 CanProcessEvent true.\n"); 41 return true; 42 } 43 OnEvent(std::shared_ptr<Event> & event)44bool EventProcessorExample5::OnEvent(std::shared_ptr<Event>& event) 45 { 46 printf("EventProcessorExample5 cur ref:%ld \n", shared_from_this().use_count()); 47 return true; 48 } 49 OnLoad()50void EventProcessorExample5::OnLoad() 51 { 52 printf("EventProcessorExample5 OnLoad \n"); 53 } 54 OnUnload()55void EventProcessorExample5::OnUnload() 56 { 57 printf("EventProcessorExample5 OnUnload \n."); 58 } 59 } // namespace HiviewDFX 60 } // namespace OHOS