//
// Copyright (c) 2009 Froduald Kabanza and the Université de Sherbrooke.
// Use of this software is permitted for non-commercial research purposes, and
// it may be copied or applied only for that use. All copies must include this
// copyright message.
// 
// This is a research prototype that has not gone through intensive tests and
// is delivered as is. It may still contain bugs. Froduald Kabanza and the
// Université de Sherbrooke disclaim any responsibility for damage that may be
// caused by using it.
//
// Please note that some files were inspired in part by the PDDL4J library:
// http://www.math-info.univ-paris5.fr/~pellier/software/software.php 
//
// Implementation: Simon Chamberland
// Project Manager: Froduald Kabanza
//

#ifndef _I_EFFECT_H
#define _I_EFFECT_H

#include "IExp.h"
#include "../World/IClosedWorld.h"
#include "../World/IDurativeClosedWorld.h"
#include "../Action/ActionContext.h"

namespace planning
{
  class Bindings;

  /// <summary>
  /// An effect represents an update (or set of updates) applicable to a world.
  /// </summary>
  class IEffect : public virtual IExp
  {
  public:
    /// <summary>
    /// Updates the specified world with this effect.
    /// </summary>
    /// <param name="evaluationWorld">The world to evaluate conditions against. Note that this is 
    /// usually the un-modified version of the world to update.</param>
    /// <param name="updateWorld">The world to update.</param>
    /// <param name="bindings">A set of variable bindings.</param>
    /// <param name="actionContext">The action evaluation context.</param>
    virtual void update(const IClosedWorld* evaluationWorld, 
                        IDurativeClosedWorld* updateWorld, 
                        const Bindings* bindings, 
                        const ActionContext* actionContext) const = 0;

    const IEffect* apply(const Bindings* bindings) const
    {
      return dynamic_cast<const IEffect*>(IExp::apply(bindings));
    }

    /// <summary>
    /// Retrieves all the described formulas modified by this effect.
    /// </summary>
    /// <returns>All the described formulas modified by this effect.</returns>
    //HashSet<DescribedFormula> GetModifiedDescribedFormulas();
  };
}

#endif