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 #ifndef SEGMENT_ANALYSIS_FACTORY_H 16 #define SEGMENT_ANALYSIS_FACTORY_H 17 #include "segment_analysis_onelayer.h" 18 #include "segment_analysis_twolayers.h" 19 #include "singleton.h" 20 namespace OHOS { 21 namespace HiviewDFX { 22 namespace { 23 static const std::string SEGMENT_TYPE_ONELAYER = "OneLayer"; 24 static const std::string SEGMENT_TYPE_TWOLAYERS = "TwoLayers"; 25 } 26 class SegmentAnalysisFactory : public Singleton<SegmentAnalysisFactory> { 27 public: SegmentAnalysisFactory()28 SegmentAnalysisFactory() {}; ~SegmentAnalysisFactory()29 ~SegmentAnalysisFactory() {}; 30 SegmentAnalysisFactory(const SegmentAnalysisFactory&) = delete; 31 SegmentAnalysisFactory& operator=(const SegmentAnalysisFactory&) = delete; 32 SegmentAnalysisFactory(SegmentAnalysisFactory&&) = delete; 33 SegmentAnalysisFactory& operator=(SegmentAnalysisFactory&&) = delete; 34 std::unique_ptr<SegmentAnalysis> CreateParser(const std::string& type) const; 35 }; 36 } // namespace HiviewDFX 37 } // namespace OHOS 38 #endif /* SEGMENT_ANALYSIS_FACTORY_H */ 39