Skip to content

Create self registering factories #120

@drjbarker

Description

@drjbarker

Currently the factories (monitors, solvers, hamiltonians) are very simple factories as static methods inside the interface class. This has two problems:

  1. The interface must include every implementation.
  2. After writing an implementation both the header and some glue code must be written into the factory.

A cleaner solution is to have the factories as a separate class (making the base class more of a pure implementation/concept) and also implementing some form of self registering method so that the implementations register themselves with the factory in a static context (i.e. created first at runtime) rather than hard coded into the factory.

Possible ideas:

Note:
I once tried this with a method using a complex template inheritance scheme but there was a big drawback (which I can't remember now) so I ditched it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions