Software design - 07 Nov 2012

This page has notes from discussions between Marc, Alessandro, and Kurt (initial notes by Kurt).

The attached state diagram PDF file was generated at the start of the day, and it was modified slightly as the day progressed (for example, the reinit transitions were removed). I will post an updated version tomorrow. Please Note that this state diagram is intended to correspond to the externally visible states of each of the applications that are part of the MPI program. We have not constrained the state machines that might actually be implemented within those applications to exactly match this model.

boardreader application

Here is pseudo-code that describes our initial plan for the boardreader main routine.

int main()
  try {
    // ?? maybe call MPI_INIT() ??

    // start up the message facility
    // parse the command line options
    // create the BoardReaderApp -> brApp local variable
    // create the XMLRPC_Commander(port, brApp) -> cmdr
    // (Commander constructor takes a Commandable reference)
  catch (...) {//do something}

BoardReaderApp internals

Here are notes on the implementation of some of the important BoardReaderApp methods. (The BoardReaderApp is one of several classes that implement the Commandable interface - which is described below.)


BoardReaderApp::initialize(PSet const&)
  // delete any existing FragmentGenerator

  // use the FragmentGeneratorFactory to create a new FragmentGenerator
  // create a FragmentReceiver, passing in the PSet and the FragmentGenerator pointer

  // set the FragmentGenerator flag so that getNext() gets real data
  // create the future [the thread that runs FragmentReceiver::run()?]

  // FragmentGenerator.stop()
  // - if connected to the trigger board, tell the board to stop generating triggers
  // - sets a flag so that the next getNext() calls returns false

  // FragmentReceiver.stop()
  // - this may not do anything special - the thread that is part of the future will end when the FragmentReceiver run() method calls getNext() and gets false

  // returns when the future ends

BoardReaderApp::report(string const& which)
  // asks the FragmentGenerator for its report
  // asks the FragmentReceiver for its report
  // chain them with the current status and return
  // - if there is an error condition, that is what is returned as the current status

Updated Commandable interface

class Commandable {
  virtual ~Commandable() nothrow;
  bool initialize(ParameterSet const&);
  bool pause();
  bool start(art::RunID);
  bool resume();
  bool stop();
  Report_ptr report(string const& which) const;
  string status() const;
  bool perfreset(string const& which);
  bool shutdown();
  vector<string> legalCommands() const;

Interaction of System Control with the XMLRPC_Commander and the underlying Commandable interface and concrete classes