Exemple #1
0
CDoid *CRouteMap::FindService(TUInt32 uServiceId)
{
    TUInt32 uSvr = CMessageHeader::GetServiceID(uServiceId);
    TplMultiKeyMapNode<CRoute,TUInt32>::Iterator it = m_tServiceRoute.GetItemByKey(uSvr);
    CRoute *pRount = it;
    CRoute *pRtn(NULL);
    while ((pRount)&&(pRount->m_uKey == uSvr))
    {
        if ((uServiceId >= pRount->m_uIdBegin)&&(uServiceId < pRount->m_uIdEnd))
        {
            if (pRtn)
            {
                if (pRtn->m_uPriority > pRount->m_uPriority) //计算权重.
                {
                    pRtn = pRount;
                }
            }
            else
            {
                pRtn = pRount;
            }
        }
        ++it;
        pRount = it;
    }
    if (pRtn)
    {
        return &pRtn->m_tRouteTo;
    }
    return NULL;
}
Exemple #2
0
CMDIFrame *CMDIfileManager::FindWindowByName(
  const wxString &sPath, bool bRaise)
{
  CMDIFrame *pRtn(NULL);
  wxFileName fn(sPath);
  fn.MakeAbsolute();
  wxString sFileName = fn.GetFullPath();
  wxString sCheck;
  for(CMDI_WF::iterator itr = m_mapWindowFile.begin();
    _IteratorOK(itr);
    ++itr)
  {
    wxFileName fnCheck( itr->first->GetFileName() );
    fnCheck.MakeAbsolute();
    sCheck = fnCheck.GetFullPath();
    if(nwxString::FileNameStringEqual(sCheck,sFileName))
    {
      pRtn = itr->first;
      if(bRaise)
      {
        pRtn->RaiseWindow();
      }
      break;
    }
  }
  return pRtn;
}
Exemple #3
0
CVolume *CVolumes::Create(
  const wxString &sCopyFrom, const wxString &_sName)
{
  wxString sPath;
  wxString sName(_sName);
  MapVolume::iterator itrm;
  CVolume *pRtn(NULL);
  CVolume *pCopyFrom;

  nwxString::Trim(&sName);
  if(sName.IsEmpty())
  {
    m_sLastError = VOLUME_STRING " name has not been specified.";
  }
  else if(Find(sName) != NULL)
  {
    _SetErrorNameExists(sName);
  }
  else if( (pCopyFrom = Find(sCopyFrom)) == NULL )
  {
    m_sLastError = "Cannot create new " Volume_string " from ";
    m_sLastError.Append(sCopyFrom);
    m_sLastError.Append(".\nThe " Volume_string " was not found.");
    wxASSERT_MSG(0,m_sLastError);
  }
  else if( pCopyFrom->IsLocked() && !pCopyFrom->HasLock() )
  {
    m_sLastError = "Cannot create new " Volume_string " from ";
    m_sLastError.Append(sCopyFrom);
    m_sLastError.Append("\nbecause it is locked by ");
    m_sLastError.Append(pCopyFrom->GetLockUser());
    wxASSERT_MSG(0,m_sLastError);
  }
  else if(_BuildNewPath(pCopyFrom,&sPath))
  {
    auto_ptr<CVolume> apRtn(new CVolume(sPath));

    if(!(apRtn->IsOK() && apRtn->InitNewVolume(sName)))
    {
        m_sLastError = 
          "Could not create new " Volume_string ".\n"
          "Please check space on disk drive";
    }
    else if((itrm = m_mapVol.insert(MapVolume::value_type(sName,apRtn.get()))) == m_mapVol.end())
    {
      m_sLastError =
        "Could not add new " Volume_string " to the set.\n"
        "System may not have sufficient memory.";
    }
    else
    {
      _SetModified();
      pRtn = apRtn.release();
    }
  }
  return pRtn;
}
Exemple #4
0
COARartifact *COARchannelAlert::GetArtifactByID(int nID)
{
  vector<COARartifact *>::iterator itr;
  COARartifact *pRtn(NULL);
  for(itr = m_vpArtifact.begin();
    (pRtn == NULL) && (itr != m_vpArtifact.end());
    ++itr)
  {
    if((*itr)->GetID() == nID)
    {
      pRtn = *itr;
    }
  }
  return pRtn;
}
Exemple #5
0
CLabPositiveControl *CGridAllelePosCtrl::_GetPosCtrl()
{
  CLabPositiveControl *pRtn(NULL);
  vector<CLabPositiveControl *> *pvpCtrl = m_pData->Get();
  if(pvpCtrl->empty())
  {
    pRtn = new CLabPositiveControl;
  }
  else
  {
    pRtn = *(pvpCtrl->rbegin());
    pvpCtrl->pop_back();
  }
  return pRtn;
}
COARsample *COARfile::GetSampleByName(const wxString &sName)
{
  COARsample *pRtn(NULL);
  vector<COARsample *> *vpSample(m_vpTable.Get());
  vector<COARsample *>::iterator itr;
  for(itr = vpSample->begin();
    itr != vpSample->end();
    ++itr)
  {
    if(nwxString::FileNameStringEqual(sName,(*itr)->GetName()))
    {
      pRtn = *itr;
      break;
    }
  }
  return pRtn;
}
Exemple #7
0
COARfile *CMDIfileManager::FindOARfile(const wxString &sName)
{
  CMDI_FW::iterator itr;
  COARfile *pRtn(NULL);
  for(itr = m_mapFileWindows.begin();
    itr != m_mapFileWindows.end();
    ++itr)
  {
    if(nwxString::FileNameStringEqual(
      itr->first->GetLastFileName(),sName))
    {
      pRtn = itr->first;
      break;
    }
  }
  return pRtn;
}
Exemple #8
0
CLabLocus *CGridAlleleBase::_BuildLabLocus(
  vector<CLabLocus *> *pvpLocus,
  const wxString &sLocusName, 
  const wxString &sAlleles, 
  bool bRequire3)
{
  vector<wxString> vs;
  CLabLocus *pRtn(NULL);
  size_t n = CLabLocus::BuildList(sAlleles,&vs);
  bool bOK = (n > 0) && ((n == 3) || (!bRequire3));
  if(bOK)
  {
    pRtn = _NewLabLocus(pvpLocus,sLocusName);
    *(pRtn->GetAlleles()) = vs;
  }
  return pRtn;
}
Exemple #9
0
CFrameAnalysis *CMDIfileManager::FindAnalysisFrame(COARfile *pFile)
{
  CFrameAnalysis *pRtn(NULL);
  CMDI_FW::iterator itr = m_mapFileWindows.find(pFile);
  if(_IteratorOK(itr))
  {
    std::set<CMDIFrame *>::iterator itrF;
    for(itrF = itr->second.begin();
      itrF != itr->second.end();
      ++itrF)
    {
      if((*itrF)->GetType() == CMDIFrame::FRAME_ANALYSIS)
      {
        pRtn = (CFrameAnalysis *)(*itrF);
        break;
      }
    }
  }
  return pRtn;
}
Exemple #10
0
CPlotChannel *CPlotData::FindChannel(unsigned int n)
{
  CPlotChannel *pRtn(NULL);
  size_t nSize = m_vChannels.size();
  map<unsigned int,CPlotChannel *>::iterator itr;
  if(m_mapChannels.empty() && (n < nSize))
  {
    pRtn = m_vChannels.at(n);
    if(pRtn->m_nr != (int)n)
    {
      CPlotChannel *p;
      // not ordered, build map
      pRtn = NULL;
      for(size_t i = 0; i < nSize; i++)
      {
        p = m_vChannels.at(i);
        itr = m_mapChannels.find(p->m_nr);
        if(itr != m_mapChannels.end())
        {
          m_mapChannels.erase(itr);
        }
        m_mapChannels.insert(
          map<unsigned int,CPlotChannel *>::value_type(
            p->m_nr,p));
      }
    }
  }
  if(pRtn == NULL)
  {
    itr = m_mapChannels.find(n);
    if(itr != m_mapChannels.end())
    {
      pRtn = itr->second;
    }
  }
  return pRtn;
}