当前位置: 首页>>代码示例>>C++>>正文


C++ StatusCode::isSuccess方法代码示例

本文整理汇总了C++中StatusCode::isSuccess方法的典型用法代码示例。如果您正苦于以下问题:C++ StatusCode::isSuccess方法的具体用法?C++ StatusCode::isSuccess怎么用?C++ StatusCode::isSuccess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StatusCode的用法示例。


在下文中一共展示了StatusCode::isSuccess方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initialize

/// Initialize Particle Gun parameters
StatusCode ConstPtParticleGun::initialize() {
  StatusCode sc = GaudiTool::initialize();
  if (!sc.isSuccess()) return sc;

  IRndmGenSvc* randSvc = svc<IRndmGenSvc>("RndmGenSvc", true);
  sc = m_flatGenerator.initialize(randSvc, Rndm::Flat(0., 1.));
  if (!sc.isSuccess()) return Error("Cannot initialize flat generator");

  // check momentum and angles
  if ((m_minEta > m_maxEta) || (m_minPhi > m_maxPhi)) return Error("Incorrect values for eta or phi!");

  m_deltaPhi = m_maxPhi - m_minPhi;
  m_deltaEta = m_maxEta - m_minEta;

  // setup particle information
  m_masses.clear();
  auto pd = Pythia8::ParticleData();

  info() << "Particle type chosen randomly from :";
  PIDs::iterator icode;
  for (icode = m_pdgCodes.begin(); icode != m_pdgCodes.end(); ++icode) {
    info() << " " << *icode;
    m_masses.push_back(pd.m0(*icode));
  }

  info() << endmsg;

  info() << "Eta range: " << m_minEta << "  <-> " << m_maxEta << endmsg;
  info() << "Phi range: " << m_minPhi / Gaudi::Units::rad << " rad <-> " << m_maxPhi / Gaudi::Units::rad << " rad"
         << endmsg;

  return sc;
}
开发者ID:HEP-FCC,项目名称:FCCSW,代码行数:34,代码来源:ConstPtParticleGun.cpp

示例2: initialize

    /// Initialize
    virtual StatusCode initialize()
    {
      MsgStream log(msgSvc(), name());
      StatusCode sc = service("CounterSvc", m_cntSvc, true);
      if ( !sc.isSuccess() )    {
        log << MSG::ERROR << "Could not connect to CounterSvc." << endmsg;
        return sc;
      }
      sc = m_cntSvc->create(m_counterBaseName, "EventCount", 1000, m_evtCount);
      if ( !sc.isSuccess() )    {
        log << MSG::ERROR << "Could not create counter CounterTest::EventCount." << endmsg;
        return sc;
      }
      m_total = m_cntSvc->create(m_counterBaseName, "TotalCount").counter();
      try  {
        m_total = m_cntSvc->create(m_counterBaseName, "TotalCount").counter();
      }
      catch( std::exception& e)  {
        log << MSG::ALWAYS << "Exception: " << e.what() << endmsg;
      }
      ICounterSvc::Printout p(m_cntSvc);
      m_cntSvc->print(m_counterBaseName, "EventCount", p).ignore();
      m_cntSvc->print(m_counterBaseName, p).ignore();
      //
      m_cntSvc->create(m_counterBaseName, "Eff1") ;
      m_cntSvc->create(m_counterBaseName, "Eff2") ;
      m_cntSvc->create(m_counterBaseName, "Sum") ;

      return sc ;
    }
开发者ID:atlas-org,项目名称:gaudi,代码行数:31,代码来源:CounterSvcAlg.cpp

示例3: createDirectory

//------------------------------------------------------------------------------
DataObject* HistogramSvc::createDirectory(CSTR parentDir,CSTR subDir) {
  DataObject*  directory = new DataObject();
  if (0 != directory)  {
    DataObject* pnode;
    StatusCode status = DataSvc::retrieveObject(parentDir, pnode);
    if(status.isSuccess()) {
      status = DataSvc::registerObject(pnode, subDir, directory);
      if (!status.isSuccess())   {
        MsgStream log(msgSvc(), name());
        log << MSG::ERROR << "Unable to create the histogram directory: "
                          << parentDir << "/" << subDir << endmsg;
        delete directory;
        return 0;
      }
    }
    else {
      MsgStream log(msgSvc(), name());
      log << MSG::ERROR << "Unable to create the histogram directory: "
                        << parentDir << "/" << subDir << endmsg;
      delete directory;
      return 0;
    }
  }
  return directory;
}
开发者ID:l1calo,项目名称:gaudi,代码行数:26,代码来源:HistogramSvc.cpp

