sgpemv2/src/backend/history.hh
fpaparel 4482b98df7 - fixed a number of bugs
- added dummy_policy written in C++
- the interpreter is now finished (hopefully)


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@366 3ecf2c5c-341e-0410-92b4-d18e462d057c
2006-02-21 11:09:55 +00:00

74 lines
2.3 KiB
C++

// src/backend/history.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 HISTORY_HH
#define HISTORY_HH 1
#include "config.h"
#include <vector>
#include <iostream>
#include "slice.hh"
#include "observed_subject.hh"
#include "schedulable_list.hh"
#include "schedulable_status.hh"
#include "../templates/smartp.hh"
namespace sgpem
{
/** \brief Manages the history of the simulation
Manages the history of the simulation from the instant 0 to the current time,
i.e. permits to know the state of each schedulable object inside this time interval.
In particoular it's possible to know which entity was running at a precise moment.
In a future iteration it will be possible to revert the entire simulation to a state
present in the history ("undo operation")
*/
class History;
class SG_DLLEXPORT History : public ObservedSubject
{
public:
memory::smart_ptr<sgpem::SchedulableStatus> get_scheduled_at(int time) const;
memory::smart_ptr<sgpem::SchedulableList> get_simulation_status_at(int time) const;
int get_current_time() const;
void enqueue_slice(const sgpem::SchedulableList& status);
void truncate_at(int instant);
static History& get_instance();
private:
History(int); //private constructor. The parameter is discarded
static History _instance;
int _total_time_elapsed;
std::vector<sgpem::Slice> _slices;
};
}//~ namespace sgpem
#endif //HISTORY_H