Factories

Octopus uses the so-called factory pattern to create instances of the systems and interaction classes. The abstract factory classes are introduced to avoid the problem of circular dependencies.

The function of the factories is to create an object of a (dynamically) given type and return a pointer to it. This is done by calling the respective constructors of the classes, of which an instance is to be created.

System factories

  type, abstract :: system_factory_abst_t
  contains
    procedure(system_factory_abst_create),     deferred :: create
  end type system_factory_abst_t
  type, extends(system_factory_abst_t) :: system_factory_t
  contains
    procedure :: create => system_factory_create         !< @copydoc system_factory_oct_m::system_factory_create
  end type system_factory_t
Definition of system_factory_create()

Interaction factories

  type, abstract :: interactions_factory_abst_t
  contains
    procedure(interactions_factory_abst_create), deferred :: create
    !< @copydoc interactions_factory_abst_create
    procedure(interactions_factory_abst_options), deferred, nopass :: options
    !< @copydoc interactions_factory_abst_options
  end type interactions_factory_abst_t
  type, extends(interactions_factory_abst_t) :: interactions_factory_t
  contains
    procedure :: create => interactions_factory_create              !< @copydoc interactions_factory_create()
    procedure, nopass :: options => interactions_factory_options    !< @copydoc interactions_factory_options()
  end type interactions_factory_t
Definition of interactions_factory_abst_create_interactions()
Definition of interactions_factory_create()