示例4: previous

/// Get previous iteration item from the event loop context, but skip jump elements
StatusCode EventSelector::previous(Context& refCtxt, int jump) const  {
  EvtSelectorContext *pIt  = dynamic_cast<EvtSelectorContext*>(&refCtxt);
  if ( pIt && jump > 0 )    {
    StatusCode sc = StatusCode::SUCCESS;
    for ( int i = 0; i < jump && sc.isSuccess(); ++i ) {
      const EventSelectorDataStream* s = m_streamtool->getStream(pIt->ID());
      Context* it = pIt->context();
      IEvtSelector* sel = s->selector();
      if ( it && sel )    { // First exploit the current stream
                            // This stream is empty: advance to the next stream
        sc = sel->previous(*it);  // This stream is empty: advance to the next stream
        if ( !sc.isSuccess() )   {
          sc = lastOfPreviousStream(true, *pIt);
        }
        else  {
          pIt->increaseCounters(false);
          pIt->set(it, 0);
        }
        printEvtInfo(pIt);
        if ( !sc.isSuccess() ) {
          return sc;
        }
      }
      pIt->increaseCounters(false);
    }
    return sc;
  }
  printEvtInfo(pIt);
  return StatusCode::FAILURE;
}
开发者ID:l1calo,项目名称:gaudi,代码行数:31,代码来源:EventSelector.cpp

示例5: log

// IEvtSelector::first()
StatusCode
EventSelector::firstOfNextStream(bool shutDown, EvtSelectorContext& iter) const {
  StatusCode status = StatusCode::SUCCESS;
  IDataStreamTool::size_type iter_id = (m_reconfigure) ? 0 : iter.ID()+1;
  if ( m_reconfigure ) const_cast<EventSelector*>(this)->m_reconfigure = false;
  if ( shutDown )   {
    if ( iter.ID() >= 0 && iter.ID() < (long)m_streamtool->size() )   {
      const EventSelectorDataStream* s = m_streamtool->getStream(iter.ID());
      if ( s->isInitialized() )    {
        EventSelector* thisPtr = const_cast<EventSelector*>(this);
        if ( s->selector() && iter.context() )  {
          Context* ctxt = iter.context();
          s->selector()->releaseContext(ctxt).ignore();
          iter.set(0,0);
        }
        status = thisPtr->m_streamtool->finalizeStream(const_cast<EventSelectorDataStream*>(s));
        iter.set(0,0);
      }
    }
  }

  const EventSelectorDataStream* s ;
  status = m_streamtool->getNextStream( s , iter_id );

  if ( status.isSuccess() )   {

    if(s!=NULL) {
    if ( !s->isInitialized() )    {
      EventSelector* thisPtr = const_cast<EventSelector*>(this);
      status = thisPtr->m_streamtool->initializeStream(const_cast<EventSelectorDataStream*>(s));
    }

    if ( status.isSuccess() ) {
      const IEvtSelector* sel = s->selector();
      if ( sel )    {
        Context* ctxt = 0;
        status = sel->createContext(ctxt);
        if ( status.isSuccess() )   {
          status = sel->resetCriteria(s->criteria(), *ctxt);
          if ( status.isSuccess() )   {
            MsgStream log(msgSvc(), name());
            iter.set(this, iter_id, ctxt, 0);
            log << MSG::INFO << *s << endmsg;
            m_incidentSvc->fireIncident(Incident(s->dbName(),IncidentType::BeginInputFile));
            return StatusCode::SUCCESS;
          }
        }
      }
    }
      m_incidentSvc->fireIncident(Incident(s->dbName(),IncidentType::FailInputFile));
    }
  }

  iter.set(this, -1, 0, 0);
  status.setChecked();
  //m_incidentSvc->fireIncident(Incident(s->dbName(),IncidentType::FailInputFile));
  return StatusCode::FAILURE;
}
开发者ID:l1calo,项目名称:gaudi,代码行数:59,代码来源:EventSelector.cpp

示例6: connectInput

