sgpemv2/src/backend/schedulable_status.hh

76 lines
2.2 KiB
C++

// src/backend/schedulableStatus.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 SCHEDULABLESTATUS_HH
#define SCHEDULABLESTATUS_HH 1
#include "config.h"
#include "schedulable.hh"
namespace sgpem
{
class SchedulableStatus;
/** \brief Desribes the state of a schedulable entity in a particular moment of the simulation
This class desribes the state of a schedulable entity in a particular moment of the simulation.
Stores part of informations deeded by Scheduler to manage processes and other ones.
Objects SchedulableStatus are created by Scheduler and destroyed by SimulationStatus if they are linked to it
or by Scheduler.
*/
class SG_DLLEXPORT SchedulableStatus
{
public:
enum state
{
state_running,
state_ready,
state_blocked,
state_future,
state_terminated
};
SchedulableStatus(const Schedulable& obj);
//SchedulableStatus(const SchedulableStatus& obj); //copy constructor
bool operator==(const SchedulableStatus&) const;
int get_cpu_time_left() const;
void give_cpu_time(const int& time);
void set_last_scheduled(const int& time);
int get_last_scheduled() const;
state get_state() const;
void set_state(state s);
const Schedulable* get_schedulable() const;
private:
const Schedulable* _ref;
int _last;
int _time_left;
state _my_state;
};
}
#endif