- Another bit of auditing

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1202 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
elvez 2006-09-16 17:04:20 +00:00
parent ee1810df10
commit ec84480e2d
11 changed files with 176 additions and 158 deletions

View file

@ -21,20 +21,23 @@
#ifndef CONCRETE_ENVIRONMENT_HH
#define CONCRETE_ENVIRONMENT_HH 1
namespace sgpem
{
class ConcreteEnvironment;
class SerializeVisitor;
}
#include "dynamic_process.hh"
#include "dynamic_request.hh"
#include <sgpemv2/environment.hh>
#include <sgpemv2/resource.hh>
#include "dynamic_process.hh"
#include "dynamic_request.hh"
#include <sgpemv2/ready_queue.hh>
namespace sgpem
{
class SerializeVisitor;
/// \brief An implementation of the Environment class
/// \brief An implementation of the Environment class.
///
/// Class ConcreteEnvironment implements the Environment
/// abstract class.
///
@ -45,18 +48,26 @@ namespace sgpem
/// \see Environment
class SG_DLLLOCAL ConcreteEnvironment : public Environment
{
public:
typedef std::map<resource_key_t, SubRequestQueue> SubRequestQueues;
/// \brief Standard constructor.
///
/// Builds an empty environment.
ConcreteEnvironment();
/// \brief Copy constructor.
///
/// Performs a deep copy of all structures.
ConcreteEnvironment(const ConcreteEnvironment& c);
/// \brief The standard virtual destructor.
///
/// The standard virtual destructor.
virtual ~ConcreteEnvironment();
/// \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
/// considered instant.
@ -66,21 +77,16 @@ namespace sgpem
/// always safe.
///
/// \return a constant set of snapshots of processes
virtual const Processes&
get_processes() const;
virtual const Processes& get_processes() const;
/// \brief Non-constant version of get_processes()
///
/// \return a set of snapshots of processes
/// \see get_processes()
virtual Processes&
get_processes();
virtual Processes& get_processes();
/// \brief Returns an indexed set of snapshots of the resources
///
/// Returns a standard map of \code int \endcode to Resource
/// objects describing the all resources of the simulated environment
/// at the considered instant.
@ -98,21 +104,16 @@ namespace sgpem
///
/// \return a indexed constant set of snapshot of resources.
/// \see DynamicSybrequest::get_resource()
virtual const Resources&
get_resources() const;
virtual const Resources& get_resources() const;
/// \brief Non-constant version of get_resources()
///
/// \return an indexed set of snapshots of resources
/// \see get_resources()
virtual Resources&
get_resources();
virtual Resources& get_resources();
/// \brief Returns a snapshot of the current request queue for a resource.
///
/// Returns a standard vector of Request objects
/// representing the queue of ready requests of threads which
/// are waiting for getting control of a limited-access resource.
@ -123,72 +124,55 @@ namespace sgpem
///
/// \param resource The resource the requests are for
/// \return The current ready requests queue.
virtual const SubRequestQueue&
get_request_queue(resource_key_t resource_key) const;
SubRequestQueue&
get_request_queue(resource_key_t resource_key);
typedef std::map<resource_key_t, SubRequestQueue> SubRequestQueues;
virtual const SubRequestQueue& get_request_queue(resource_key_t resource_key) const;
SubRequestQueue& get_request_queue(resource_key_t resource_key);
/// \brief Returns the set of request queues.
///
/// Returns a reference to the map from resources to subreuqest queues.
/// It is needed by history to delete the queue associated to a deleted
/// resource.
SubRequestQueues&
get_subrequest_queues();
SubRequestQueues& get_subrequest_queues();
/// \brief Returns a snapshot of the current scheduler's ready queue.
///
/// Returns a ReadyQueue object representing the queue
/// of ready processes or ready threads, depending on the
/// scheduling policy, which are waiting for getting control
/// of the CPU.
///
/// \return the current ready queue (constant).
virtual const ReadyQueue&
get_sorted_queue() const;
virtual const ReadyQueue& get_sorted_queue() const;
/// \brief Non-constant version of get_sorted_queue()
///
/// \return the current ready queue.
/// \see get_sorted_queue()
virtual ReadyQueue&
get_sorted_queue();
/// \brief The standard virtual destructor.
/// The standard virtual destructor.
virtual
~ConcreteEnvironment();
virtual ReadyQueue& get_sorted_queue();
private:
/// \brief The container of all Resource objecs.
///
/// Actually contains only DynamicResource objects.
// resources come before processes because of
// destruction order. See destructor implementation
Resources _resources;
/// \brief The container of all Process objecs.
///
/// Actually contains only DynamicProcess objects.
Processes _processes;
/// \brief The queue of the ready schedulables
///
/// Does not contain the running process.
ReadyQueue _sched_queue;
SubRequestQueues _sreq_queues;
}
; //~ class ConcreteEnvironment
}; //~ class ConcreteEnvironment
} //~ namespace sgpem