/*
  Interface definitions for the smartsampler server.
*/

#define NGULPERS 10

interface SmartSamplerIF {
  enum GulperState {Free=0, Allocated, Fired};

  struct PerGulperInfo
  {
    double time; // Time of last change to state or allocation.
    short dtid;  // DecisionTool index this gulper is allocated to.
    GulperState curstate;
  };
  typedef sequence<PerGulperInfo, NGULPERS> GulperInfoArrayType;

  // Suspend/resume given DecisionTool.  Suspended DTs keep running
  // as normal, but do not trigger gulpers.
  void dtSuspend(in short suspendNum);
  void dtResume(in short resumeNum);

  // Reset state (erase memory) in given DT.  Effect depends on DT.
  void dtReset(in short resetNum);

  // Get the number of instantiated DT's NOT INCLUDING 0.  Since we
  // never de-instantiate DT's, this is the index of the last DT
  // instantiated.
  void dtNum(out short numDTs);

  // For debugging: dump out info for one or all decision tools
  void dtDumpState();
  void dtDumpState(in short dumpNum);

  // (re)allocated a single gulper to a single DT (overwrites previous
  // allocation).  NOTE: allocation to DT number 0 is equivalent to
  // calling the gulperFire command.
  // NOTE2: allocation to DT < 0 or greater than number instantiated
  // will deallocate the gulper.
  void gulperAllocate(in short gulperNum, in short dtNum);

  // return state of all gulpers
  void gulperState(out GulperInfoArrayType gulperInfo);

  // Direct firing request.  Will still be arbitrated along with
  // other decision tools, shows up as DT number 0 in state info.
  void gulperFire(in short gulperNum);

  // Simplified version of above: return the gulper number and
  // time of the last gulper fired, or (-1,-1) if none have been
  // fired.
  void gulperLastFired(out double gulperTime,out short gulperNum);
};
