sgpemv2/src/backend/schedulableStatus.hh

76 lines
2.1 KiB
C++
Raw Normal View History

// 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 getCpuTimeLeft() const;
void giveCpuTime(const int& time);
void setLastScheduled(const int& time);
int getLastScheduled() const;
state getState() const;
void setState(state s);
const Schedulable* getSchedulable() const;
private:
const Schedulable* _ref;
int _last;
int _timeLeft;
state _myState;
};
}
#endif