Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail test when calling function twice #1196

Merged
merged 1 commit into from
Jun 7, 2022

Conversation

fuhlig1
Copy link
Member

@fuhlig1 fuhlig1 commented Jun 7, 2022

Change the Initialize function such that it asserts when the function is
called twice.

Closes #1195

Checklist:

Change the Initialize function such that it asserts when the function is
called twice.
Comment on lines +81 to 84
fIsInitialised = kTRUE;
/*
FairRuntimeDb* rtdb= FairRun::Instance()->GetRuntimeDb();
FairTutorialDet1GeoPar* par=(FairTutorialDet1GeoPar*)(rtdb->getContainer("FairTutorialDet1GeoPar"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe remove the commented code while you're changing this anyway?

Copy link
Member

@ChristianTackeGSI ChristianTackeGSI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some ideas. Can be merged as is, if you don't like those ideas.

@@ -95,6 +95,8 @@ class FairTutorialDet1 : public FairDetector
Double32_t fLength; //! length
Double32_t fELoss; //! energy loss

Bool_t fIsInitialised; //! prevent double initilization
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Bool_t fIsInitialised; //! prevent double initilization
bool fIsInitialised{false}; //!< prevent double initilization

Some ideas:

  • Let's use plain C++ types (bool)
  • member initaliser?
  • Doxygen compatible comment

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChristianTackeGSI,

the ideas are fine but I would prefer to move the PR as is.
I also thought about them but in my opinion this should be done in separate pull requests which move the code to more modern C++.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then go ahead and merge this one!

@ChristianTackeGSI ChristianTackeGSI linked an issue Jun 7, 2022 that may be closed by this pull request
@fuhlig1 fuhlig1 merged commit 8e817e6 into FairRootGroup:dev Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Check if FairDetector::Initialize() is called twice
2 participants