[641] | 1 | #include "pass_through_filter.hpp" |
---|
[1704] | 2 | #include "workflow_graph.hpp" |
---|
| 3 | #include "field.hpp" |
---|
| 4 | #include "file.hpp" |
---|
[641] | 5 | |
---|
| 6 | namespace xios |
---|
| 7 | { |
---|
| 8 | CPassThroughFilter::CPassThroughFilter(CGarbageCollector& gc) |
---|
| 9 | : CFilter(gc, 1, this) |
---|
[1704] | 10 | { |
---|
| 11 | } |
---|
[641] | 12 | |
---|
[1704] | 13 | void CPassThroughFilter::buildGraph(std::vector<CDataPacketPtr> data) |
---|
| 14 | { |
---|
| 15 | bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; |
---|
| 16 | // bool building_graph = this->tag ? data[0]->timestamp >= this->field->field_graph_start && data[0]->timestamp <= this->field->field_graph_end : false; |
---|
| 17 | |
---|
| 18 | if(building_graph) |
---|
| 19 | { |
---|
| 20 | // std::cout<<"CPassThroughFilter::apply field_id = "<<this->field->getId()<<" start = "<<start_graph<<" end = "<<end_graph<<std::endl; |
---|
| 21 | this->filterID = InvalidableObject::filterIdGenerator++; |
---|
| 22 | int edgeID = InvalidableObject::edgeIdGenerator++; |
---|
| 23 | |
---|
| 24 | CWorkflowGraph::allocNodeEdge(); |
---|
| 25 | |
---|
| 26 | CWorkflowGraph::addNode(this->filterID, "Pass Through Filter\\n("+data[0]->field->getId()+")", 2, 1, 1, data[0]); |
---|
| 27 | (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; |
---|
| 28 | |
---|
| 29 | (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); |
---|
| 30 | if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | if(CWorkflowGraph::build_begin) |
---|
| 34 | { |
---|
| 35 | CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); |
---|
| 36 | (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0; |
---|
| 37 | } |
---|
| 38 | else CWorkflowGraph::build_begin = true; |
---|
| 39 | |
---|
| 40 | data[0]->src_filterID=this->filterID; |
---|
| 41 | data[0]->distance++; |
---|
| 42 | |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | data[0]->field = this->field; |
---|
| 46 | } |
---|
| 47 | |
---|
[641] | 48 | CDataPacketPtr CPassThroughFilter::apply(std::vector<CDataPacketPtr> data) |
---|
| 49 | { |
---|
[1704] | 50 | if(CXios::isClient) buildGraph(data); |
---|
[641] | 51 | return data[0]; |
---|
| 52 | } |
---|
| 53 | } // namespace xios |
---|