diff --git a/src/backend/pyloader/Policy.py b/src/backend/pyloader/Policy.py index 8f2a2ac..bb7aa34 100644 --- a/src/backend/pyloader/Policy.py +++ b/src/backend/pyloader/Policy.py @@ -1,5 +1,22 @@ from Abstract import * +## @brief this function implements a quicksort in place +# using the SchedulableQueue methods +# +# The compare parameter should be a user defined function +# name returning either True or False, defined like: +# @code +# def compare(SchedulableA,SchedulableB): +# return SchedulableA.someProperty() < SchedulableB.someProperty() +# @endcode +# +# @param queue The SchedulableQueue to be sorted in place +# @param cmp The binary function to use to compare elements +# @returns None +def sort(queue, cmp): + pass + + class Policy: ## @var Avoid instantiation of an abstract class __metaclass__ = Metaclass diff --git a/src/backend/schedulable_list.hh b/src/backend/schedulable_list.hh index 6b3658d..d56fc1e 100644 --- a/src/backend/schedulable_list.hh +++ b/src/backend/schedulable_list.hh @@ -50,6 +50,22 @@ namespace sgpem SchedulableStatus* get_item_at(const uint&); const SchedulableStatus* get_item_at(const uint&) const; void clear(); + + /** \brief This method swaps the element at positionA with + * the one at positionB. + * + * At the present moment, this function shouldn't throw any + * exception, but just do nothing when the parameters don't + * make sense (e.g. positionB > this.size()). + * However, it should work the same either if positionA is greater + * than or less than positionB. + * In the future, this method could throw an OutOfRange exception. + * + * \param positionA The position of the first element to swap + * \param positionB The position of the second element to swap + */ + void swap(unsigned int positionA, unsigned int positionB) throw() {} + private: std::list _list; }; diff --git a/src/backend/sgpem.i b/src/backend/sgpem.i index 4f49015..246cee2 100644 --- a/src/backend/sgpem.i +++ b/src/backend/sgpem.i @@ -132,6 +132,7 @@ namespace sgpem { uint size() const; SchedulableStatus* get_item_at(const uint&); const SchedulableStatus* get_item_at(const uint&) const; + void swap(unsigned int positionA, unsigned int positionB) throw(); private: // Avoid instantiation and copy