Skip to content

Commit

Permalink
feature: New FairRun::AddTask(unique_ptr)
Browse files Browse the repository at this point in the history
So that the callers can be more explicit about ownership,
add an alternative FairRun::AddTask that takes a
unique_ptr.

Do not yet deprecate the old API, because it's used in way
too many places. But we should update all our code to use
the new API so that the new style ist adopted.
  • Loading branch information
ChristianTackeGSI committed Jul 11, 2023
1 parent b7c1bda commit 0701da3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/MQ/pixelDetector/macros/run_dAsciiSource.C
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ void run_dAsciiSource(TString mcEngine = "TGeant3")
// PixelDigiReadFromFile* digiRead = new PixelDigiReadFromFile();
// run->AddTask(digiRead);

PixelFindHits* hitFinderTask = new PixelFindHits();
run.AddTask(hitFinderTask);
auto hitFinderTask = std::make_unique<PixelFindHits>();
run.AddTask(std::move(hitFinderTask));

run.Init();

Expand Down
4 changes: 2 additions & 2 deletions examples/MQ/pixelDetector/macros/run_dBinSource.C
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ void run_dBinSource(TString mcEngine = "TGeant3")
// PixelDigiReadFromFile* digiRead = new PixelDigiReadFromFile();
// run->AddTask(digiRead);

PixelFindHits* hitFinderTask = new PixelFindHits();
run.AddTask(hitFinderTask);
auto hitFinderTask = std::make_unique<PixelFindHits>();
run.AddTask(std::move(hitFinderTask));

run.Init();

Expand Down
1 change: 1 addition & 0 deletions fairroot/base/steer/FairRun.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class FairRun : public TNamed
/**
* Add a FAIRTask to the simulation or analysis
*/
void AddTask(std::unique_ptr<FairTask> task) { AddTask(task.release()); }
virtual void AddTask(FairTask* t);
virtual void StoreTaskNames(const FairTask* t);
virtual void SetTask(FairTask* t);
Expand Down

0 comments on commit 0701da3

Please sign in to comment.