示例#1
0
bool SonarFilter::Iterate()
{
  AppCastingMOOSApp::Iterate();

  CMOOSVariable * pDepth = GetMOOSVar("Depth");
  double dfDepth = -1;
  if (pDepth->IsFresh()) {
    dfDepth = pDepth->GetDoubleVal();
    pDepth->SetFresh(false);
    // This sets a static 0.5m min depth at this time
    if (dfDepth > MIN_DEPTH_LIMIT) {
      m_last_depth = dfDepth;
      m_fresh_depth = m_nadir_filter.IngestValue(dfDepth);
    }
  }
  pDepth = GetMOOSVar("Depth_Port");
  dfDepth = -1;
  if (pDepth->IsFresh()) {
    dfDepth = pDepth->GetDoubleVal();
    pDepth->SetFresh(false);
    if (dfDepth > MIN_DEPTH_LIMIT) {
      m_fresh_depth = m_port_filter.IngestValue(dfDepth);
    }
  }
  pDepth = GetMOOSVar("Depth_Stbd");
  dfDepth = -1;
  if (pDepth->IsFresh()) {
    dfDepth = pDepth->GetDoubleVal();
    pDepth->SetFresh(false);
    if (dfDepth > MIN_DEPTH_LIMIT) {
      m_fresh_depth = m_stbd_filter.IngestValue(dfDepth) || m_fresh_depth;
    }
  }

  if (m_fresh_depth) {
    string swath_message = GenerateSwathMessage();
    SetMOOSVar("Swath", swath_message, MOOSTime());
    m_fresh_depth = false;
  }

  bool published = PublishFreshMOOSVariables();

  AppCastingMOOSApp::PostReport();
  return(published);
}
bool CMOOSRemoteLite::PrintCustomSummary()
{
    ostringstream os;

    os<<"\n******    User Custom Summary    ******"<<endl;

    STRING_LIST::iterator p;

    for(p = m_CustomSummaryList.begin();p!=m_CustomSummaryList.end();p++)
    {
        string sWhat = *p;

        CMOOSVariable * pVar = GetMOOSVar(sWhat);

        if(pVar==NULL)
            continue;

        //make left justified
        os.setf(ios::left);
        os<<setw(20)<<sWhat.c_str()<<"t=";

        os.setf(ios::fixed);

        if(!pVar->IsFresh())
        {
            os<<setw(10)<<"****";
            os<<setw(3)<<" : ";
            os<<setw(10)<<"****";
        }
        else
        {
            os<<setw(10)<<setprecision(1)<<pVar->GetTime()-GetAppStartTime();
            os<<setw(3)<<" : ";

            if(pVar->IsDouble())
            {
                os<<setw(10)<<setprecision(1)<<pVar->GetDoubleVal();
            }
            else
            {
                os<<setw(10)<<pVar->GetStringVal().c_str();;
            }
        }
        os<<endl;
    }
    os<<ends;

    MOOSTrace("%s",string(os.str()).c_str());

    return true;

}