Skip to content

Make GlobalVariables into a SingleTon #167

Description

@kreczko

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions