DEFINITION MODULE SubmodelSet;
  (*******************************************************************
    Module  SubmodelSet     (Version 1.0)
      Copyright (c) 1997-2006 by Andreas Fischlin and ETH Zurich.
    Purpose   General mechanism to notify model components of
              a structured model system about activation
              respectively deactivation of one another.
    Remarks   A model interested in learning about a recent change
              in the status of a model can announce its interest by
              installing a Notifier with a call to
              AddNotifierIfActivated or AddNotifierIfDeactivated.
              E.g. as soon as an activation/deactivaton sequence
              for a structured model system has been executed (cf.
              module StructModAux) the messages are generated and
              dispatched to all currently known clients, which have
              announced their interest.
    Programming
      o Design
        Andreas Fischlin          11/05/1997
      o Implementation
        Andreas Fischlin          11/05/1997
    ETH Zurich
    Systems Ecology
    CHN E 35.1
    Universitaetstrasse 16
    8092 Zurich
    SWITZERLAND
    URLs:
        <mailto:RAMSES@env.ethz.ch>
        <http://www.sysecol.ethz.ch>
        <http://www.sysecol.ethz.ch/SimSoftware/RAMSES>
    Last revision of definition:  11/05/1997  AF
  *******************************************************************)
  TYPE
    StructModelSet = BITSET;
    Notifier = PROC;
  PROCEDURE AddNotifierIfActivated(modIdent: ARRAY OF CHAR; n: Notifier);
  PROCEDURE RemoveNotifierIfActivated(modIdent: ARRAY OF CHAR; n: Notifier);
    (*
      Adds respectively removes a notifier procedure which is
      called whenever the model with the identifier modIdent has
      been activated by a call to ActivateXYZMod.  The message is
      sent after a completed system configuration (cf. procedure
      ChooseModel from module StructModAux).
    *)
  PROCEDURE AddNotifierIfDeactivated(modIdent: ARRAY OF CHAR; n: Notifier);
  PROCEDURE RemoveNotifierIfDeactivated(modIdent: ARRAY OF CHAR; n: Notifier);
    (*
      Adds respectively removes a notifier procedure which is
      called whenever the model with the identifier modIdent has
      been deactivated by a call to DeactivateXYZMod.  The message is
      sent after a completed system configuration (cf. procedure
      ChooseModel from module StructModAux).
    *)
  PROCEDURE SetSubmodelName(which: INTEGER;     modIdent: ARRAY OF CHAR);
    (*
      Associates the index number which returned by
      AssignSubModel from StructModAux for a particular sub model
      with its model identifier modIdent.
    *)
  PROCEDURE GetSubmodelName(which: INTEGER; VAR modIdent: ARRAY OF CHAR);
    (*
      Returns for a given index number which the associated model
      identifier modIdent.
    *)
  PROCEDURE SubmodelIndex(modIdent: ARRAY OF CHAR): INTEGER;
    (*
      Returns for the model identifier modIdent the associated index
      number ('which') as used by StructModAux to denote a particular
      submodel.
    *)
  PROCEDURE LearnAboutOldSysConfiguration(sms: StructModelSet);
  PROCEDURE InformAboutNewSysConfiguration(sms: StructModelSet);
    (* Dispatches all currently known notifiers *)
END SubmodelSet.