// src/backend/static_thread.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_THREAD_HH
#define STATIC_THREAD_HH 1

#include "static_process.hh"
#include "static_schedulable.hh"

#include "config.h"
#include "gettext.h"

#include <glibmm/ustring.h>

#include <vector>

namespace sgpem
{
  class StaticProcess;
  class StaticThread;
  class StaticRequest;

  class SG_DLLLOCAL StaticThread : public StaticSchedulable
  {
  public:
    StaticThread(const Glib::ustring& name,
                 StaticProcess& process,
                 unsigned int cpu_time,
                 unsigned int arrival_time = 0,
                 int base_priority = 0);

    virtual ~StaticThread();

    virtual unsigned int get_total_cpu_time() const;

    unsigned int set_total_cpu_time(unsigned int cpu_time);

    virtual unsigned int get_arrival_time() const;

    virtual unsigned int set_arrival_time(unsigned int arrival_time);

    virtual StaticProcess& get_process();

    // Caller can use directly the vector instead that
    // the "remove_request()" and "add_request()" method
    // of the design. Since this class is internal to the
    // backend anyway, this is okay.
    virtual std::vector<StaticRequest*>& get_requests();

  private:
    StaticThread(const StaticThread&);

    unsigned int _start_time_delta;
    unsigned int _required_cpu_time;
    StaticProcess* _process;
    std::vector<StaticRequest*> _static_requests;
  };

}

#endif

