Skip to content
Snippets Groups Projects
Commit ebec9f8b authored by Gerhard Raven's avatar Gerhard Raven
Browse files

deprecate put with a plain pointer

parent 44b20934
No related branches found
No related tags found
1 merge request!1086Deprecate `put` with a plain pointer as argument
Pipeline #1726875 passed
......@@ -9,8 +9,6 @@
* or submit itself to any jurisdiction. *
\***********************************************************************************/
// Framework include files
#include "GaudiKernel/MsgStream.h"
#include "GaudiKernel/IDataManagerSvc.h"
#include "GaudiKernel/IDataProviderSvc.h"
#include "GaudiKernel/ThreadLocalContext.h"
......@@ -26,14 +24,12 @@ StatusCode WriteHandleAlg::execute() // the execution of the algorithm
// Set collision to the current event number from the context;
// if the context doesn't exist, set it to some dummy value
// this fallback allows to stay compatible with non-hive infrastructure
Collision* c = new Collision( Gaudi::Hive::currentContext().evt() );
if ( m_useHandle )
m_output_handle.put( c );
else
return eventSvc()
->registerObject( "/Event", "MyCollision", c )
.ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ );
auto c = std::make_unique<Collision>( Gaudi::Hive::currentContext().evt() );
return StatusCode::SUCCESS;
if ( m_useHandle ) {
m_output_handle.put( std::move( c ) );
return StatusCode::SUCCESS;
} else {
return eventSvc()->registerObject( "/Event", "MyCollision", c.release() );
}
}
......@@ -57,7 +57,7 @@ StatusCode IncidentAsyncTestAlg::execute() {
m_service->getData( &data );
for ( auto& outputHandle : m_outputObjHandles ) {
if ( !outputHandle->isValid() ) continue;
outputHandle->put( new DataObject() );
outputHandle->put( std::make_unique<DataObject>() );
}
info() << "Read data " << data << endmsg;
return StatusCode::SUCCESS;
......
......@@ -210,7 +210,7 @@ StatusCode CPUCruncher::execute() // the execution of the algorithm
if ( !outputHandle->isValid() ) continue;
VERBOSE_MSG << "put to TS: " << outputHandle->objKey() << endmsg;
outputHandle->put( new DataObject() );
outputHandle->put( std::make_unique<DataObject>() );
}
tbb::tick_count endtbb = tbb::tick_count::now();
......
......@@ -73,7 +73,7 @@ StatusCode HiveTestAlgorithm::execute() {
info() << ":HiveTestAlgorithm::registering outputs... " << evt << endmsg;
for ( auto& outputHandle : m_outputHandles ) { outputHandle->put( new MyObject( 1000 + evt ) ); }
for ( auto& outputHandle : m_outputHandles ) { outputHandle->put( std::make_unique<MyObject>( 1000 + evt ) ); }
return StatusCode::SUCCESS;
}
......
......@@ -131,8 +131,9 @@ public:
*/
T* put( std::unique_ptr<T> object ) const;
// [[deprecated("please pass a std::unique_ptr instead of a raw pointer")]]
T* put( T* object ) const { return put( std::unique_ptr<T>( object ) ); }
[[deprecated( "please pass a std::unique_ptr instead of a raw pointer" )]] T* put( T* object ) const {
return put( std::unique_ptr<T>( object ) );
}
std::string pythonRepr() const override {
auto repr = DataObjectHandleBase::pythonRepr();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment