// src/backend/static_process.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 STATIC_PROCESS_HH
#define STATIC_PROCESS_HH 1

#include "config.h"

#include "static_schedulable.hh"
#include "static_thread.hh"

#include <glibmm/ustring.h>
#include <vector>

namespace sgpem
{
  class StaticProcess;
  class StaticThread;

  /** \brief Represents a program in execution.

      It IS a Schedulable object.
  */
  class SG_DLLLOCAL StaticProcess : public StaticSchedulable
  {
  public:
    /** \brief Creates a new object with the given parameters. */
    StaticProcess(const Glib::ustring& name, const unsigned int& arrival, const int& priority = 0);

    /** \brief Destructor. */
    virtual ~StaticProcess();

    virtual unsigned int get_total_cpu_time() const;
    virtual unsigned int get_arrival_time() const;
    virtual unsigned int set_arrival_time(unsigned int time);

    // Does the job also of add_thread() and remove_thread(). :-)
    // Since we're touching backend internals, we can do this safely
    // (because we know what we're doing, isn't it?)
    virtual std::vector<StaticThread*>& get_threads();

  private:
    unsigned int                _start_time;
    std::vector<StaticThread*>  _threads;
  };

}

#endif

