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#include "data_set.h" 17 18#include <iostream> 19#include <string> 20 21namespace OHOS { 22namespace WuKong { 23using namespace std; 24void DataSet::FilterData(map<string, string> data) 25{ 26 filter_->FilterDetail(filterType_, data, dataVector_); 27} 28 29void DataSet::SetFilterType(std::string filterType) 30{ 31 filterType_ = filterType; 32} 33void DataSet::SetFilterStragety(shared_ptr<Filter> filter) 34{ 35 filter_ = filter; 36} 37 38void DataSet::StatisticsData() 39{ 40 DEBUG_LOG_STR("current dataVector length{%d}", dataVector_.size()); 41 statistics_->StatisticsDetail(dataVector_, tables_); 42 dataVector_.clear(); 43} 44 45void DataSet::SetStatisticsStragety(shared_ptr<Statistics> statistics) 46{ 47 statistics_ = statistics; 48} 49 50void DataSet::FormatData(std::string name, std::string &content) 51{ 52 std::map<std::string, std::shared_ptr<Table>>::iterator tablesIter = tables_.find(name); 53 if (tablesIter == tables_.end()) { 54 return; 55 } 56 std::shared_ptr<Table> table = tables_[name]; 57 format_->FormatDetail(table, content); 58} 59 60void DataSet::SetFormatStragety(std::shared_ptr<Format> format) 61{ 62 format_ = format; 63} 64} // namespace WuKong 65} // namespace OHOS 66