//------------------------------------------------------------------------------
StatusCode HistogramSvc::connectInput(CSTR ident) {
  MsgStream log (msgSvc(), name());
  DataObject* pO = 0;
  StatusCode status = this->findObject(m_rootName, pO);
  if (status.isSuccess())   {
    Tokenizer tok(true);
    std::string::size_type loc = ident.find(" ");
    std::string filename, auth, svc = "", typ = "";
    std::string logname = ident.substr(0,loc);
    tok.analyse(ident.substr(loc+1,ident.length()), " ", "", "", "=", "'", "'");
    for (Tokenizer::Items::iterator i = tok.items().begin();
         i != tok.items().end(); i++) {
      CSTR tag = (*i).tag();
      switch(::toupper(tag[0]))   {
      case 'F':   // FILE='<file name>'
      case 'D':   // DATAFILE='<file name>'
        filename = (*i).value();
        break;
      case 'T':   // TYP='<HBOOK,ROOT,OBJY,...>'
        typ = (*i).value();
        break;
      default:
        break;
      }
    }
    if (typ.length() > 0)    {
      // Now add the registry entry to the store
      std::string entryname = m_rootName;
      entryname += '/';
      entryname += logname;
      GenericAddress* pA = 0;
      switch(::toupper(typ[0])) {
      case 'H':
        pA=new GenericAddress(HBOOK_StorageType,CLID_StatisticsFile,
                              filename,entryname,0,'O');
        break;
      case 'R':
        pA=new GenericAddress(ROOT_StorageType,CLID_StatisticsFile,
                              filename,entryname,0,'O');
        break;
      }
      if (0 != pA)    {
        status = registerAddress(pO, logname, pA);
        if (status.isSuccess())    {
          log << MSG::INFO << "Added stream file:" << filename
              << " as " << logname << endmsg;
          return status;
        }
        pA->release();
      }
    }
  }
  log << MSG::ERROR << "Cannot add " << ident << " invalid filename!" << endmsg;
  return StatusCode::FAILURE;
}
开发者ID:l1calo,项目名称:gaudi,代码行数:56,代码来源:HistogramSvc.cpp

示例7: execute

// Work entry point
StatusCode EvtCollectionStream::execute() {
  StatusCode status = (m_pTupleSvc) ? StatusCode::SUCCESS : StatusCode::FAILURE;
  if ( status.isSuccess() )   {
    for ( Items::iterator i = m_itemList.begin(); i != m_itemList.end(); i++ )    {
      StatusCode iret = m_pTupleSvc->writeRecord((*i)->path());
      if ( !iret.isSuccess() )    {
        status = iret;
      }
    }
  }
  return status;
}
开发者ID:atlas-org,项目名称:gaudi,代码行数:13,代码来源:EvtCollectionStream.cpp

示例8: reinitialize

//--------------------------------------------------------------------------------------------
// implementation of IService::reinitialize
//--------------------------------------------------------------------------------------------
StatusCode MTEventLoopMgr::reinitialize() {

  // initilaize the base class
  StatusCode sc = MinimalEventLoopMgr::reinitialize();

  MsgStream log(msgSvc(), name());
  if( sc.isFailure() ) {
    log << MSG::DEBUG << "Error Initializing base class MinimalEventLoopMgr." << endmsg;
    return sc;
  }

  // Check to see whether a new Event Selector has been specified
  setProperty(m_appMgrProperty->getProperty("EvtSel"));
  if( m_evtsel != "NONE" || m_evtsel.length() == 0) {
    IEvtSelector* theEvtSel;
    IService*     theSvc;
    sc = service( "EventSelector", theEvtSel );
    sc = service( "EventSelector", theSvc );
    if( sc.isSuccess() && ( theEvtSel != m_evtSelector ) ) {
      // Setup Event Selector
      m_evtSelector = theEvtSel;
      if (theSvc->state() == IService::INITIALIZED) {
        sc = theSvc->reinitialize();
        if( sc.isFailure() ){
          log << MSG::ERROR << "Failure Reinitializing EventSelector "
              << theSvc->name( ) << endmsg;
          return sc;
        }
      } else {
        sc = theSvc->initialize();
        if( sc.isFailure() ){
          log << MSG::ERROR << "Failure Initializing EventSelector "
              << theSvc->name( ) << endmsg;
          return sc;
        }
      }
      sc = theEvtSel->createContext(m_evtCtxt);
      if( !sc.isSuccess() ) {
        log << MSG::ERROR << "Can not create Context "
            << theSvc->name( ) << endmsg;
        return sc;
      }
      log << MSG::INFO << "EventSelector service changed to "
          << theSvc->name( ) << endmsg;
    }
  }
  else {
    m_evtSelector = 0;
    m_evtCtxt = 0;
  }
  return StatusCode::SUCCESS;
}
开发者ID:atlas-org,项目名称:gaudi,代码行数:55,代码来源:MTEventLoopMgr.cpp

