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

Make GlobalVariables into a SingleTon #167

Open
kreczko opened this issue Jun 17, 2015 · 0 comments
Open

Make GlobalVariables into a SingleTon #167

kreczko opened this issue Jun 17, 2015 · 0 comments

Comments

@kreczko
Copy link
Member

kreczko commented Jun 17, 2015

At the moment we have no specific destructors for the Globals, hence I suggest to reimplement it as a SingleTon:

class Setup
{
  public:
      static Setup& getSetup(const Configuration &cfg) {
          // either this or make a thread safe version with a few more lines
          static Setup instance(cfg);
          return instance;
      }
      ~Setup();
      // getters, e.g. 
      const MuonAlgorithm::value muonAlgorithm() const;
      ...
   private:
      Setup(const Configuration &cfg);
      Setup(Setup const&);              // Don't Implement.
      void operator=(Setup const&); // Don't implement
      // all current variables
      ...
}

Hopefully this will not only hep fix issue #161 but also provide a nicer interface to our global variables.
Please let me know what you think.

The implementation procedure would be simple:

  1. implement Setup to mirror Globals
  2. Use Setup everywhere
  3. Remove Globals
@kreczko kreczko added this to the 13 TeV proper milestone Jul 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant