- Don't expose unnecessary interface

- Do a bit of auditing


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1250 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-09-17 19:59:41 +00:00
parent 0c8e39eeec
commit 972db124e6
13 changed files with 132 additions and 198 deletions

View File

@ -268,7 +268,6 @@ src_backend_libbackend_la_SOURCES = \
# Please note that the first listed header is generated by
# configure.
pkginclude_HEADERS += \
src/backend/sgpemv2/cpp_resource_policy_manager.hh \
src/backend/sgpemv2/cpu_policies_gatekeeper.hh \
src/backend/sgpemv2/cpu_policy.hh \
src/backend/sgpemv2/cpu_policy_exception.hh \
@ -291,11 +290,7 @@ pkginclude_HEADERS += \
src/backend/sgpemv2/resource.hh \
src/backend/sgpemv2/resource_policies_gatekeeper.hh \
src/backend/sgpemv2/resource_policy.hh \
src/backend/sgpemv2/resource_policy_fifo.hh \
src/backend/sgpemv2/resource_policy_lifo.hh \
src/backend/sgpemv2/resource_policy_manager.hh \
src/backend/sgpemv2/resource_policy_priority.hh \
src/backend/sgpemv2/resource_policy_priority_inheritance.hh \
src/backend/sgpemv2/process.hh \
src/backend/sgpemv2/schedulable.hh \
src/backend/sgpemv2/schedulable_statistics.hh \
@ -319,6 +314,7 @@ pkginclude_HEADERS += \
# Put here headers used internally by the backend
# They won't be installed for the end-user.
noinst_HEADERS += \
src/backend/cpp_resource_policy_manager.hh \
src/backend/concrete_environment.hh \
src/backend/concrete_history.hh \
src/backend/concrete_process_statistics.hh \
@ -332,6 +328,10 @@ noinst_HEADERS += \
src/backend/dynamic_schedulable.hh \
src/backend/dynamic_sub_request.hh \
src/backend/dynamic_thread.hh \
src/backend/resource_policy_fifo.hh \
src/backend/resource_policy_lifo.hh \
src/backend/resource_policy_priority.hh \
src/backend/resource_policy_priority_inheritance.hh \
src/backend/static_process.hh \
src/backend/static_request.hh \
src/backend/static_resource.hh \

View File

@ -19,11 +19,12 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <sgpemv2/cpp_resource_policy_manager.hh>
#include <sgpemv2/resource_policy_lifo.hh>
#include <sgpemv2/resource_policy_fifo.hh>
#include <sgpemv2/resource_policy_priority.hh>
#include <sgpemv2/resource_policy_priority_inheritance.hh>
#include "cpp_resource_policy_manager.hh"
#include "resource_policy_lifo.hh"
#include "resource_policy_fifo.hh"
#include "resource_policy_priority.hh"
#include "resource_policy_priority_inheritance.hh"
#include <sgpemv2/resource_policies_gatekeeper.hh>
using namespace sgpem;

View File

@ -26,13 +26,10 @@ namespace sgpem
class ResourcePolicy;
}
#include <sgpemv2/sgpemv2-visibility.hh>
#include <sgpemv2/resource_policy_manager.hh>
#include <vector>
namespace sgpem
{
class CppResourcePolicyManager;
@ -40,7 +37,7 @@ namespace sgpem
/**
ResourcePolicyManager is the Abstract Factory for \ref ResourcePolicy objects.
*/
class SG_DLLEXPORT CppResourcePolicyManager : public ResourcePolicyManager
class CppResourcePolicyManager : public ResourcePolicyManager
{
public:
/** \brief CppResourcePolicyManager constructor

View File

@ -18,7 +18,7 @@
// along with SGPEMv2; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <sgpemv2/resource_policy_fifo.hh>
#include "resource_policy_fifo.hh"
using namespace std;
@ -28,12 +28,6 @@ ResourcePolicyFiFo::~ResourcePolicyFiFo()
{}
PolicyParameters&
ResourcePolicyFiFo::get_parameters()
{
return _parameters;
}
void
ResourcePolicyFiFo::configure()
throw(UserInterruptException)

View File

@ -1,4 +1,4 @@
// src/backend/sgpemv2/resource_policy_fifo.hh - Copyright 2005, 2006, University
// src/backend/resource_policy_fifo.hh - Copyright 2005, 2006, University
// of Padova, dept. of Pure and Applied
// Mathematics
//
@ -21,7 +21,12 @@
#ifndef RESOURCE_POLICY_FIFO_HH
#define RESOURCE_POLICY_FIFO_HH 1
#include "gettext.h"
#include <glibmm/ustring.h>
#include <sgpemv2/resource_policy.hh>
#include <sgpemv2/user_interrupt_exception.hh>
namespace sgpem
{
@ -31,13 +36,9 @@ namespace sgpem
It's a Strategy wich stay for a resource allocating algorithm.
It implements the related resource allocation policy.
*/
class SG_DLLEXPORT ResourcePolicyFiFo : public ResourcePolicy
class ResourcePolicyFiFo : public ResourcePolicy
{
public:
/// \brief Standard virtual destructor.
///
/// Standard virtual destructor.
virtual ~ResourcePolicyFiFo();
/**
@ -70,16 +71,6 @@ namespace sgpem
virtual void activate();
virtual void deactivate();
/**
Gets the parameters related with this policy.
\return The policy parameters.
*/
PolicyParameters& get_parameters();
protected:
PolicyParameters _parameters;
};
}//~ namespace sgpem

View File

@ -18,8 +18,7 @@
// along with SGPEMv2; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <sgpemv2/resource_policy_lifo.hh>
#include "resource_policy_lifo.hh"
using namespace std;
using namespace sgpem;
@ -28,12 +27,6 @@ ResourcePolicyLiFo::~ResourcePolicyLiFo()
{}
PolicyParameters&
ResourcePolicyLiFo::get_parameters()
{
return _parameters;
}
void
ResourcePolicyLiFo::configure()
throw(UserInterruptException)

View File

@ -0,0 +1,87 @@
// src/backend/resource_policy_lifo.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 RESOURCE_POLICY_LIFO_HH
#define RESOURCE_POLICY_LIFO_HH 1
#include "gettext.h"
#include <sgpemv2/policy_parameters.hh>
#include <sgpemv2/resource_policy.hh>
#include <sgpemv2/user_interrupt_exception.hh>
#include <glibmm/ustring.h>
namespace sgpem
{
class ResourcePolicyLiFo;
/** \brief
It's a Strategy wich stay for a resource allocating algorithm.
It implements the related resource allocation policy.
*/
class ResourcePolicyLiFo : public ResourcePolicy
{
public:
virtual ~ResourcePolicyLiFo();
/** \brief Initialize the inner components of the policy.
*
* Because it's a pure virtual method, must be re-implemented
* in concrete derived classes.
*/
virtual void configure() throw(UserInterruptException);
/** \brief Mixes the queues.
*
* Because it's a pure virtual method, must be re-implemented
* in concrete derived classes.
*/
virtual void enforce(Environment& environment, Environment::SubRequestQueue& queue, SubRequest& sr) throw(UserInterruptException);
/** \brief Gets a string description of the policy.
*
* Because it's a pure virtual method, must be re-implemented
* in concrete derived classes.
* \return String description of the policy.
*/
virtual Glib::ustring get_description() const;
/** \brief Returns the policy name
*/
virtual Glib::ustring get_name() const;
/** \brief No-op method.
*
* \see ResourcePolicy::activate()
*/
virtual void activate();
/** \brief No-op method.
*
* \see ResourcePolicy::deactivate()
*/
virtual void deactivate();
};
}//~ namespace sgpem
#endif

View File

@ -18,9 +18,9 @@
// along with SGPEMv2; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <sgpemv2/resource_policy_priority.hh>
#include <sgpemv2/thread.hh>
#include "resource_policy_priority.hh"
#include <sgpemv2/thread.hh>
using namespace sgpem;
@ -29,12 +29,6 @@ ResourcePolicyPriority::~ResourcePolicyPriority()
}
PolicyParameters&
ResourcePolicyPriority::get_parameters()
{
return _parameters;
}
void
ResourcePolicyPriority::configure()
throw(UserInterruptException)

View File

@ -1,4 +1,4 @@
// src/backend/sgpemv2/resource_policy_lifo.hh - Copyright 2005, 2006, University
// src/backend/resource_policy_priority.hh - Copyright 2005, 2006, University
// of Padova, dept. of Pure and Applied
// Mathematics
//
@ -18,27 +18,29 @@
// along with SGPEMv2; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef RESOURCE_POLICY_LIFO_HH
#define RESOURCE_POLICY_LIFO_HH 1
#ifndef RESOURCE_POLICY_PRIORITY_HH
#define RESOURCE_POLICY_PRIORITY_HH 1
#include "gettext.h"
#include <sgpemv2/resource_policy.hh>
#include <sgpemv2/policy_parameters.hh>
#include <sgpemv2/user_interrupt_exception.hh>
#include <glibmm/ustring.h>
namespace sgpem
{
class ResourcePolicyLiFo;
class ResourcePolicyPriority;
/** \brief
It's a Strategy wich stay for a resource allocating algorithm.
It implements the related resource allocation policy.
*/
class SG_DLLEXPORT ResourcePolicyLiFo : public ResourcePolicy
class ResourcePolicyPriority : public ResourcePolicy
{
public:
/// \brief Standard virtual destructor.
///
/// Standard virtual destructor.
virtual ~ResourcePolicyLiFo();
virtual ~ResourcePolicyPriority();
/**
Initialize the inner components of the policy.
@ -49,10 +51,7 @@ namespace sgpem
virtual void configure() throw(UserInterruptException);
/**
Mixes the queues.
Because it's a pure virtual method, must be re-implemented
in concrete derived classes.
Mixes the queues.
*/
virtual void enforce(Environment& environment, Environment::SubRequestQueue& queue, SubRequest& sr) throw(UserInterruptException);
@ -70,16 +69,6 @@ namespace sgpem
virtual void activate();
virtual void deactivate();
/**
Gets the parameters related with this policy.
\return The policy parameters.
*/
PolicyParameters& get_parameters();
protected:
PolicyParameters _parameters;
};
}//~ namespace sgpem

