#include "client_to_model_store_filter.hpp" #include "context.hpp" #include "grid.hpp" #include "timer.hpp" #include "tracer.hpp" #include "workflow_graph.hpp" namespace xios { CClientToModelStoreFilter::CClientToModelStoreFilter(CGarbageCollector& gc, CField* field) : CInputPin(gc, 1) , gc_(gc), graphEnabled(false) { context_ = CContext::getCurrent() ; grid_ = field->getGrid() ; detectMissingValues_ = (!field->detect_missing_value.isEmpty() && !field->default_value.isEmpty() && field->detect_missing_value == true); hasMissingValue_ = !field->default_value.isEmpty() ; if (hasMissingValue_) missingValue_ = field->default_value ; detectMissingValues_ = (!field->detect_missing_value.isEmpty() && hasMissingValue_); } CConstDataPacketPtr CClientToModelStoreFilter::getPacket(Time timestamp) { CTimer timer("CStoreFilter::getPacket"); // timer.resume(); info(0)<<"ENTERING CStoreFilter::getPacket"<::const_iterator it = packets_.find(timestamp); if (it != packets_.end()) packet = it->second; else context_->eventLoop(); // if the packet is not available yet, check if it can be received timer.suspend(); } while (!packet && timer.getCumulatedTime() < timeout); // timer.resume(); traceOn() ; // timer.suspend(); if (!packet) { std::map::const_iterator it ; info(0)<<"Impossible to get the packet with timestamp = " << timestamp<first<<" "; info(0)<timestamp, packet)); // The packet is always destroyed by the garbage collector // so we register but never unregister gc_.registerObject(this, packet->timestamp); } bool CClientToModelStoreFilter::mustAutoTrigger() const { return false; } bool CClientToModelStoreFilter::isDataExpected(const CDate& date) const { return true; } void CClientToModelStoreFilter::invalidate(Time timestamp) { CInputPin::invalidate(timestamp); packets_.erase(packets_.begin(), packets_.lower_bound(timestamp)); } } // namespace xios