From 696c513ed2220fe4099ea2365f904d67f71ca800 Mon Sep 17 00:00:00 2001 From: elvez Date: Fri, 25 Aug 2006 22:43:04 +0000 Subject: [PATCH] - TODO and FIXME reduced to 38 git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@941 3ecf2c5c-341e-0410-92b4-d18e462d057c --- plugins/pyloader/src/python_cpu_policy.cc | 4 ++-- .../src/testsuite/python_loader_configure.py | 5 ----- .../testsuite/python_loader_get_time_slice.py | 5 ----- .../testsuite/python_loader_is_preemptive.py | 5 ----- .../src/testsuite/python_loader_sort_queue.py | 7 ------- .../src/testsuite/test-python_loader.cc | 6 +----- plugins/xmlsave/src/xml_serializer_factory.cc | 16 ++++------------ plugins/xmlsave/src/xml_visitor.cc | 4 ---- src/backend/cpu_policy_manager.cc | 16 ---------------- src/backend/cpu_policy_manager.hh | 19 ------------------- src/backend/dynamic_process.cc | 3 --- src/backend/resource_policies_gatekeeper.cc | 16 ++++++---------- src/text_simulation.cc | 13 ------------- 13 files changed, 13 insertions(+), 106 deletions(-) diff --git a/plugins/pyloader/src/python_cpu_policy.cc b/plugins/pyloader/src/python_cpu_policy.cc index e91574c..2608920 100644 --- a/plugins/pyloader/src/python_cpu_policy.cc +++ b/plugins/pyloader/src/python_cpu_policy.cc @@ -103,7 +103,7 @@ PythonCPUPolicy::activate() throw(UserInterruptException, MalformedPolicyExcepti Glib::RecMutex::Lock lock(_mtx);; set_callback_policy(const_cast(this)); - // FIXME write the rest, taking away code from constructor + // TODO write the rest, taking away code from constructor configure(); @@ -117,7 +117,7 @@ PythonCPUPolicy::deactivate() Glib::RecMutex::Lock lock(_mtx);; set_callback_policy(const_cast(this)); - // FIXME See if some code has to be moved here from the + // TODO See if some code has to be moved here from the // destructor, AFTER having written activate() _parameters.clear(); diff --git a/plugins/pyloader/src/testsuite/python_loader_configure.py b/plugins/pyloader/src/testsuite/python_loader_configure.py index 68cf333..fd87ddf 100644 --- a/plugins/pyloader/src/testsuite/python_loader_configure.py +++ b/plugins/pyloader/src/testsuite/python_loader_configure.py @@ -16,10 +16,5 @@ class python_loader_configure(CPUPolicy) : def get_time_slice(self): return -1 - # FIXME incorrect, but must be implemented to allow - # loading from the policy manager - def wants(self): - return 0 - def sort_queue(self, queue): pass diff --git a/plugins/pyloader/src/testsuite/python_loader_get_time_slice.py b/plugins/pyloader/src/testsuite/python_loader_get_time_slice.py index 3ac306a..2349720 100644 --- a/plugins/pyloader/src/testsuite/python_loader_get_time_slice.py +++ b/plugins/pyloader/src/testsuite/python_loader_get_time_slice.py @@ -17,10 +17,5 @@ class python_loader_get_time_slice(CPUPolicy) : pass return -1 - # FIXME incorrect, but must be implemented to allow - # loading from the policy manager - def wants(self): - return 0 - def sort_queue(self, queue): pass diff --git a/plugins/pyloader/src/testsuite/python_loader_is_preemptive.py b/plugins/pyloader/src/testsuite/python_loader_is_preemptive.py index 6452d44..d0fe3bf 100644 --- a/plugins/pyloader/src/testsuite/python_loader_is_preemptive.py +++ b/plugins/pyloader/src/testsuite/python_loader_is_preemptive.py @@ -17,10 +17,5 @@ class python_loader_is_preemptive(CPUPolicy) : def get_time_slice(self): return -1 - # FIXME incorrect, but must be implemented to allow - # loading from the policy manager - def wants(self): - return 0 - def sort_queue(self, queue): pass diff --git a/plugins/pyloader/src/testsuite/python_loader_sort_queue.py b/plugins/pyloader/src/testsuite/python_loader_sort_queue.py index 301a97a..ff80359 100644 --- a/plugins/pyloader/src/testsuite/python_loader_sort_queue.py +++ b/plugins/pyloader/src/testsuite/python_loader_sort_queue.py @@ -14,13 +14,6 @@ class python_loader_sort_queue(CPUPolicy) : def get_time_slice(self): return -1 - - # FIXME incorrect, but must be implemented to allow - # loading from the policy manager - def wants(self): - return 0 - - def sort_queue(self, queue): print "[II] Entering willingly an endless loop." while True: diff --git a/plugins/pyloader/src/testsuite/test-python_loader.cc b/plugins/pyloader/src/testsuite/test-python_loader.cc index 12e5b27..8d64bea 100644 --- a/plugins/pyloader/src/testsuite/test-python_loader.cc +++ b/plugins/pyloader/src/testsuite/test-python_loader.cc @@ -89,12 +89,8 @@ main(int argc, char** argv) CPUPolicy* pol = find_pol_by_name(policies, "python_loader_configure"); assert(pol != NULL); - // FIXME : Maybe activating a policy only to configure it is an overkill? - // Who gives a fuck about it? + // activate_policy will also configure the policy pgk.activate_policy(&his, pol); - - //already done by activate_policy - //pol->configure(); } catch (UserInterruptException e) { diff --git a/plugins/xmlsave/src/xml_serializer_factory.cc b/plugins/xmlsave/src/xml_serializer_factory.cc index e9ffa79..191d5db 100644 --- a/plugins/xmlsave/src/xml_serializer_factory.cc +++ b/plugins/xmlsave/src/xml_serializer_factory.cc @@ -251,12 +251,11 @@ XMLSerializerFactory::create_subrequest(Parameters& parameters) int old_key = 0; int lasts_for = 0; - //int places=1; Parameters::iterator pos; resource_key_t new_key = 0; - // read "arrival-time" property + // read "resource" property pos = parameters.find(Glib::ustring("resource")); if (pos != parameters.end()) { @@ -271,23 +270,16 @@ XMLSerializerFactory::create_subrequest(Parameters& parameters) } } - // read "priority" property - //pos = parameters.find(Glib::ustring("how-many")); - //if (pos != parameters.end()) { - // string_to_int(pos->second, places); - //} - - // read "priority" property + // read "lasts-for" property pos = parameters.find(Glib::ustring("lasts-for")); if (pos != parameters.end()) { string_to_int(pos->second, lasts_for); } - //FIXME places? - return _hist->add_subrequest(*_last_request, new_key, (History::time_t)lasts_for/*, (History::size_t)places*/); + return _hist->add_subrequest(*_last_request, new_key, (History::time_t)lasts_for); } - // add a sub request - Request, resource_key, duration, places + // add a sub request - Request, resource_key, duration } diff --git a/plugins/xmlsave/src/xml_visitor.cc b/plugins/xmlsave/src/xml_visitor.cc index baa55e7..c09ba66 100644 --- a/plugins/xmlsave/src/xml_visitor.cc +++ b/plugins/xmlsave/src/xml_visitor.cc @@ -298,16 +298,12 @@ void XMLVisitor::from_subrequest(xmlNodePtr parent, const SubRequest& obj) throw { Glib::ustring strResource; - //Glib::ustring strHowMany; Glib::ustring strLastsFor; int_to_string(obj.get_resource_key(), strResource); - //FIXME places? - //int_to_string(obj.get_places(), strHowMany); int_to_string(obj.get_length(), strLastsFor); xmlNodePtr subrequest_node = xmlNewChild(parent, NULL, (const xmlChar *) "subrequest", NULL); xmlNewProp(subrequest_node, (const xmlChar *) "resource", (const xmlChar *) strResource.c_str()); - //xmlNewProp(subrequest_node, (const xmlChar *) "how-many", (const xmlChar *) strHowMany.c_str()); xmlNewProp(subrequest_node, (const xmlChar *) "lasts-for", (const xmlChar *) strLastsFor.c_str()); } else diff --git a/src/backend/cpu_policy_manager.cc b/src/backend/cpu_policy_manager.cc index ed8e15c..ddd0e9c 100644 --- a/src/backend/cpu_policy_manager.cc +++ b/src/backend/cpu_policy_manager.cc @@ -22,30 +22,14 @@ #include "cpu_policy_manager.hh" #include "cpu_policies_gatekeeper.hh" -CPUPolicyManager* -CPUPolicyManager::_registered = NULL; - CPUPolicyManager::CPUPolicyManager() { - //FIXME remove this when get_registered_manager is dropped - _registered = this; - CPUPoliciesGatekeeper::get_instance().register_manager(this); } CPUPolicyManager::~CPUPolicyManager() { - // This check is necessary: - //FIXME remove this when get_registered_manager is dropped - if (_registered == this) _registered = NULL; - CPUPoliciesGatekeeper::get_instance().unregister_manager(this); } -CPUPolicyManager& -CPUPolicyManager::get_registered_manager() -{ - return *_registered; -} - diff --git a/src/backend/cpu_policy_manager.hh b/src/backend/cpu_policy_manager.hh index 65087a1..1195b8b 100644 --- a/src/backend/cpu_policy_manager.hh +++ b/src/backend/cpu_policy_manager.hh @@ -51,14 +51,6 @@ namespace sgpem virtual ~CPUPolicyManager() = 0; - /** - Gets THE policy (the only today) used. - Next versions will implement some other kind. - \return A reference to the policy. - FIXME deprecated - */ - //virtual CPUPolicy& get_policy() = 0; - /** Init (or reset if yet initialized) the manager. FIXME deprecated @@ -67,21 +59,10 @@ namespace sgpem virtual const std::vector& get_avail_policies() = 0; - /** \brief Get the registered manager instance - * FIXME deprecated - * - * \return The registered policy manager instance. - */ - static CPUPolicyManager& get_registered_manager(); - protected: virtual void collect_policies() = 0; std::vector _policies; - - private: - /** A pointer to the registered instance */ - static CPUPolicyManager* _registered; }; } //~ namespace sgpem diff --git a/src/backend/dynamic_process.cc b/src/backend/dynamic_process.cc index 3990b1e..b144819 100644 --- a/src/backend/dynamic_process.cc +++ b/src/backend/dynamic_process.cc @@ -101,8 +101,6 @@ DynamicProcess::get_state() const { state thread_state = (*seq)->get_state(); - // TODO Is this OK? Must be tested... - switch(thread_state) { case state_running: // (a) @@ -145,7 +143,6 @@ DynamicProcess::get_state() const void DynamicProcess::serialize(SerializeVisitor& translator) const { - // translator.from_process(*_core); translator.from_process(*this); } diff --git a/src/backend/resource_policies_gatekeeper.cc b/src/backend/resource_policies_gatekeeper.cc index 979ed3d..75c004d 100644 --- a/src/backend/resource_policies_gatekeeper.cc +++ b/src/backend/resource_policies_gatekeeper.cc @@ -108,19 +108,15 @@ ResourcePoliciesGatekeeper::deactivate_policies(const ResourcePolicyManager& man for (AvailableIt avail_it = policies.begin(); avail_it != policies.end(); ++avail_it) { - // TODO isn't there a way to write more compact code by using - // library utilities? for (PolicyIterator it = _active_policies.begin(); it != _active_policies.end();) { - // FIXME Is this necessary? It just came across my mind the idea that - // incrementing an invalid iterator might be unsafe... - PolicyIterator next = it; - ++next; - + // NOTE we use postfix ++ because I'm not sure if it's + // safe to increment an invalid iterator (set::erase() makes the iterator + // invalid) if (it->second == *avail_it) - _active_policies.erase(it); - - it = next; + _active_policies.erase(it++); + else + ++it; } } //~ for(avail_it) } diff --git a/src/text_simulation.cc b/src/text_simulation.cc index 2b8b328..9445e8b 100644 --- a/src/text_simulation.cc +++ b/src/text_simulation.cc @@ -229,10 +229,6 @@ TextSimulation::get_parameter(CommandParameter& parameter) T value; - // FIXME semi-hack, it's a bit overkill to tokenize the string - // to find if it's only composed of white spaces... - // Indedeed there's a pro: by using extensively tokenize() we are more sure - // it's correct ;-) if (tokenize(input).size() > 0) { try @@ -285,17 +281,12 @@ namespace sgpem buf = readline(); - // FIXME semi-hack, it's a bit overkill to tokenize the string - // to find if it's only composed of white spaces... - // Indedeed there's a pro: by using extensively tokenize() we are more sure - // it's correct ;-) Tokens tokens = tokenize(buf); if (tokens.size() == 0 && parameter.required) p_stderr(_("ERROR: This is a mandatory atribute; you MUST provide a valid value!\n")); else { - // FIXME should we assign the entire line here or just a token? parameter.value = buf; loop = false; } @@ -324,10 +315,6 @@ namespace sgpem ustring str = readline(); - // FIXME semi-hack, it's a bit overkill to tokenize the string - // to find if it's only composed of white spaces... - // Indedeed there's a pro: by using extensively tokenize() we are more sure - // it's correct ;-) Tokens tokens = tokenize(str); if (tokens.size() != 0)