1 | #include "pass_through_filter.hpp" |
---|
2 | #include "workflow_graph.hpp" |
---|
3 | #include "field.hpp" |
---|
4 | |
---|
5 | namespace xios |
---|
6 | { |
---|
7 | CPassThroughFilter::CPassThroughFilter(CGarbageCollector& gc) |
---|
8 | : CFilter(gc, 1, this) |
---|
9 | { |
---|
10 | } |
---|
11 | |
---|
12 | CDataPacketPtr CPassThroughFilter::apply(std::vector<CDataPacketPtr> data) |
---|
13 | { |
---|
14 | bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; |
---|
15 | |
---|
16 | if(building_graph) |
---|
17 | { |
---|
18 | std::cout<<"CPassThroughFilter::apply tag = "<<this->tag<<" start = "<<start_graph<<" end = "<<end_graph<<std::endl; |
---|
19 | this->filterID = InvalidableObject::filterIdGenerator++; |
---|
20 | int edgeID = InvalidableObject::edgeIdGenerator++; |
---|
21 | if(CWorkflowGraph::mapFilters_ptr_with_info==0) CWorkflowGraph::mapFilters_ptr_with_info = new std::unordered_map <int, graph_info_box_node>; |
---|
22 | |
---|
23 | (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_name = "Pass Through Filter"; |
---|
24 | (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_class = 5; |
---|
25 | (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_filled = 1; |
---|
26 | (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb = 1; |
---|
27 | (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].date = data[0]->date; |
---|
28 | (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].timestamp = data[0]->timestamp; |
---|
29 | |
---|
30 | if(CWorkflowGraph::mapFieldToFilters_ptr_with_info==0) CWorkflowGraph::mapFieldToFilters_ptr_with_info = new std::unordered_map <int, graph_info_box_edge >; |
---|
31 | |
---|
32 | if(CWorkflowGraph::build_begin) |
---|
33 | { |
---|
34 | CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); |
---|
35 | (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0; |
---|
36 | } |
---|
37 | else CWorkflowGraph::build_begin = true; |
---|
38 | |
---|
39 | data[0]->src_filterID=this->filterID; |
---|
40 | |
---|
41 | } |
---|
42 | data[0]->field = this->field; |
---|
43 | |
---|
44 | |
---|
45 | return data[0]; |
---|
46 | } |
---|
47 | |
---|
48 | } // namespace xios |
---|