• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
21 namespace OHOS {
22 namespace WuKong {
23 using namespace std;
FilterData(map<string,string> data)24 void DataSet::FilterData(map<string, string> data)
25 {
26     filter_->FilterDetail(filterType_, data, dataVector_);
27 }
28 
SetFilterType(std::string filterType)29 void DataSet::SetFilterType(std::string filterType)
30 {
31     filterType_ = filterType;
32 }
SetFilterStragety(shared_ptr<Filter> filter)33 void DataSet::SetFilterStragety(shared_ptr<Filter> filter)
34 {
35     filter_ = filter;
36 }
37 
StatisticsData()38 void DataSet::StatisticsData()
39 {
40     DEBUG_LOG_STR("current dataVector length{%d}", dataVector_.size());
41     statistics_->StatisticsDetail(dataVector_, tables_);
42     dataVector_.clear();
43 }
44 
SetStatisticsStragety(shared_ptr<Statistics> statistics)45 void DataSet::SetStatisticsStragety(shared_ptr<Statistics> statistics)
46 {
47     statistics_ = statistics;
48 }
49 
FormatData(std::string name,std::string & content)50 void 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 
SetFormatStragety(std::shared_ptr<Format> format)60 void DataSet::SetFormatStragety(std::shared_ptr<Format> format)
61 {
62     format_ = format;
63 }
64 }  // namespace WuKong
65 }  // namespace OHOS
66