- Fix all includes, separating header files to be installed
from other headers. Take it while it's hot. - To all those that lock source files: you'll burn in hell. Really. It'll be painful, dreadful and above all *long*. *Eternally* long. And there'll be Freddy Mercury and The Queen playing, *all the time*, day after boring, useless, sorrowful day. The song will be *``Radio Ga-Ga''*, in secula secularum amen. git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1033 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
6458511399
commit
0f718f2899
156 changed files with 547 additions and 521 deletions
|
@ -22,11 +22,11 @@
|
|||
#include "dynamic_process.hh"
|
||||
#include "dynamic_resource.hh"
|
||||
#include "dynamic_sub_request.hh"
|
||||
#include "sub_request.hh"
|
||||
#include "thread.hh"
|
||||
#include <sgpemv2/sub_request.hh>
|
||||
#include <sgpemv2/thread.hh>
|
||||
|
||||
#include "deletor.tcc"
|
||||
#include "sequences.tcc"
|
||||
#include <sgpemv2/templates/deletor.tcc>
|
||||
#include <sgpemv2/templates/sequences.tcc>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
|
|
@ -22,11 +22,11 @@
|
|||
#define CONCRETE_ENVIRONMENT_HH 1
|
||||
|
||||
#include "config.h"
|
||||
#include "environment.hh"
|
||||
#include "resource.hh"
|
||||
#include <sgpemv2/environment.hh>
|
||||
#include <sgpemv2/resource.hh>
|
||||
#include "dynamic_process.hh"
|
||||
#include "dynamic_request.hh"
|
||||
#include "ready_queue.hh"
|
||||
#include <sgpemv2/ready_queue.hh>
|
||||
|
||||
|
||||
namespace sgpem
|
||||
|
|
|
@ -32,11 +32,11 @@
|
|||
#include "static_request.hh"
|
||||
#include "static_sub_request.hh"
|
||||
|
||||
#include "history_observer.hh"
|
||||
#include <sgpemv2/history_observer.hh>
|
||||
#include "concrete_history.hh"
|
||||
|
||||
#include "deletor.tcc"
|
||||
#include "smartp.tcc"
|
||||
#include <sgpemv2/templates/deletor.tcc>
|
||||
#include <sgpemv2/templates/smartp.tcc>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "dynamic_resource.hh"
|
||||
#include "dynamic_sub_request.hh"
|
||||
#include "dynamic_thread.hh"
|
||||
#include "history.hh"
|
||||
#include <sgpemv2/history.hh>
|
||||
|
||||
#include <glibmm/ustring.h>
|
||||
|
||||
|
|
|
@ -19,14 +19,14 @@
|
|||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "concrete_simulation.hh"
|
||||
#include "simulation_observer.hh"
|
||||
#include "scheduler.hh"
|
||||
#include "cpu_policies_gatekeeper.hh"
|
||||
#include "resource_policies_gatekeeper.hh"
|
||||
#include <sgpemv2/simulation_observer.hh>
|
||||
#include <sgpemv2/scheduler.hh>
|
||||
#include <sgpemv2/cpu_policies_gatekeeper.hh>
|
||||
#include <sgpemv2/resource_policies_gatekeeper.hh>
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "smartp.tcc"
|
||||
#include <sgpemv2/templates/smartp.tcc>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "simulation.hh"
|
||||
#include <sgpemv2/simulation.hh>
|
||||
#include "concrete_history.hh"
|
||||
|
||||
#include <map>
|
||||
|
|
|
@ -20,13 +20,13 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "cpu_policies_gatekeeper.hh"
|
||||
#include "cpu_policy_manager.hh"
|
||||
#include "cpu_policy.hh"
|
||||
#include <sgpemv2/cpu_policies_gatekeeper.hh>
|
||||
#include <sgpemv2/cpu_policy_manager.hh>
|
||||
#include <sgpemv2/cpu_policy.hh>
|
||||
#include "concrete_history.hh"
|
||||
|
||||
// Include full template definition only in implementation files:
|
||||
#include "singleton.tcc"
|
||||
#include <sgpemv2/templates/singleton.tcc>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
|
|
@ -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 "cpu_policy.hh"
|
||||
#include <sgpemv2/cpu_policy.hh>
|
||||
using namespace std;
|
||||
using namespace sgpem;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
// It could be necessary to do dynamic type-checking when
|
||||
// catching it (with typeinfo).
|
||||
|
||||
#include "malformed_policy_exception.hh"
|
||||
#include <sgpemv2/malformed_policy_exception.hh>
|
||||
using namespace sgpem;
|
||||
|
||||
CPUPolicyException::CPUPolicyException(const std::string& msg)
|
||||
|
|
|
@ -19,8 +19,10 @@
|
|||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
|
||||
#include "cpu_policy_manager.hh"
|
||||
#include "cpu_policies_gatekeeper.hh"
|
||||
#include <sgpemv2/cpu_policy_manager.hh>
|
||||
#include <sgpemv2/cpu_policies_gatekeeper.hh>
|
||||
|
||||
using namespace sgpem;
|
||||
|
||||
CPUPolicyManager::CPUPolicyManager()
|
||||
{
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
|
||||
#include "resource_policy_lifo.hh"
|
||||
#include "default_resource_policy_manager.hh"
|
||||
#include "resource_policies_gatekeeper.hh"
|
||||
#include <sgpemv2/resource_policy_lifo.hh>
|
||||
#include <sgpemv2/default_resource_policy_manager.hh>
|
||||
#include <sgpemv2/resource_policies_gatekeeper.hh>
|
||||
|
||||
using namespace sgpem;
|
||||
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
#include "dynamic_process.hh"
|
||||
#include "static_process.hh"
|
||||
#include "dynamic_thread.hh"
|
||||
#include "serialize_visitor.hh"
|
||||
#include <sgpemv2/serialize_visitor.hh>
|
||||
|
||||
#include "deletor.tcc"
|
||||
#include "sequences.tcc"
|
||||
#include <sgpemv2/templates/deletor.tcc>
|
||||
#include <sgpemv2/templates/sequences.tcc>
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
#include "config.h"
|
||||
#include "gettext.h"
|
||||
|
||||
#include "process.hh"
|
||||
#include <sgpemv2/process.hh>
|
||||
#include "dynamic_schedulable.hh"
|
||||
#include "static_process.hh"
|
||||
|
||||
#include "smartp.tcc"
|
||||
#include <sgpemv2/templates/smartp.tcc>
|
||||
|
||||
#include <glibmm/ustring.h>
|
||||
#include <vector>
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
#include "static_request.hh"
|
||||
#include "dynamic_sub_request.hh"
|
||||
#include "dynamic_thread.hh"
|
||||
#include "serialize_visitor.hh"
|
||||
#include <sgpemv2/serialize_visitor.hh>
|
||||
|
||||
#include "deletor.tcc"
|
||||
#include "smartp.tcc"
|
||||
#include <sgpemv2/templates/deletor.tcc>
|
||||
#include <sgpemv2/templates/smartp.tcc>
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
|
|
@ -23,11 +23,11 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "request.hh"
|
||||
#include <sgpemv2/request.hh>
|
||||
#include "static_request.hh"
|
||||
#include "dynamic_thread.hh"
|
||||
|
||||
#include "smartp.hh"
|
||||
#include <sgpemv2/templates/smartp.hh>
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
|
||||
#include "dynamic_resource.hh"
|
||||
#include "static_resource.hh"
|
||||
#include "serialize_visitor.hh"
|
||||
#include <sgpemv2/serialize_visitor.hh>
|
||||
|
||||
#include "smartp.tcc"
|
||||
#include <sgpemv2/templates/smartp.tcc>
|
||||
|
||||
#include <cassert>
|
||||
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
#include "config.h"
|
||||
#include "glibmm/ustring.h"
|
||||
|
||||
#include "smartp.hh"
|
||||
#include <sgpemv2/templates/smartp.hh>
|
||||
|
||||
#include "resource.hh"
|
||||
#include <sgpemv2/resource.hh>
|
||||
#include "static_resource.hh"
|
||||
|
||||
namespace sgpem
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include "dynamic_schedulable.hh"
|
||||
|
||||
#include "smartp.tcc"
|
||||
#include <sgpemv2/templates/smartp.tcc>
|
||||
|
||||
#include <cassert>
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#define DYNAMIC_SCHEDULABLE_HH 1
|
||||
|
||||
#include "config.h"
|
||||
#include "schedulable.hh"
|
||||
#include <sgpemv2/schedulable.hh>
|
||||
#include "static_schedulable.hh"
|
||||
|
||||
namespace sgpem
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
|
||||
#include "dynamic_sub_request.hh"
|
||||
#include "dynamic_request.hh"
|
||||
#include "request.hh"
|
||||
#include "serialize_visitor.hh"
|
||||
#include <sgpemv2/request.hh>
|
||||
#include <sgpemv2/serialize_visitor.hh>
|
||||
|
||||
#include "smartp.tcc"
|
||||
#include <sgpemv2/templates/smartp.tcc>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
|
|
@ -23,13 +23,13 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "request.hh"
|
||||
#include "sub_request.hh"
|
||||
#include <sgpemv2/request.hh>
|
||||
#include <sgpemv2/sub_request.hh>
|
||||
#include "dynamic_request.hh"
|
||||
#include "dynamic_resource.hh"
|
||||
#include "static_sub_request.hh"
|
||||
|
||||
#include "smartp.hh"
|
||||
#include <sgpemv2/templates/smartp.hh>
|
||||
|
||||
namespace sgpem
|
||||
{
|
||||
|
|
|
@ -21,14 +21,14 @@
|
|||
#include "dynamic_thread.hh"
|
||||
#include "static_thread.hh"
|
||||
#include "dynamic_request.hh"
|
||||
#include "serialize_visitor.hh"
|
||||
#include <sgpemv2/serialize_visitor.hh>
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <cassert>
|
||||
|
||||
#include "deletor.tcc"
|
||||
#include "smartp.tcc"
|
||||
#include <sgpemv2/templates/deletor.tcc>
|
||||
#include <sgpemv2/templates/smartp.tcc>
|
||||
|
||||
using namespace sgpem;
|
||||
using namespace std;
|
||||
|
|
|
@ -26,11 +26,11 @@
|
|||
#include "glibmm/ustring.h"
|
||||
#include <vector>
|
||||
|
||||
#include "thread.hh"
|
||||
#include <sgpemv2/thread.hh>
|
||||
#include "dynamic_process.hh"
|
||||
#include "dynamic_schedulable.hh"
|
||||
|
||||
#include "smartp.hh"
|
||||
#include <sgpemv2/templates/smartp.hh>
|
||||
|
||||
namespace sgpem
|
||||
{
|
||||
|
|
|
@ -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 "environment.hh"
|
||||
#include <sgpemv2/environment.hh>
|
||||
|
||||
using namespace sgpem;
|
||||
|
||||
|
|
|
@ -19,14 +19,16 @@
|
|||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "config.h"
|
||||
#include "global_preferences.hh"
|
||||
#include "key_file.hh"
|
||||
#include "string_utils.hh"
|
||||
|
||||
#include <sgpemv2/global_preferences.hh>
|
||||
#include <sgpemv2/key_file.hh>
|
||||
#include <sgpemv2/string_utils.hh>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
|
||||
// Do not include in header file:
|
||||
#include "singleton.tcc"
|
||||
#include <sgpemv2/templates/singleton.tcc>
|
||||
|
||||
using namespace sgpem;
|
||||
|
||||
// Explicit template instantiation to allow to export symbols from the DSO.
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "config.h"
|
||||
#include "key_file.hh"
|
||||
#include <sgpemv2/key_file.hh>
|
||||
#include "global_preferences_serializer.hh"
|
||||
#include <sstream>
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
#ifndef GLOBAL_PREFERENCES_SERIALIZER_HH
|
||||
#define GLOBAL_PREFERENCES_SERIALIZER_HH 1
|
||||
|
||||
#include "global_preferences.hh"
|
||||
#include "key_file.hh"
|
||||
#include <sgpemv2/global_preferences.hh>
|
||||
#include <sgpemv2/key_file.hh>
|
||||
|
||||
namespace sgpem
|
||||
{
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "history.hh"
|
||||
#include "history_observer.hh"
|
||||
#include <sgpemv2/history.hh>
|
||||
#include <sgpemv2/history_observer.hh>
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
|
|
@ -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 "history_observer.hh"
|
||||
#include <sgpemv2/history_observer.hh>
|
||||
|
||||
sgpem::HistoryObserver::~HistoryObserver() {}
|
||||
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
// along with SGPEMv2; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "holt_graph.hh"
|
||||
#include <sgpemv2/holt_graph.hh>
|
||||
|
||||
#include "history.hh"
|
||||
#include "process.hh"
|
||||
#include "thread.hh"
|
||||
#include <sgpemv2/history.hh>
|
||||
#include <sgpemv2/process.hh>
|
||||
#include <sgpemv2/thread.hh>
|
||||
|
||||
using namespace sgpem;
|
||||
using namespace std;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "invalid_plugin_exception.hh"
|
||||
#include <sgpemv2/invalid_plugin_exception.hh>
|
||||
|
||||
using namespace sgpem;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "config.h"
|
||||
#include "key_file.hh"
|
||||
#include <sgpemv2/key_file.hh>
|
||||
#include <fstream>
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
// It could be necessary to do dynamic type-checking when
|
||||
// catching it (with typeinfo).
|
||||
|
||||
#include "malformed_policy_exception.hh"
|
||||
#include <sgpemv2/malformed_policy_exception.hh>
|
||||
using namespace sgpem;
|
||||
|
||||
MalformedPolicyException::MalformedPolicyException(const std::string& msg)
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "module.hh"
|
||||
#include <sgpemv2/module.hh>
|
||||
|
||||
// FIXME: remove this header
|
||||
#include <iostream>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
// It could be necessary to do dynamic type-checking when
|
||||
// catching it (with typeinfo).
|
||||
|
||||
#include "null_policy_exception.hh"
|
||||
#include <sgpemv2/null_policy_exception.hh>
|
||||
using namespace sgpem;
|
||||
|
||||
NullPolicyException::NullPolicyException(const char* msg)
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "plugin_manager.hh"
|
||||
#include "module.hh"
|
||||
#include "global_preferences.hh"
|
||||
#include <sgpemv2/plugin_manager.hh>
|
||||
#include <sgpemv2/module.hh>
|
||||
#include <sgpemv2/global_preferences.hh>
|
||||
|
||||
#include "deletor.tcc"
|
||||
#include "singleton.tcc"
|
||||
#include <sgpemv2/templates/deletor.tcc>
|
||||
#include <sgpemv2/templates/singleton.tcc>
|
||||
|
||||
#include <glibmm/fileutils.h>
|
||||
#include <glibmm/pattern.h>
|
||||
|
|
|
@ -18,11 +18,22 @@
|
|||
// along with SGPEMv2; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "policy_parameters.hh"
|
||||
#include <sgpemv2/policy_parameters.hh>
|
||||
#include <sgpemv2/templates/parameter.tcc>
|
||||
|
||||
using namespace std;
|
||||
using namespace sgpem;
|
||||
using Glib::ustring;
|
||||
|
||||
|
||||
// instantiate Parameter template for use outside this DSO
|
||||
namespace sgpem {
|
||||
template class SG_DLLEXPORT PolicyParameters::Parameter<int>;
|
||||
template class SG_DLLEXPORT PolicyParameters::Parameter<float>;
|
||||
template class SG_DLLEXPORT PolicyParameters::Parameter<Glib::ustring>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Register a new parameter of type integer.
|
||||
If there is a parameter with the same name and type it will be overwritten.
|
||||
|
|
|
@ -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 "process.hh"
|
||||
#include <sgpemv2/process.hh>
|
||||
|
||||
using namespace sgpem;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "config.h"
|
||||
#include "gettext.h"
|
||||
|
||||
#include "ready_queue.hh"
|
||||
#include <sgpemv2/ready_queue.hh>
|
||||
|
||||
using sgpem::ReadyQueue;
|
||||
|
||||
|
|
|
@ -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 "request.hh"
|
||||
#include <sgpemv2/request.hh>
|
||||
|
||||
using namespace sgpem;
|
||||
|
||||
|
|
|
@ -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 "resource.hh"
|
||||
#include <sgpemv2/resource.hh>
|
||||
|
||||
using namespace sgpem;
|
||||
|
||||
|
|
|
@ -20,13 +20,13 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "resource_policies_gatekeeper.hh"
|
||||
#include "resource_policy_manager.hh"
|
||||
#include "resource_policy.hh"
|
||||
#include <sgpemv2/resource_policies_gatekeeper.hh>
|
||||
#include <sgpemv2/resource_policy_manager.hh>
|
||||
#include <sgpemv2/resource_policy.hh>
|
||||
#include "concrete_history.hh"
|
||||
|
||||
// Include full template definition only in implementation files:
|
||||
#include "singleton.tcc"
|
||||
#include <sgpemv2/templates/singleton.tcc>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
|
|
@ -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 "resource_policy.hh"
|
||||
#include <sgpemv2/resource_policy.hh>
|
||||
using namespace std;
|
||||
using namespace sgpem;
|
||||
|
||||
|
|
|
@ -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 "resource_policy_lifo.hh"
|
||||
#include <sgpemv2/resource_policy_lifo.hh>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
|
||||
#include "resource_policy_manager.hh"
|
||||
#include "resource_policies_gatekeeper.hh"
|
||||
#include <sgpemv2/resource_policy_manager.hh>
|
||||
#include <sgpemv2/resource_policies_gatekeeper.hh>
|
||||
|
||||
using namespace sgpem;
|
||||
|
||||
|
|
|
@ -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 "schedulable.hh"
|
||||
#include <sgpemv2/schedulable.hh>
|
||||
|
||||
using namespace sgpem;
|
||||
|
||||
|
|
|
@ -29,14 +29,14 @@
|
|||
|
||||
#include "concrete_environment.hh"
|
||||
#include "concrete_history.hh"
|
||||
#include "cpu_policy.hh"
|
||||
#include "cpu_policy_exception.hh"
|
||||
#include <sgpemv2/cpu_policy.hh>
|
||||
#include <sgpemv2/cpu_policy_exception.hh>
|
||||
|
||||
#include "scheduler.hh"
|
||||
#include <sgpemv2/scheduler.hh>
|
||||
|
||||
// Do not include full template definition in the header file
|
||||
#include "singleton.tcc"
|
||||
#include "sequences.tcc"
|
||||
#include <sgpemv2/templates/singleton.tcc>
|
||||
#include <sgpemv2/templates/sequences.tcc>
|
||||
|
||||
#include <glibmm/thread.h>
|
||||
|
||||
|
|
|
@ -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 "serialize_visitor.hh"
|
||||
#include <sgpemv2/serialize_visitor.hh>
|
||||
|
||||
using namespace sgpem;
|
||||
|
||||
|
|
|
@ -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 "serializer.hh"
|
||||
#include <sgpemv2/serializer.hh>
|
||||
|
||||
#include "serializers_gatekeeper.hh"
|
||||
#include <sgpemv2/serializers_gatekeeper.hh>
|
||||
|
||||
using namespace sgpem;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "serializer_error.hh"
|
||||
#include <sgpemv2/serializer_error.hh>
|
||||
|
||||
using namespace sgpem;
|
||||
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "serializers_gatekeeper.hh"
|
||||
#include "serializer.hh"
|
||||
#include <sgpemv2/serializers_gatekeeper.hh>
|
||||
#include <sgpemv2/serializer.hh>
|
||||
|
||||
// Include full template definition only in implementation files:
|
||||
#include "singleton.tcc"
|
||||
#include <sgpemv2/templates/singleton.tcc>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// src/backend/cpu_policies_gatekeeper.hh - Copyright 2005, 2006, University
|
||||
// src/sgpemv2/cpu_policies_gatekeeper.hhbackend/cpu_policy.hh - Copyright 2005, 2006, University
|
||||
// of Padova, dept. of Pure and Applied
|
||||
// Mathematics
|
||||
//
|
||||
|
@ -34,9 +34,9 @@ namespace sgpem
|
|||
#include <map>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "singleton.hh"
|
||||
#include "malformed_policy_exception.hh"
|
||||
#include "user_interrupt_exception.hh"
|
||||
#include <sgpemv2/templates/singleton.hh>
|
||||
#include <sgpemv2/malformed_policy_exception.hh>
|
||||
#include <sgpemv2/user_interrupt_exception.hh>
|
||||
|
||||
namespace sgpem
|
||||
{
|
|
@ -26,9 +26,9 @@
|
|||
|
||||
#include "glibmm/ustring.h"
|
||||
|
||||
#include "policy_parameters.hh"
|
||||
#include "user_interrupt_exception.hh"
|
||||
#include "malformed_policy_exception.hh"
|
||||
#include <sgpemv2/policy_parameters.hh>
|
||||
#include <sgpemv2/user_interrupt_exception.hh>
|
||||
#include <sgpemv2/malformed_policy_exception.hh>
|
||||
|
||||
#include <stdexcept>
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "cpu_policy.hh"
|
||||
#include <sgpemv2/cpu_policy.hh>
|
||||
|
||||
#include <vector>
|
||||
|
|
@ -28,7 +28,7 @@ namespace sgpem
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "resource_policy_manager.hh"
|
||||
#include <sgpemv2/resource_policy_manager.hh>
|
||||
|
||||
#include <vector>
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "sub_request.hh"
|
||||
#include <sgpemv2/sub_request.hh>
|
||||
|
||||
#include <map>
|
||||
#include <utility>
|
|
@ -28,9 +28,9 @@
|
|||
#include <vector>
|
||||
|
||||
// Do not include complete template definition here:
|
||||
#include "singleton.hh"
|
||||
#include "schedulable.hh"
|
||||
#include "request.hh"
|
||||
#include <sgpemv2/templates/singleton.hh>
|
||||
#include <sgpemv2/schedulable.hh>
|
||||
#include <sgpemv2/request.hh>
|
||||
|
||||
namespace sgpem
|
||||
{
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "environment.hh"
|
||||
#include <sgpemv2/environment.hh>
|
||||
|
||||
#include <glibmm/ustring.h>
|
||||
|
|
@ -28,7 +28,7 @@ namespace sgpem
|
|||
class Request;
|
||||
}
|
||||
|
||||
#include "history_observer.hh"
|
||||
#include <sgpemv2/history_observer.hh>
|
||||
|
||||
#include <set>
|
||||
#include <vector>
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "cpu_policy_exception.hh"
|
||||
#include <sgpemv2/cpu_policy_exception.hh>
|
||||
|
||||
namespace sgpem
|
||||
{
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "invalid_plugin_exception.hh"
|
||||
#include <sgpemv2/invalid_plugin_exception.hh>
|
||||
|
||||
#include <glibmm/module.h>
|
||||
#include <glibmm/ustring.h>
|
|
@ -28,7 +28,7 @@ namespace sgpem
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "singleton.hh"
|
||||
#include <sgpemv2/templates/singleton.hh>
|
||||
|
||||
#include <vector>
|
||||
|
|
@ -30,11 +30,13 @@
|
|||
|
||||
namespace sgpem
|
||||
{
|
||||
|
||||
class SG_DLLEXPORT PolicyParametersException : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
PolicyParametersException(char* msg): std::runtime_error(msg) {}};
|
||||
class PolicyParameters;
|
||||
PolicyParametersException(char* msg): std::runtime_error(msg) {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** \brief Represents all configurable parameters of a single scheduling policy.
|
||||
|
@ -46,8 +48,72 @@ namespace sgpem
|
|||
class SG_DLLEXPORT PolicyParameters
|
||||
{
|
||||
public:
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/** \brief This class represents a sigle parameter of type \c T
|
||||
|
||||
This class is useful only to store informations about each parameter. No checks
|
||||
on the values entered are done.
|
||||
*/
|
||||
template<typename T>
|
||||
class Parameter;
|
||||
class SG_DLLEXPORT Parameter
|
||||
{
|
||||
public:
|
||||
|
||||
/** \brief Constructs the parameter
|
||||
\param name The name of the parameter. This string will be used to refer to this parameter, thus it MUST
|
||||
be uniqe (one string identifies \b only ONE parameter)
|
||||
\param value The initial value of this parameter
|
||||
\param lower_bound The lower limitation of the value which can be set with set_int(...).
|
||||
\param upper_bound The upper limitation of the value which can be set with set_int(...).
|
||||
\param required Denotes if this parameter is required by the policy.
|
||||
\param default_value The initial value of this parameter. (If not specified it's set to 0).
|
||||
*/
|
||||
Parameter(Glib::ustring name, const T& value,
|
||||
const T& lower_bound, const T& upper_bound,
|
||||
const bool& required, const T& default_value = 0);
|
||||
|
||||
/** \returns The name of the parameter (its UNIQUE key)
|
||||
*/
|
||||
Glib::ustring get_name() const;
|
||||
|
||||
/** \returns The lower bound
|
||||
*/
|
||||
T get_lower_bound() const;
|
||||
|
||||
/** \returns The upper bound
|
||||
*/
|
||||
T get_upper_bound() const;
|
||||
|
||||
/** \returns TRUE if this parameter is required
|
||||
*/
|
||||
bool is_required() const;
|
||||
|
||||
/** \returns Its default value
|
||||
*/
|
||||
T get_default() const;
|
||||
|
||||
/** \returns Its actual value
|
||||
*/
|
||||
T get_value() const;
|
||||
|
||||
/** \brief Changes the value of the parameter.
|
||||
\warning NO CHECK is done whether the value repects its bounds!!
|
||||
*/
|
||||
void set_value(const T&);
|
||||
|
||||
private:
|
||||
Glib::ustring _name;
|
||||
T _value;
|
||||
T _lower_bound;
|
||||
T _upper_bound;
|
||||
bool _is_required;
|
||||
T _default;
|
||||
};
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
//#######################################
|
||||
//########## methods to CREATE PARAMETERS
|
||||
|
@ -185,69 +251,6 @@ namespace sgpem
|
|||
std::map<Glib::ustring, Parameter<Glib::ustring> > string_map;
|
||||
};
|
||||
|
||||
|
||||
/** \brief This class represents a sigle parameter of type \c T
|
||||
|
||||
This class is useful only to store informations about each parameter. No checks
|
||||
on the values entered are done.
|
||||
*/
|
||||
template<typename T>
|
||||
class PolicyParameters::Parameter
|
||||
{
|
||||
public:
|
||||
|
||||
/** \brief Constructs the parameter
|
||||
\param name The name of the parameter. This string will be used to refer to this parameter, thus it MUST
|
||||
be uniqe (one string identifies \b only ONE parameter)
|
||||
\param value The initial value of this parameter
|
||||
\param lower_bound The lower limitation of the value which can be set with set_int(...).
|
||||
\param upper_bound The upper limitation of the value which can be set with set_int(...).
|
||||
\param required Denotes if this parameter is required by the policy.
|
||||
\param default_value The initial value of this parameter. (If not specified it's set to 0).
|
||||
*/
|
||||
Parameter(Glib::ustring name, const T& value, const T& lower_bound, const T& upper_bound, const bool& required, const T& default_value = 0);
|
||||
|
||||
/** \returns The name of the parameter (its UNIQUE key)
|
||||
*/
|
||||
Glib::ustring get_name() const;
|
||||
|
||||
/** \returns The lower bound
|
||||
*/
|
||||
T get_lower_bound() const;
|
||||
|
||||
/** \returns The upper bound
|
||||
*/
|
||||
T get_upper_bound() const;
|
||||
|
||||
/** \returns TRUE if this parameter is required
|
||||
*/
|
||||
bool is_required() const;
|
||||
|
||||
/** \returns Its default value
|
||||
*/
|
||||
T get_default() const;
|
||||
|
||||
/** \returns Its actual value
|
||||
*/
|
||||
T get_value() const;
|
||||
|
||||
/** \brief Changes the value of the parameter.
|
||||
\warning NO CHECK is done whether the value repects its bounds!!
|
||||
*/
|
||||
void set_value(const T&);
|
||||
|
||||
private:
|
||||
Glib::ustring _name;
|
||||
T _value;
|
||||
T _lower_bound;
|
||||
T _upper_bound;
|
||||
bool _is_required;
|
||||
T _default;
|
||||
};
|
||||
|
||||
|
||||
}//~ namespace sgpem
|
||||
|
||||
#include "../templates/parameter.tcc"
|
||||
|
||||
#endif
|
|
@ -25,7 +25,7 @@
|
|||
#include "glibmm/ustring.h"
|
||||
#include <vector>
|
||||
|
||||
#include "schedulable.hh"
|
||||
#include <sgpemv2/schedulable.hh>
|
||||
|
||||
namespace sgpem
|
||||
{
|
|
@ -34,7 +34,7 @@ namespace sgpem
|
|||
#include <map>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "singleton.hh"
|
||||
#include <sgpemv2/templates/singleton.hh>
|
||||
|
||||
namespace sgpem
|
||||
{
|
|
@ -26,10 +26,10 @@
|
|||
|
||||
#include "glibmm/ustring.h"
|
||||
|
||||
#include "policy_parameters.hh"
|
||||
#include "user_interrupt_exception.hh"
|
||||
#include "environment.hh"
|
||||
#include "sub_request.hh"
|
||||
#include <sgpemv2/policy_parameters.hh>
|
||||
#include <sgpemv2/user_interrupt_exception.hh>
|
||||
#include <sgpemv2/environment.hh>
|
||||
#include <sgpemv2/sub_request.hh>
|
||||
|
||||
namespace sgpem
|
||||
{
|
|
@ -26,10 +26,10 @@
|
|||
|
||||
#include "glibmm/ustring.h"
|
||||
|
||||
#include "resource_policy.hh"
|
||||
#include <sgpemv2/resource_policy.hh>
|
||||
|
||||
#include "policy_parameters.hh"
|
||||
#include "user_interrupt_exception.hh"
|
||||
#include <sgpemv2/policy_parameters.hh>
|
||||
#include <sgpemv2/user_interrupt_exception.hh>
|
||||
|
||||
namespace sgpem
|
||||
{
|
|
@ -28,15 +28,15 @@ namespace sgpem
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "history.hh"
|
||||
#include "cpu_policy.hh"
|
||||
#include "resource_policy.hh"
|
||||
#include "ready_queue.hh"
|
||||
#include "user_interrupt_exception.hh"
|
||||
#include "malformed_policy_exception.hh"
|
||||
#include <sgpemv2/history.hh>
|
||||
#include <sgpemv2/cpu_policy.hh>
|
||||
#include <sgpemv2/resource_policy.hh>
|
||||
#include <sgpemv2/ready_queue.hh>
|
||||
#include <sgpemv2/user_interrupt_exception.hh>
|
||||
#include <sgpemv2/malformed_policy_exception.hh>
|
||||
|
||||
// Do not include full template definition here
|
||||
#include "singleton.hh"
|
||||
#include <sgpemv2/templates/singleton.hh>
|
||||
|
||||
#include <glibmm/thread.h>
|
||||
|
|
@ -34,7 +34,7 @@ namespace sgpem
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "serializer_error.hh"
|
||||
#include <sgpemv2/serializer_error.hh>
|
||||
|
||||
#include <glibmm/ustring.h>
|
||||
|
|
@ -22,8 +22,8 @@
|
|||
#define SERIALIZER_HH 1
|
||||
|
||||
#include "config.h"
|
||||
#include "history.hh"
|
||||
#include "serializer_error.hh"
|
||||
#include <sgpemv2/history.hh>
|
||||
#include <sgpemv2/serializer_error.hh>
|
||||
|
||||
#include <glibmm/ustring.h>
|
||||
|
|
@ -30,7 +30,7 @@ namespace sgpem
|
|||
|
||||
#include <vector>
|
||||
|
||||
#include "singleton.hh"
|
||||
#include <sgpemv2/templates/singleton.hh>
|
||||
|
||||
namespace sgpem
|
||||
{
|
|
@ -30,12 +30,12 @@ namespace sgpem
|
|||
}
|
||||
|
||||
#include "config.h"
|
||||
#include "history.hh"
|
||||
#include "singleton.hh"
|
||||
#include "cpu_policy_exception.hh"
|
||||
#include "user_interrupt_exception.hh"
|
||||
#include "null_policy_exception.hh"
|
||||
#include "malformed_policy_exception.hh"
|
||||
#include <sgpemv2/history.hh>
|
||||
#include <sgpemv2/templates/singleton.hh>
|
||||
#include <sgpemv2/cpu_policy_exception.hh>
|
||||
#include <sgpemv2/user_interrupt_exception.hh>
|
||||
#include <sgpemv2/null_policy_exception.hh>
|
||||
#include <sgpemv2/malformed_policy_exception.hh>
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
#include <vector>
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "request.hh"
|
||||
#include <sgpemv2/request.hh>
|
||||
|
||||
namespace sgpem
|
||||
{
|
39
src/backend/sgpemv2/templates/deletor.tcc
Normal file
39
src/backend/sgpemv2/templates/deletor.tcc
Normal file
|
@ -0,0 +1,39 @@
|
|||
// src/templates/deletor.tcc - 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 DELETOR_TCC
|
||||
#define DELETOR_TCC 1
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace memory
|
||||
{
|
||||
|
||||
template<typename T>
|
||||
struct deletor : public std::unary_function<void, T*>
|
||||
{
|
||||
inline void operator()(T* o) { delete o; }
|
||||
};
|
||||
|
||||
} //~ namespace memory
|
||||
|
||||
#endif
|
||||
|
88
src/backend/sgpemv2/templates/parameter.tcc
Normal file
88
src/backend/sgpemv2/templates/parameter.tcc
Normal file
|
@ -0,0 +1,88 @@
|
|||
// src/templates/parameter.tcc - 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 PARAMETER_TCC
|
||||
#define PARAMETER_TCC 1
|
||||
|
||||
#include <sgpemv2/policy_parameters.hh>
|
||||
|
||||
using namespace sgpem;
|
||||
|
||||
|
||||
template<typename T>
|
||||
PolicyParameters::Parameter<T>::Parameter(Glib::ustring name, const T& value,
|
||||
const T& lower_bound, const T& upper_bound,
|
||||
const bool& required, const T& default_value)
|
||||
: _name(name), _value(value), _lower_bound(lower_bound),
|
||||
_upper_bound(upper_bound), _is_required(required), _default(default_value)
|
||||
{}
|
||||
|
||||
template<typename T>
|
||||
Glib::ustring
|
||||
PolicyParameters::Parameter<T>::get_name() const
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T
|
||||
PolicyParameters::Parameter<T>::get_lower_bound() const
|
||||
{
|
||||
return _lower_bound;
|
||||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
T
|
||||
PolicyParameters::Parameter<T>::get_upper_bound() const
|
||||
{
|
||||
return _upper_bound;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool
|
||||
PolicyParameters::Parameter<T>::is_required() const
|
||||
{
|
||||
return _is_required;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T
|
||||
PolicyParameters::Parameter<T>::get_default() const
|
||||
{
|
||||
return _default;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T
|
||||
PolicyParameters::Parameter<T>::get_value() const
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
PolicyParameters::Parameter<T>::set_value(const T& val)
|
||||
{
|
||||
_value = val;
|
||||
}
|
||||
|
||||
#endif //~ PARAMETER_TCC
|
111
src/backend/sgpemv2/templates/sequences.tcc
Normal file
111
src/backend/sgpemv2/templates/sequences.tcc
Normal file
|
@ -0,0 +1,111 @@
|
|||
// src/templates/sequences.tcc - 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
|
||||
|
||||
|
||||
/* Helper templates to make easier to work on an entire sequence over a container */
|
||||
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
|
||||
// Class defining an input sequence
|
||||
|
||||
template<typename In>
|
||||
class Iseq : protected std::pair<In, In>
|
||||
{
|
||||
public:
|
||||
typedef typename In::pointer pointer;
|
||||
typedef typename In::reference reference;
|
||||
|
||||
explicit Iseq(In a, In b)
|
||||
: std::pair<In, In>(a, b)
|
||||
{}
|
||||
|
||||
operator bool()
|
||||
{ return Iseq::first != Iseq::second; }
|
||||
|
||||
Iseq& operator++()
|
||||
{ ++Iseq::first; return *this; }
|
||||
|
||||
Iseq operator++(int)
|
||||
{ Iseq t = *this; ++Iseq::first; return t; }
|
||||
|
||||
const reference operator*() const
|
||||
{ return *Iseq::first; }
|
||||
|
||||
const In& operator->() const
|
||||
{ return Iseq::first; }
|
||||
|
||||
bool operator==(const Iseq& i) const
|
||||
{ return Iseq::first == i.first; }
|
||||
|
||||
bool operator!=(const Iseq& i) const
|
||||
{ return Iseq::first != i.first; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Adaptor functions for containers:
|
||||
|
||||
template<class Container>
|
||||
Iseq<typename Container::const_iterator>
|
||||
iseq(const Container& c)
|
||||
{
|
||||
return Iseq<typename Container::const_iterator>(c.begin(), c.end());
|
||||
}
|
||||
|
||||
|
||||
template<class Container>
|
||||
Iseq<typename Container::iterator>
|
||||
iseq(Container& c)
|
||||
{
|
||||
return Iseq<typename Container::iterator>(c.begin(), c.end());
|
||||
}
|
||||
|
||||
|
||||
// Adaptor functions for containers that support reverse iteration
|
||||
|
||||
template<class Container>
|
||||
Iseq<typename Container::const_reverse_iterator>
|
||||
riseq(const Container& c)
|
||||
{
|
||||
return Iseq<typename Container::const_reverse_iterator>(c.rbegin(), c.rend());
|
||||
}
|
||||
|
||||
|
||||
template<class Container>
|
||||
Iseq<typename Container::reverse_iterator>
|
||||
riseq(Container& c)
|
||||
{
|
||||
return Iseq<typename Container::reverse_iterator>(c.rbegin(), c.rend());
|
||||
}
|
||||
|
||||
|
||||
template<class Container, class Functor>
|
||||
Functor
|
||||
for_each_in(const Container& c, Functor functor)
|
||||
{
|
||||
Iseq<typename Container::const_iterator> seq = iseq(c);
|
||||
while(seq)
|
||||
{
|
||||
functor(*seq);
|
||||
++seq;
|
||||
}
|
||||
return functor;
|
||||
}
|
59
src/backend/sgpemv2/templates/singleton.hh
Normal file
59
src/backend/sgpemv2/templates/singleton.hh
Normal file
|
@ -0,0 +1,59 @@
|
|||
// singleton.hh - Copyright 2005, 2006, University
|
||||
// of Padova, dept. of Pure and Applied
|
||||
// Mathematics
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// This program 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 this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#ifndef SINGLETON_HH
|
||||
#define SINGLETON_HH 1
|
||||
|
||||
#include <glibmm/thread.h>
|
||||
#include "config.h"
|
||||
|
||||
namespace sgpem
|
||||
{
|
||||
|
||||
/** \brief An abstract implementation of the Singleton design pattern.
|
||||
*
|
||||
* Singleton implementers constuctor will have to declare friendliness
|
||||
* to Singleton::get_instance(). This also attempts to achieve
|
||||
* thread-safeness.
|
||||
*/
|
||||
template<typename Instantiated_class>
|
||||
class SG_DLLEXPORT Singleton
|
||||
{
|
||||
public:
|
||||
|
||||
/** \brief Ensures thread safety is respected, and returns the instantiated object
|
||||
*
|
||||
* This is done by locking _instance via a mutex, before intantiating the
|
||||
* Instantiated_class attribute (if not done before).
|
||||
*
|
||||
* \return The instantiated object
|
||||
*/
|
||||
static Instantiated_class& get_instance();
|
||||
|
||||
protected:
|
||||
static Glib::RecMutex SG_DLLLOCAL _mutex;
|
||||
|
||||
private:
|
||||
static SG_DLLLOCAL Instantiated_class* _instance;
|
||||
}
|
||||
; //~ class Singleton
|
||||
|
||||
} //~ namespace sgpem
|
||||
|
||||
#endif //~ SINGLETON_HH
|
||||
|
45
src/backend/sgpemv2/templates/singleton.tcc
Normal file
45
src/backend/sgpemv2/templates/singleton.tcc
Normal file
|
@ -0,0 +1,45 @@
|
|||
// singleton.tcc - Copyright 2005, 2006, University
|
||||
// of Padova, dept. of Pure and Applied
|
||||
// Mathematics
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// This program 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 this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#ifndef SINGLETON_TCC
|
||||
#define SINGLETON_TCC 1
|
||||
|
||||
#include <sgpemv2/templates/singleton.hh>
|
||||
|
||||
template<typename Instantiated_class>
|
||||
Instantiated_class*
|
||||
sgpem::Singleton<Instantiated_class>::_instance = NULL;
|
||||
|
||||
template<typename Instantiated_class>
|
||||
Glib::RecMutex
|
||||
sgpem::Singleton<Instantiated_class>::_mutex;
|
||||
|
||||
|
||||
template<typename Instantiated_class>
|
||||
Instantiated_class&
|
||||
sgpem::Singleton<Instantiated_class>::get_instance()
|
||||
{
|
||||
Glib::RecMutex::Lock lock (_mutex);
|
||||
if (_instance == NULL)
|
||||
_instance = new Instantiated_class();
|
||||
return *_instance;
|
||||
}
|
||||
|
||||
|
||||
#endif //~ SINGLETON_TCC
|
||||
|
168
src/backend/sgpemv2/templates/smartp.hh
Normal file
168
src/backend/sgpemv2/templates/smartp.hh
Normal file
|
@ -0,0 +1,168 @@
|
|||
// smartp.hh - Copyright 2005, Matteo Settenvini
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// This program 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 this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#ifndef SMARTP_HH
|
||||
#define SMARTP_HH 1
|
||||
|
||||
#include <new>
|
||||
#include <typeinfo>
|
||||
|
||||
namespace memory
|
||||
{
|
||||
|
||||
/** \brief A simple reference counted smart pointer
|
||||
*
|
||||
* \author Matteo Settenvini
|
||||
*
|
||||
* \version \c 1.1, March 7th, 2006 - Add support for dynamic casting
|
||||
* \version \c 1.0, October 10th, 2006 - Initial stable release
|
||||
*
|
||||
* This template is a smart pointer which uses
|
||||
* a simple mechanism of reference count to
|
||||
* keep track of when and if a stored object
|
||||
* should be destroyed.
|
||||
*
|
||||
* \param T The type of the object to store
|
||||
* \param isArray a boolean value telling if we're
|
||||
* storing an array or a single object (the default)
|
||||
*
|
||||
* \warning This class hasn't virtual methods
|
||||
* to ensure greater speed. Don't inherit
|
||||
* from it: its destructor isn't virtual, either.
|
||||
*/
|
||||
template<typename T, bool isArray = false>
|
||||
class smart_ptr
|
||||
{
|
||||
|
||||
template<typename T2, bool isArray2>
|
||||
friend class smart_ptr;
|
||||
|
||||
public:
|
||||
|
||||
/** \brief An alias for the smart_ptr which contains null
|
||||
*
|
||||
* When you've to compare some smart pointer with another
|
||||
* to see if it points to nowhere, you can use this
|
||||
* const object.
|
||||
* */
|
||||
static const smart_ptr<T, isArray> null;
|
||||
|
||||
/** \brief Constructor, defaults to null pointer.
|
||||
*
|
||||
* Call this constructor only the first time. Whenever
|
||||
* you'll need to keep other references to the same pointer,
|
||||
* use the cctor, or we won't be able to keep updated the
|
||||
* reference count. This class requires some effort from
|
||||
* the user to abid to some rules. It's meant to be
|
||||
* an help, not a painkiller.
|
||||
*
|
||||
* A good usage of this ctor is:
|
||||
* \code
|
||||
* class C;
|
||||
* smart_ptr<C> c_ptr(new C());
|
||||
* \endcode
|
||||
* So you don't keep a potentially dangerous reference
|
||||
* around. */
|
||||
smart_ptr(T* ptr = 0) throw(std::bad_alloc);
|
||||
|
||||
/** \brief Copy constructor.
|
||||
*
|
||||
* Always use this to obtain another reference
|
||||
* to a stored pointer. */
|
||||
smart_ptr(const smart_ptr& sptr) throw();
|
||||
~smart_ptr() throw();
|
||||
|
||||
smart_ptr& operator=(const smart_ptr& sptr) throw();
|
||||
|
||||
bool operator==(const smart_ptr& sptr) const throw();
|
||||
bool operator!=(const smart_ptr& sptr) const throw();
|
||||
|
||||
/** \brief Access to stored object's members
|
||||
*
|
||||
* Use this operator to access object
|
||||
* methods and data. */
|
||||
T* operator->() throw();
|
||||
|
||||
/** \brief Access to stored object's members
|
||||
*
|
||||
* Const version of the above operator. */
|
||||
const T* operator->() const throw();
|
||||
|
||||
/** \brief Access to stored object
|
||||
*
|
||||
* \warning Use with care */
|
||||
T& operator*() throw();
|
||||
|
||||
/** \brief Access to stored object
|
||||
*
|
||||
* \warning Use with care */
|
||||
const T& operator*() const throw();
|
||||
|
||||
/** \brief Convenience operator for use in predicates
|
||||
*
|
||||
* \return true if the stored pointer is valid,
|
||||
* false otherwise. */
|
||||
operator bool() const throw();
|
||||
|
||||
/** \brief Returns the number of alive references to
|
||||
* the stored object
|
||||
*
|
||||
* \return The number of references */
|
||||
unsigned int alive_refs() const throw();
|
||||
|
||||
/** \brief Dynamic cast the stored pointer
|
||||
* to another type, returning a smart_ptr
|
||||
*
|
||||
* This functions tries to cast the stored
|
||||
* object to the given type.
|
||||
*
|
||||
* \param U The type to cast the stored pointer to
|
||||
* \return A smart_ptr of the wanted type
|
||||
* \exception bad_alloc Raise this exception if
|
||||
* the cast isn't successful or doable
|
||||
*/
|
||||
template<typename U>
|
||||
smart_ptr<U, isArray> cast_to() throw(std::bad_cast);
|
||||
|
||||
/** \brief Dynamic cast the stored pointer
|
||||
* to another type, returning a smart_ptr
|
||||
*
|
||||
* This functions tries to cast the stored
|
||||
* object to the given type.
|
||||
*
|
||||
* \param U The type to cast the stored pointer to
|
||||
* \return A smart_ptr of the wanted type
|
||||
* \exception bad_alloc Raise this exception if
|
||||
* the cast isn't successful or doable
|
||||
*/
|
||||
template<typename U>
|
||||
const smart_ptr<U, isArray> cast_to() const throw(std::bad_cast);
|
||||
|
||||
private:
|
||||
template<typename U>
|
||||
smart_ptr(const smart_ptr<U, isArray>& sptr) throw(std::bad_cast);
|
||||
|
||||
struct contents_type
|
||||
{
|
||||
T* ptr;
|
||||
unsigned int rc;
|
||||
}
|
||||
* _contents;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
178
src/backend/sgpemv2/templates/smartp.tcc
Normal file
178
src/backend/sgpemv2/templates/smartp.tcc
Normal file
|
@ -0,0 +1,178 @@
|
|||
// smartp.tcc - Copyright 2005, Matteo Settenvini
|
||||
//
|
||||
// This program 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.
|
||||
//
|
||||
// This program 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 this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#ifndef SMARTP_TCC
|
||||
#define SMARTP_TCC 1
|
||||
|
||||
#include <sgpemv2/templates/smartp.hh>
|
||||
|
||||
namespace memory
|
||||
{
|
||||
|
||||
template<typename T, bool isArray>
|
||||
const smart_ptr<T, isArray> smart_ptr<T, isArray>::null = 0;
|
||||
|
||||
// ------------------------------
|
||||
|
||||
template<typename T, bool isArray>
|
||||
smart_ptr<T, isArray>::smart_ptr( T* ptr ) throw(std::bad_alloc)
|
||||
: _contents(new contents_type())
|
||||
{
|
||||
_contents->rc = 1;
|
||||
_contents->ptr = ptr;
|
||||
}
|
||||
|
||||
|
||||
template<typename T, bool isArray>
|
||||
smart_ptr<T, isArray>::smart_ptr(const smart_ptr& sptr) throw()
|
||||
: _contents(sptr._contents)
|
||||
{
|
||||
(_contents->rc)++;
|
||||
}
|
||||
|
||||
|
||||
template<typename T, bool isArray>
|
||||
smart_ptr<T, isArray>::~smart_ptr() throw()
|
||||
{
|
||||
if (--(_contents->rc) == 0)
|
||||
{
|
||||
if (_contents->ptr != 0)
|
||||
!isArray ? delete _contents->ptr : delete [] _contents->ptr;
|
||||
delete _contents;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------
|
||||
|
||||
template<typename T, bool isArray>
|
||||
smart_ptr<T, isArray>&
|
||||
smart_ptr<T, isArray>::operator=(const smart_ptr& sptr) throw()
|
||||
{
|
||||
if (this != &sptr && _contents != sptr._contents)
|
||||
{
|
||||
if (--(_contents->rc) == 0)
|
||||
{
|
||||
if (_contents->ptr != 0)
|
||||
!isArray ? delete _contents->ptr : delete [] _contents->ptr;
|
||||
delete _contents;
|
||||
}
|
||||
|
||||
_contents = sptr._contents;
|
||||
(_contents->rc)++;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template<typename T, bool isArray>
|
||||
bool
|
||||
smart_ptr<T, isArray>::operator==( const smart_ptr& sptr ) const throw()
|
||||
{
|
||||
return _contents->ptr == sptr._contents->ptr;
|
||||
}
|
||||
|
||||
|
||||
template<typename T, bool isArray>
|
||||
bool
|
||||
smart_ptr<T, isArray>::operator!=( const smart_ptr& sptr ) const throw()
|
||||
{
|
||||
return _contents->ptr != sptr._contents->ptr;
|
||||
}
|
||||
|
||||
|
||||
template<typename T, bool isArray>
|
||||
T&
|
||||
smart_ptr<T, isArray>::operator*() throw()
|
||||
{
|
||||
return *(_contents->ptr);
|
||||
}
|
||||
|
||||
|
||||
template<typename T, bool isArray>
|
||||
T*
|
||||
smart_ptr<T, isArray>::operator->() throw()
|
||||
{
|
||||
return _contents->ptr;
|
||||
}
|
||||
|
||||
|
||||
template<typename T, bool isArray>
|
||||
const T&
|
||||
smart_ptr<T, isArray>::operator*() const throw()
|
||||
{
|
||||
return *(_contents->ptr);
|
||||
}
|
||||
|
||||
|
||||
template<typename T, bool isArray>
|
||||
const T*
|
||||
smart_ptr<T, isArray>::operator->() const throw()
|
||||
{
|
||||
return _contents->ptr;
|
||||
}
|
||||
|
||||
|
||||
template<typename T, bool isArray>
|
||||
smart_ptr<T, isArray>::operator bool() const throw()
|
||||
{
|
||||
return _contents->ptr != 0;
|
||||
}
|
||||
|
||||
// ------------------------------
|
||||
|
||||
template<typename T, bool isArray>
|
||||
unsigned int
|
||||
smart_ptr<T, isArray>::alive_refs() const throw()
|
||||
{
|
||||
return _contents->ptr != 0 ? _contents->rc : 0;
|
||||
}
|
||||
|
||||
|
||||
template<typename T, bool isArray>
|
||||
template<typename U>
|
||||
smart_ptr<U, isArray>
|
||||
smart_ptr<T, isArray>::cast_to() throw(std::bad_cast)
|
||||
{
|
||||
return smart_ptr<U, isArray>(*this);
|
||||
}
|
||||
|
||||
|
||||
template<typename T, bool isArray>
|
||||
template<typename U>
|
||||
const smart_ptr<U, isArray>
|
||||
smart_ptr<T, isArray>::cast_to() const throw(std::bad_cast)
|
||||
{
|
||||
return smart_ptr<U, isArray>(*this);
|
||||
}
|
||||
|
||||
|
||||
template<typename T, bool isArray>
|
||||
template<typename U>
|
||||
smart_ptr<T, isArray>::smart_ptr(const smart_ptr<U, isArray>& sptr)
|
||||
throw(std::bad_cast)
|
||||
{
|
||||
if (!sptr._contents->ptr || dynamic_cast<T*>(sptr._contents->ptr) == 0)
|
||||
throw std::bad_cast();
|
||||
|
||||
// I know, I know... this is Evil(TM):
|
||||
_contents = reinterpret_cast<typename smart_ptr<T, isArray>::contents_type* > (sptr._contents);
|
||||
(_contents->rc)++;
|
||||
}
|
||||
|
||||
} //~ namespace memory
|
||||
|
||||
#endif
|
|
@ -24,7 +24,7 @@
|
|||
#include "config.h"
|
||||
#include <vector>
|
||||
|
||||
#include "schedulable.hh"
|
||||
#include <sgpemv2/schedulable.hh>
|
||||
|
||||
namespace sgpem
|
||||
{
|
|
@ -26,7 +26,7 @@
|
|||
#define USER_INTERRUPT_EXCEPTION 1
|
||||
|
||||
#include "config.h"
|
||||
#include "cpu_policy_exception.hh"
|
||||
#include <sgpemv2/cpu_policy_exception.hh>
|
||||
|
||||
#include <stdexcept>
|
||||
|
|
@ -20,15 +20,15 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "simulation.hh"
|
||||
#include "simulation_observer.hh"
|
||||
#include <sgpemv2/simulation.hh>
|
||||
#include <sgpemv2/simulation_observer.hh>
|
||||
#include "concrete_simulation.hh"
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
||||
// Do not include in header file:
|
||||
#include "singleton.tcc"
|
||||
#include <sgpemv2/templates/singleton.tcc>
|
||||
|
||||
using namespace sgpem;
|
||||
|
||||
|
|
|
@ -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 "simulation_observer.hh"
|
||||
#include <sgpemv2/simulation_observer.hh>
|
||||
|
||||
sgpem::SimulationObserver::~SimulationObserver() {}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "sub_request.hh"
|
||||
#include <sgpemv2/sub_request.hh>
|
||||
|
||||
namespace sgpem
|
||||
{
|
||||
|
|
|
@ -18,8 +18,10 @@
|
|||
// along with SGPEMv2; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "string_utils.hh"
|
||||
#include "gettext.h"
|
||||
|
||||
#include <sgpemv2/string_utils.hh>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using namespace std;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue