From 1395347b1ab6dbf74131ec3ede0dc5c478cb2a8f Mon Sep 17 00:00:00 2001 From: tchernobog Date: Fri, 24 Feb 2006 09:02:32 +0000 Subject: [PATCH] - Fix Schedulable::get_name() in SWIG export interface git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@431 3ecf2c5c-341e-0410-92b4-d18e462d057c --- src/backend/pyloader/Policy.py | 16 ++++++++++++++-- src/backend/pyloader/sgpem.i | 5 +++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/backend/pyloader/Policy.py b/src/backend/pyloader/Policy.py index e30cffc..b041828 100644 --- a/src/backend/pyloader/Policy.py +++ b/src/backend/pyloader/Policy.py @@ -1,4 +1,5 @@ -from Abstract import * +from Abstract import * +import sgpem ## @brief This is the abstract class a user-defined policy # should inherit from @@ -95,6 +96,15 @@ class Policy: # @return -1 If the policy doesn't want to use time slices # @return 0+ To specify a time slice duration for this policy get_time_slice = AbstractMethod('get_time_slice') + + + ## @brief Returns the PolicyParameters instance you can use in + # Policy::Policy::configure() + # + # @return A sgpem::PolicyParameters instance + def get_parameters(self): + return sgpem.Scheduler.get_instance().get_policy().get_parameters() + ## @brief This function implements an in-place stable sort # using directly SchedulableQueue methods @@ -127,6 +137,7 @@ class Policy: def sort(self, queue, cmpf): self.__recursive_qsort(queue, 0, queue.size()-1, cmpf) + ## @brief Recursive (private) call to perform quicksort on a # queue # @@ -139,7 +150,8 @@ class Policy: if(b>a): pivot = self.__partition(queue, a, b, cmpf) self.__recursive_qsort(queue, a, pivot-1, cmpf) - self.__recursive_qsort(queue, pivot+1, b, cmpf) + self.__recursive_qsort(queue, pivot+1, b, cmpf) + ## @brief Recursive (private) call to partition a slice of the queue # diff --git a/src/backend/pyloader/sgpem.i b/src/backend/pyloader/sgpem.i index fada4f8..3e22329 100644 --- a/src/backend/pyloader/sgpem.i +++ b/src/backend/pyloader/sgpem.i @@ -136,10 +136,10 @@ namespace sgpem { int get_priority() const; unsigned int get_total_cpu_time() const; - %ignore get_name() const; + %ignore Schedulable::get_name() const; %extend { const char* get_name() const - { return self->get_name().c_str(); } + { return self->get_name().c_str(); } } }; //~ class Schedulable @@ -185,6 +185,7 @@ namespace sgpem { // --------------------------------------------- class Scheduler { public: + sgpem::Policy* get_policy(); static sgpem::Scheduler& get_instance(); sgpem::SchedulableList* get_ready_queue(); private: