/****************************************************************************/
/* Copyright (c) 2000 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  :                                                               */
/* Filename : MissionPlan.h                                                 */
/* Author   :                                                               */
/* Project  :                                                               */
/* Version  : 1.0                                                           */
/* Created  : 02/07/2000                                                    */
/* Modified :                                                               */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/****************************************************************************/
#ifndef _MISSIONPLAN_H
#define _MISSIONPLAN_H

#include <time.h>
#include "Behavior.h"

class LayeredControl;

/*
CLASS 
MissionPlan

DESCRIPTION
MissionPlan specifies Behaviors as a function of time. May also 
specify attributes of mission as a whole, such as duration.

AUTHOR
Tom O'Reilly
*/

class MissionPlan {

public:

  ///////////////////////////////////////////////////////////////////
  // Constructor
  MissionPlan();

  ~MissionPlan();

  ///////////////////////////////////////////////////////////////////
  // Read BehaviorStack from file. Return 0 on success, -1 on error
  int load(const char *fileName, BehaviorStack *behaviorStack);

  ///////////////////////////////////////////////////////////////////
  // Add specified Behavior
  void addBehavior(Behavior *behavior);

  ///////////////////////////////////////////////////////////////////
  // Remove specified Behavior
  void deleteBehavior(Behavior *behavior);

  ///////////////////////////////////////////////////////////////////
  // Find specified Behavior
  Behavior *getBehavior(const char *name);

protected:

  // Parse Behaviors from MissionPlan file
  void parse(FILE *fp, BehaviorStack *behaviorStack,
	     Boolean *error, char *errorMsg);


  time_t _creationDate;
  time_t _missionDate;
};

// Call before loading a new MissionPlan
void restartMissionPlanLexer();

#endif
