// src/backend/dynamic_schedulable.hh - Copyright 2005, 2006, University
//               of Padova, dept. of Pure and Applied
//               Mathematics
//
// This file is part of SGPEMv2.
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// SGPEMv2 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with SGPEMv2; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

#ifndef DYNAMIC_SCHEDULABLE_HH
#define DYNAMIC_SCHEDULABLE_HH 1

#include "config.h"
#include <sgpemv2/schedulable.hh>
#include "static_schedulable.hh"

namespace sgpem
{
  class DynamicSchedulable;

  /** \brief Desribes the state of a schedulable entity in a particular moment
   * of the simulation
   *
   * This class stores part of the information deeded by the Scheduler to
   * manage processes and other ones.
   *
   * Objects of type DynamicSchedulable are created by the Scheduler and are
   * destroyed by SimulationStatus if they are linked to it or by the Scheduler.
   */
  class SG_DLLLOCAL DynamicSchedulable : public virtual Schedulable
  {
  public:
    /** \brief Object constructor */
    DynamicSchedulable();

    //DynamicSchedulable(const DynamicSchedulable& obj); //copy constructor

    /** \brief Verify if two instances represents the same situation
     *
     * This trivial overloading of the equal operator simply verifies if the
     * actual represented process is the same, and if the status is also the
     * same.
     */
    virtual bool operator==(const Schedulable&) const;

    virtual Glib::ustring get_name() const;

    virtual unsigned int get_arrival_time() const;

    virtual int get_base_priority() const;

    virtual unsigned int get_total_cpu_time() const;

    virtual int get_priority_push() const;

    virtual int set_priority_push(int new_value = 0);

    virtual int get_current_priority() const;

    virtual unsigned int get_elapsed_time() const = 0;

    /** \brief Returns a pointer to the schedulable object
     *
     * This function returns a reference to the actual schedable object
     * represented, along with its status, by this instance.
     */
    virtual StaticSchedulable& get_core() = 0;
    virtual const StaticSchedulable& get_core() const = 0;

  private:
    int _priority_push;
  };
}

#endif