示例9: sysInitialize

// IService::sysInitialize
StatusCode Service::sysInitialize() {
  StatusCode sc;

  try {
    m_targetState = Gaudi::StateMachine::INITIALIZED;
    Gaudi::Guards::AuditorGuard guard(this,
                                      // check if we want to audit the initialize
                                      (m_auditorInitialize) ? auditorSvc().get() : 0,
                                      IAuditor::Initialize);
    if ((name() != "MessageSvc") && msgSvc().isValid()) // pre-set the outputLevel from the MessageSvc value
      m_outputLevel = msgSvc()->outputLevel(name());
    sc = initialize(); // This should change the state to Gaudi::StateMachine::CONFIGURED
    if (sc.isSuccess())
      m_state = m_targetState;
    return sc;
  }
  catch ( const GaudiException& Exception )  {
    fatal() << "in sysInitialize(): exception with tag=" << Exception.tag()
        << " is caught" << endmsg;
    error() << Exception  << endmsg;
    //	  Stat stat( chronoSvc() , Exception.tag() );
  }
  catch( const std::exception& Exception ) {
    fatal() << "in sysInitialize(): standard std::exception is caught" << endmsg;
    error() << Exception.what()  << endmsg;
    //	  Stat stat( chronoSvc() , "*std::exception*" );
  }
  catch(...) {
    fatal() << "in sysInitialize(): UNKNOWN Exception is caught" << endmsg;
    //	  Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
  }

  return StatusCode::FAILURE;
}
开发者ID:atlas-org,项目名称:gaudi,代码行数:35,代码来源:Service.cpp

示例10: initialize

//=============================================================================
// Initialization
//=============================================================================
StatusCode PatPixelHitManager::initialize() {
	m_event_number = 0;
	m_max_hits = 0;
  StatusCode sc = GaudiTool::initialize(); // must be executed first
  if ( sc.isFailure() ) return sc;  // error printed already by GaudiAlgorithm

  if ( msgLevel(MSG::DEBUG) ) debug() << "==> Initialize" << endmsg;

  m_veloPix      = getDet<DeVeloPix>( DeVeloPixLocation::Default );

  // make sure we are up-to-date on populated VELO stations
  registerCondition( (*(m_veloPix->leftSensorsBegin()))->geometry(), &PatPixelHitManager::rebuildGeometry );
  registerCondition( (*(m_veloPix->rightSensorsBegin()))->geometry(), &PatPixelHitManager::rebuildGeometry );

  // first update
  sc = updMgrSvc()->update(this);
  if(!sc.isSuccess()) {
    return Error( "Failed to update station structure." );
  }

  // invalidate measurements at the beginning of each event
  incSvc()->addListener(this, IncidentType::BeginEvent);

  m_pool.resize( 10000 );
  m_nextInPool = m_pool.begin();
  m_maxSize = 0;
  m_eventReady = false;

  return StatusCode::SUCCESS;
}
开发者ID:dcampora,项目名称:gpu-manager,代码行数:33,代码来源:PatPixelHitManager.cpp

示例11: tokenize

// ============================================================================
StatusCode Tuples::TupleObj::fill( const char*  format ... )
{
  // check the underlying tuple
  if ( invalid()      ) { return InvalidTuple ; }
  // decode format string into tokens
  Tokens tokens ;
  tokenize( format , tokens , " ,;" );
  if ( tokens.empty() ) { return StatusCode::SUCCESS ; }
  /// decode arguments
  va_list valist ;
  va_start( valist , format ) ;
  // loop over all tokens
  StatusCode status = StatusCode::SUCCESS ;
  for( Tokens::const_iterator token = tokens.begin() ;
       tokens.end() != token && status.isSuccess() ; ++token )
  {
    const double val = va_arg( valist , double );
    status = column( *token , val );
    if( status.isFailure() )
    { Error ( "fill(): Can not add column '" + *token + "' " ) ; }
  }
  // mandatory !!!
  va_end( valist );
  //
  return status ;
}
开发者ID:atlas-org,项目名称:gaudi,代码行数:27,代码来源:TupleObj.cpp

示例12: dataMgr

