bool CMOOSApp::SetMOOSVar(const CMOOSVariable& Var) { MOOSVARMAP::iterator p = m_MOOSVars.find(Var.GetName ()); if(p==m_MOOSVars.end()) return false; p->second = Var; p->second.SetFresh (true); return true; }
bool CMOOSLogger::Iterate() { double dfTimeNow = MOOSTime(); //look to do a synchronous log.... if(m_bSynchronousLog) { if(dfTimeNow-m_dfLastSyncLogTime>m_dfSyncLogPeriod) { m_dfLastSyncLogTime = dfTimeNow; DoSyncLog(dfTimeNow); //finally everything is now stale.. MOOSVARMAP::iterator q; for(q = m_MOOSVars.begin();q!=m_MOOSVars.end();q++) { q->second.SetFresh(false); } } } //check monitored variables if(dfTimeNow-m_dfLastMonitorTime>DEFAULT_MONITOR_TIME) { m_dfLastMonitorTime = dfTimeNow; VARIABLE_TIMER_MAP::iterator p; int nMissing = 0; for(p = m_MonitorMap.begin();p!=m_MonitorMap.end();p++) { CMOOSVariable* pV = GetMOOSVar(p->first); if(pV) { double dfTolerance = p->second; if(pV->GetAge(dfTimeNow)>dfTolerance) { MOOSTrace("Monitored Variable \"%s\" is not appearing\n",pV->GetName().c_str()); nMissing++; } } } if(nMissing>0) { MOOSDebugWrite(MOOSFormat("%d monitored variable%s not being logged\n",nMissing,nMissing==1?" is":"s are")); } //piggy back on this timer to publish current log directory m_Comms.Notify("LOGGER_DIRECTORY",m_sLogDirectoryName.c_str()); } //are we requested to do wild card logging? if(m_bWildCardLogging) HandleWildCardLogging(); //finally flush all files to be safe m_SyncLogFile.flush(); m_AsyncLogFile.flush(); m_SystemLogFile.flush(); return true; }