/****************************************************************************/
/* Copyright (c) 2007 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  :                                                               */
/* Filename : DynoLayeredControl.h                                          */
/* Author   :                                                               */
/* Project  :                                                               */
/* Version  : 1.0                                                           */
/* Created  : 02/17/2007                                                    */
/* Modified :                                                               */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/****************************************************************************/
#ifndef _DYNOLAYEREDCONTROL_H
#define _DYNOLAYEREDCONTROL_H

#include "Behavior.h"
#include "PeriodicTask.h"
#include "DynoCommand.h"
#include "DynamicControlIF.h"
#include "MissionClock.h"
#include "DynamicArray.h"
#include "LayeredControl.h"

// DEBUG PURPOSES ONLY!!!
#include "SimulatorIF.h"


/*
CLASS 
DynoLayeredControl

DESCRIPTION

DynoLayeredControl invokes Behaviors specified by the MissionPlan,
and resolves commands generated by currently-executing Behaviors to one
final output command, which is input to the DynamicController. Currently
implements a limited version of "state-configured layered control". This class
also supports a dynamic behavior stack in support of Onboard Autonomy.

Main states are NormalState, AbortingMission, and ShuttingDown.

AUTHOR

*/
class DynoLayeredControl : public LayeredControl {


public:


  ///////////////////////////////////////////////////////////////////
  // Constructor
  DynoLayeredControl(const char *planName, const char *abortPlan, int period);
  virtual ~DynoLayeredControl();

  virtual void initialize(const char *planName, const char *abortPlanName);

  void appendBehaviors(const char* filename);
  void insertBehaviors(const char* filename, long after_this_behavior);
  void deleteBehavior(long behavior_id);

protected:

  virtual void callback();

  void respond(DynoCommand::DynoCommands, LayeredControlIF::Status);
  
  DynoCommand *_cmdInput;   // Commands
  DynoCommand *_cmdOutput;  // Response to command
  DynoCommand::Command _cmdIn;

};

#endif