//-----------------------------------------------------------------------------
/// Switch to object directory (=Parent directory)
TDirectory* RootHistCnv::RConverter::changeDirectory(DataObject* pObject)
//-----------------------------------------------------------------------------
{
  if ( pObject )    {
    IRegistry* pReg = pObject->registry();
    if ( pReg )    {
      SmartIF<IDataManagerSvc> dataMgr(dataProvider());
      if ( dataMgr.isValid() )    {
        IRegistry* pParentReg = 0;
        StatusCode status = dataMgr->objectParent(pReg, pParentReg);
        if ( status.isSuccess() )  {
          IOpaqueAddress* pParAddr = pParentReg->address();
          if ( pParAddr )   {
            TDirectory* pParentDir = (TDirectory*)pParAddr->ipar()[0];
            if ( pParentDir )   {
              gDirectory->cd(pParentDir->GetPath());
              return pParentDir;
            }
          }
        }
      }
    }
  }
  return 0;
}
开发者ID:atlas-org,项目名称:gaudi,代码行数:27,代码来源:RConverter.cpp

示例13: createPath

//------------------------------------------------------------------------------
DataObject* HistogramSvc::createPath(CSTR newPath)  {
  std::string tmpPath = newPath;
  if (tmpPath[0] != SEPARATOR)    {
    tmpPath.insert(tmpPath.begin(), SEPARATOR);
    tmpPath.insert(tmpPath.begin(), m_rootName.begin(), m_rootName.end());
  }
  // Remove trailing "/" from newPath if it exists
  if (tmpPath.rfind(SEPARATOR) == tmpPath.length()-1) {
    tmpPath.erase(tmpPath.rfind(SEPARATOR),1);
  }
  DataObject* pObject = 0;
  StatusCode sc = DataSvc::findObject(tmpPath, pObject);
  if(sc.isSuccess()) {
    return pObject;
  }
  int sep = tmpPath.rfind(SEPARATOR);
  std::string rest(tmpPath, sep+1, tmpPath.length()-sep);
  std::string subPath(tmpPath, 0, sep);
  if(0 != sep) {
    createPath(subPath);
  }
  else {
    MsgStream log(msgSvc(), name());
    log << MSG::ERROR << "Unable to create the histogram path" << endmsg;
    return 0;
  }
  pObject = createDirectory(subPath, rest);
  return pObject;
}
开发者ID:l1calo,项目名称:gaudi,代码行数:30,代码来源:HistogramSvc.cpp

示例14: initialize

/// IService implementation: Db event selector override
StatusCode StagedIODataManager::initialize() {
  // Initialize base class
  StatusCode status = Service::initialize();
  MsgStream log(msgSvc(), name());
  log << MSG::DEBUG << "StagedIODataManager initializing..." << endmsg;
  if ( !status.isSuccess() ) {
    log << MSG::ERROR << "Error initializing base class Service!" << endmsg;
    return status;
  }
  // Retrieve conversion service handling event iteration
  m_catalog = serviceLocator()->service(m_catalogSvcName);
  if( !m_catalog.isValid() ) {
    log << MSG::ERROR
    << "Unable to localize interface IFileCatalog from service:"
    << m_catalogSvcName << endmsg;
    return StatusCode::FAILURE;
  }
  m_incSvc = serviceLocator()->service("IncidentSvc");
  if( !m_incSvc.isValid() ) {
    log << MSG::ERROR << "Error initializing IncidentSvc Service!" << endmsg;
    return status;
  }

  m_stager = serviceLocator()->service("FileStagerSvc", false);
  if( !m_stager.isValid() ) {
    log << MSG::ERROR << "Error initializing File Stager Service!" << endmsg;
    return status;
  }
  return status;
}
开发者ID:remenska,项目名称:Gaudi-FileStager,代码行数:31,代码来源:StagedIODataManager.cpp

示例15: log

StatusCode
StatusCodeSvc::initialize() {

  StatusCode sc = Service::initialize();
  if (!sc.isSuccess()) return sc;

  MsgStream log( msgSvc(), name() );
  log << MSG::INFO << "initialize" << endmsg;

  std::vector<std::string>::const_iterator itr;
  for (itr = m_pFilter.value().begin(); itr != m_pFilter.value().end(); ++itr) {
    // we need to do this if someone has gotten to regFnc before initialize

    string fnc,lib;
    parseFilter(*itr,fnc,lib);

    if (fnc != "") {
      filterFnc(fnc);
      m_filterfnc.insert(fnc);
    }

    if (lib != "") {
      filterLib(lib);
      m_filterlib.insert(lib);
    }

  }

  return StatusCode::SUCCESS;

}
开发者ID:atlas-org,项目名称:gaudi,代码行数:31,代码来源:StatusCodeSvc.cpp


注:本文中的StatusCode::isSuccess方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。