- Big swing of untested code, all for you verifiers :-)

- Fix ReadyQueue constructor
- Change DynamicSubRequest to take an int as a parameter
- Implement ConcreteEnvironment::get_request_queue() (my word, it's ugly!)
- Please note that it still doesn't compile right: ConcreteHistory
and Scheduler need to be radically changed


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@692 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-07-02 17:38:30 +00:00
parent 55c6b23d31
commit 787d24964b
7 changed files with 142 additions and 110 deletions

View file

@ -1,4 +1,4 @@
// src/backend/resource.hh - Copyright 2005, 2006, University
// src/backend/concrete_environment.hh - Copyright 2005, 2006, University
// of Padova, dept. of Pure and Applied
// Mathematics
//
@ -47,18 +47,18 @@ namespace sgpem
{
public:
typedef std::vector<Process*> Processes;
typedef std::map<resource_key_t, Resource*> Resources;
/// \brief Standard constructor.
/// Builds an empty environment.
ConcreteEnvironment();
/// \brief Copy constructor.
/// Performs a deep copy of all structures.
ConcreteEnvironment(const ConcreteEnvironment & c);
/// \brief Returns an indexed set of snapshots of the processes
/// Returns a standard vector of Process objects describing
/// all the processes of the simulated environment at the
@ -69,8 +69,8 @@ namespace sgpem
/// always safe.
///
/// \return a constant set of snapshots of processes
virtual const std::vector<const Process*>
get_processes() const;
virtual const ConstProcesses
get_processes() const;
@ -78,8 +78,8 @@ namespace sgpem
///
/// \return a set of snapshots of processes
/// \see get_processes()
virtual std::vector<Process*>&
get_processes();
virtual Processes&
get_processes();
@ -101,8 +101,8 @@ namespace sgpem
///
/// \return a indexed constant set of snapshot of resources.
/// \see DynamicSybrequest::get_resource()
virtual const std::map<int, const Resource*>
get_resources() const;
virtual const ConstResources
get_resources() const;
@ -110,8 +110,8 @@ namespace sgpem
///
/// \return an indexed set of snapshots of resources
/// \see get_resources()
virtual std::map<int, Resource*>&
get_resources();
virtual Resources&
get_resources();
@ -126,10 +126,10 @@ namespace sgpem
///
/// \param resource The resource the requests are for
/// \return The current ready requests queue.
virtual const std::vector<const Request*>
get_request_queue(Resource * resource) const;
virtual const ConstRequests
get_request_queue(resource_key_t resource_key) const;
/// \brief Returns a snapshot of the current scheduler's ready queue.
/// Returns a ReadyQueue object representing the queue
@ -139,7 +139,7 @@ namespace sgpem
///
/// \return the current ready queue (constant).
virtual const ReadyQueue&
get_sorted_queue() const;
get_sorted_queue() const;
@ -148,46 +148,36 @@ namespace sgpem
/// \return the current ready queue.
/// \see get_sorted_queue()
virtual ReadyQueue&
get_sorted_queue();
get_sorted_queue();
/// \brief The standard virtual destructor.
/// The standard virtual destructor.
virtual
~ConcreteEnvironment();
~ConcreteEnvironment();
/// \brief Serializes the whole environment.
/// \see SerializeVisitor
virtual void
serialize(SerializeVisitor& translator) const;
serialize(SerializeVisitor& translator) const;
private:
/// \brief The container of all Resource objecs.
/// Actually contains only DynamicResource objects.
// resources come before processes because of
// destruction order. See destructor implementation
std::map<int, Resource *>
_resources;
Resources _resources;
/// \brief The container of all Process objecs.
/// Actually contains only DynamicProcess objects.
std::vector<Process *>
_processes;
Processes _processes;
/// \brief The queue of the ready schedulables
/// Does not contain the running process.
ReadyQueue
_sched_queue;
ReadyQueue _sched_queue;
}; //~ class ConcreteEnvironment