View File

@ -18,7 +18,8 @@
// along with SGPEMv2; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <sgpemv2/resource_policy_priority_inheritance.hh>
#include "resource_policy_priority_inheritance.hh"
#include <sgpemv2/thread.hh>
using namespace std;
@ -27,13 +28,6 @@ using namespace sgpem;
ResourcePolicyPriorityInheritance::~ResourcePolicyPriorityInheritance()
{}
PolicyParameters&
ResourcePolicyPriorityInheritance::get_parameters()
{
return _parameters;
}
void
ResourcePolicyPriorityInheritance::configure()
throw(UserInterruptException)

View File

@ -1,4 +1,4 @@
// src/backend/sgpemv2/resource_policy_priority_inheritance.hh - Copyright 2005, 2006, University
// src/backend/resource_policy_priority_inheritance.hh - Copyright 2005, 2006, University
// of Padova, dept. of Pure and Applied
// Mathematics
//
@ -34,7 +34,7 @@ namespace sgpem
* \brief It's a Strategy wich stay for a resource allocating algorithm.
* It implements the related resource allocation policy.
*/
class SG_DLLEXPORT ResourcePolicyPriorityInheritance : public ResourcePolicy
class ResourcePolicyPriorityInheritance : public ResourcePolicy
{
public:
@ -75,16 +75,6 @@ namespace sgpem
virtual void activate();
virtual void deactivate();
/**
\brief Gets the parameters related with this policy.
\return The policy parameters.
*/
PolicyParameters& get_parameters();
protected:
PolicyParameters _parameters;
};
}//~ namespace sgpem

View File

@ -1,4 +1,4 @@
// src/backend/null_policy_exception.hh - Copyright 2005, 2006, University
// src/backend/sgpemv2/null_policy_exception.hh - Copyright 2005, 2006, University
// of Padova, dept. of Pure and Applied
// Mathematics
//
@ -33,10 +33,13 @@ namespace sgpem
{
class NullPolicyException;
/** \brief Exception thrown when no policy has been selected and
* an operation that involves scheduling is requested
*/
class SG_DLLEXPORT NullPolicyException : public std::runtime_error
{
public:
NullPolicyException(const char* msg = "");
explicit NullPolicyException(const char* msg = "");
};
} //~ namespace sgpem

View File

@ -1,99 +0,0 @@
// src/backend/sgpemv2/resource_policy_priority.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 RESOURCE_POLICY_PRIORITY_HH
#define RESOURCE_POLICY_PRIORITY_HH 1
#include <sgpemv2/resource_policy.hh>
namespace sgpem
{
/// \brief A resource allocation policy which provides a better service
/// to higer priority threads.
///
/// A resource allocation policy which provides a better service
/// to higer priority threads. This policy sorts the request queues
/// following the priority of the owners of the requests.
class ResourcePolicyPriority;
class SG_DLLEXPORT ResourcePolicyPriority : public ResourcePolicy
{
public:
/// \brief Standard virtual destructor.
///
/// Standard virtual destructor.
virtual ~ResourcePolicyPriority();
/// \brief Initializes the inner components of the policy.
///
/// Does nothing.
virtual void configure() throw(UserInterruptException);
/// \brief Sorts the subrequest queue letting higher priority threads to be the first ones
/// to get the resources.
///
/// Sorts the subrequest queue letting higher priority threads to be the first ones
/// to get the resources.
///
/// \param environment the environment on which the policy applies.
/// \param queue the queue where a subrequest has just been added.
/// \param sr the subrequest which has just been added.
virtual void enforce(Environment& environment, Environment::SubRequestQueue& queue, SubRequest& sr) throw(UserInterruptException);
/// \brief Returns a description of the policy.
///
/// Returns a description of the policy.
/// \return a description of the policy.
virtual Glib::ustring get_description() const;
/// \brief Returns the name of the policy.
///
/// Returns the name of the policy.
/// \return the name of the policy.
virtual Glib::ustring get_name() const;
/// \brief Activates the policy.
///
/// Does nothing.
virtual void activate();
/// \brief Deactivates the policy.
///
/// Does nothing.
virtual void deactivate();
/// \brief Returns the parameters used to customize the policy.
///
/// Returns the parameters used to customize the policy.
/// The user may modify them directly.
/// \return the parameters used to customize the policy.
PolicyParameters& get_parameters();
protected:
PolicyParameters _parameters;
};
}//~ namespace sgpem
#endif