本文整理汇总了C++中StatusCode类的典型用法代码示例。如果您正苦于以下问题:C++ StatusCode类的具体用法?C++ StatusCode怎么用?C++ StatusCode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StatusCode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: timer
// ===========================================================================
// execute the handler
// ===========================================================================
StatusCode
DataOnDemandSvc::execHandler(const std::string& tag, Leaf& l)
{
Gaudi::Utils::LockedChrono timer ( m_timer_algs , m_locked_algs ) ;
//
if ( l.executing ) { return StatusCode::FAILURE ; } // RETURN
//
if ( 0 == l.algorithm )
{
StatusCode sc = configureHandler ( l ) ;
if ( sc.isFailure() )
{
stream()
<< MSG::ERROR
<< "Failed to configure handler for: "
<< l.name << "[" << l.type << "] " << tag << endmsg;
return sc ; // RETURN
}
}
//
Chrono atimer ( m_total ) ;
//
Protection p(l.executing);
StatusCode sc = l.algorithm->sysExecute();
if ( sc.isFailure() )
{
stream() << MSG::ERROR
<< "Failed to execute the algorithm:"
<< l.algorithm->name() << " for location:" << tag << endmsg;
return sc ; // RETURN
}
++l.num ;
//
return StatusCode::SUCCESS ;
}
示例2: DataObject
//------------------------------------------------------------------------------
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;
}
示例3: Remove
StatusCode QueryOperatorImpl::Remove(IMetadataNode* expression)
{
if(NULL == expression)
return WINI_ERROR_INVALID_PARAMETER;
INode* parent = expression->GetParent();
StatusCode status = WINI_OK;
if(parent)
{
switch(parent->GetType())
{
case WINI_QUERY: //is root expression. delete from query, query is now invalid
status = ((QueryNodeImpl*)parent)->RemoveChild(expression);
break;
case WINI_METADATA: //delete from metadata, metadata must be fixed
status = ((MetadataNodeImpl*)parent)->DeleteChild2(expression);
break;
default: //do not remove nodes of collections, datasets, etc.
return WINI_ERROR;
}
//remove query from parent
};
if(status.isOk())
delete expression;
return status;
}
示例4: 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;
}
示例5: service
StatusCode CellPositionsCaloDiscsTool::initialize() {
StatusCode sc = GaudiTool::initialize();
if (sc.isFailure()) return sc;
m_geoSvc = service("GeoSvc");
if (!m_geoSvc) {
error() << "Unable to locate Geometry service." << endmsg;
return StatusCode::FAILURE;
}
// get PhiEta segmentation
m_segmentation = dynamic_cast<dd4hep::DDSegmentation::FCCSWGridPhiEta*>(
m_geoSvc->lcdd()->readout(m_readoutName).segmentation().segmentation());
if (m_segmentation == nullptr) {
error() << "There is no phi-eta segmentation!!!!" << endmsg;
return StatusCode::FAILURE;
}
// Take readout bitfield decoder from GeoSvc
m_decoder = m_geoSvc->lcdd()->readout(m_readoutName).idSpec().decoder();
m_volman = m_geoSvc->lcdd()->volumeManager();
// check if decoder contains "layer"
std::vector<std::string> fields;
for (uint itField = 0; itField < m_decoder->size(); itField++) {
fields.push_back((*m_decoder)[itField].name());
}
auto iter = std::find(fields.begin(), fields.end(), "layer");
if (iter == fields.end()) {
error() << "Readout does not contain field: 'layer'" << endmsg;
}
return sc;
}
示例6: postUpdateContext
/* ****************************************************************************
*
* deleteIndividualContextEntityAttribute -
*
* DELETE /v1/contextEntities/{entityId::id}/attributes/{attributeName}
* DELETE /ngsi10/contextEntities/{entityId::id}/attributes/{attributeName}
*
* Payload In: None
* Payload Out: StatusCode
*
* URI parameters:
* - entity::type=TYPE
* - note that '!exist=entity::type' and 'exist=entity::type' are not supported by convenience operations
* that use the standard operation UpdateContext as there is no restriction within UpdateContext.
* [ attributesFormat=object: makes no sense for this operation as StatusCode is returned ]
*
* 0. Take care of URI params
* 1. Fill in UpdateContextRequest from URL-path components
* 2. Call postUpdateContext standard service routine
* 3. Translate UpdateContextResponse to StatusCode
* 4. Cleanup and return result
*/
std::string deleteIndividualContextEntityAttribute
(
ConnectionInfo* ciP,
int components,
std::vector<std::string>& compV,
ParseData* parseDataP
)
{
std::string answer;
std::string entityId = compV[2];
std::string entityType = ciP->uriParam[URI_PARAM_ENTITY_TYPE];
std::string attributeName = compV[4];
StatusCode response;
// 1. Fill in UpdateContextRequest from URL-path components
parseDataP->upcr.res.fill(entityId, entityType, "false", attributeName, "", "DELETE");
// 2. Call postUpdateContext standard service routine
postUpdateContext(ciP, components, compV, parseDataP);
// 3. Translate UpdateContextResponse to StatusCode
response.fill(parseDataP->upcrs.res);
// 4. Cleanup and return result
TIMED_RENDER(answer = response.render("", false, false));
response.release();
parseDataP->upcr.res.release();
return answer;
}
示例7: initialize
/// initialize the algorithm
StatusCode initialize ()
{
StatusCode sc = GaudiAlgorithm::initialize () ;
if ( sc.isFailure() ) { return sc ; } // RETURN
m_stat = svc<IStatSvc> ( "ChronoStatSvc" , true ) ;
return StatusCode::SUCCESS ;
}
示例8: log
//-----------------------------------------------------------------------------
StatusCode RootHistCnv::PersSvc::initialize()
//-----------------------------------------------------------------------------
{
MsgStream log( msgSvc(), name() );
StatusCode status = ConversionSvc::initialize();
if( status.isFailure() ) return status;
// Get my properties from the JobOptionsSvc
if (setProperties().isFailure()) {
log << MSG::ERROR << "Could not set my properties" << endmsg;
return StatusCode::FAILURE;
}
if (m_outputEnabled) {
// Initialize ROOT if output file name is defined
if( undefFileName != m_defFileName ) {
m_hfile = TFile::Open(m_defFileName.c_str(),"RECREATE","GAUDI Histograms");
} else {
m_hfile = 0;
}
log << MSG::INFO << "Writing ROOT histograms to: " << m_defFileName
<< endmsg;
}
else {
log << MSG::INFO << "Writing ROOT histograms disabled." << endmsg;
}
return StatusCode(StatusCode::SUCCESS,true);
}
示例9: initialize
/// Initialization.
StatusCode CpuHungryAlg::initialize() {
StatusCode sc = GaudiAlgorithm::initialize(); // must be executed first
if ( sc.isFailure() ) return sc; // error printed already by GaudiAlgorithm
if ( msgLevel(MSG::DEBUG) ) debug() << "==> Initialize" << endmsg;
return StatusCode::SUCCESS;
}
示例10: initialize
//=============================================================================
// init
//=============================================================================
StatusCode TupleToolSelResults::initialize()
{
StatusCode sc = TupleToolBase::initialize();
if ( sc.isFailure() ) return sc;
m_selTool = tool<ICheckSelResults>("CheckSelResultsTool",this);
return sc ;
}
示例11: 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 ;
}
示例12: TEST_F
TEST_F(testsCombinedBlockStore, Basic2IbpSetPutGetMemCheck) {
std::string ibp1Path = std::string(MKTMPNAME()) + "_IBP1";
FileTools::createDirectory(ibp1Path);
std::string ibp2Path = std::string(MKTMPNAME()) + "_IBP2";
FileTools::createDirectory(ibp2Path);
std::vector<std::string> ibpsPath;
ibpsPath.emplace_back(ibp1Path);
ibpsPath.emplace_back(ibp2Path);
CombinedBlockStore db(ibpsPath);
EXPECT_TRUE(db.isClosed());
db.open();
EXPECT_FALSE(db.isClosed());
StatusCode stPut = db.put("key", "data");
EXPECT_TRUE(stPut.ok());
std::string fetched;
StatusCode stGet = db.get("key", &fetched);
EXPECT_TRUE(stGet.ok());
EXPECT_TRUE(fetched == "data");
std::string stats;
EXPECT_TRUE(db.getStats(stats));
EXPECT_FALSE(stats.empty());
EXPECT_FALSE(db.isClosed());
db.close();
EXPECT_TRUE(db.isClosed());
EXPECT_TRUE(db.repair().ok());
FileTools::removeDirectory(ibp1Path);
FileTools::removeDirectory(ibp2Path);
}
示例13: Error
StatusCode TrackTune::initialize() {
static const std::string histoDir = "Track/" ;
if ( "" == histoTopDir() ) setHistoTopDir(histoDir);
// Mandatory initialization of GaudiAlgorithm
StatusCode sc = GaudiTupleAlg::initialize();
if ( sc.isFailure() ) { return sc; }
LHCb::IParticlePropertySvc* propertysvc =
svc<LHCb::IParticlePropertySvc>("LHCb::ParticlePropertySvc",true) ;
const LHCb::ParticleProperty* prop = propertysvc->find( m_resonanceName);
if (prop != 0){
m_minMass = prop->mass() - m_deltaMass;
m_maxMass = prop->mass() + m_deltaMass;
}
else {
return Error("Failed to find resonance", StatusCode::SUCCESS);
}
propertysvc->release();
info() << "MinMass " << m_minMass << " MaxMass " << m_maxMass << endmsg;
return StatusCode::SUCCESS;
}
示例14: log
/// 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;
}
示例15: 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;
}