- TODO and FIXME reduced to 38

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@941 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
elvez 2006-08-25 22:43:04 +00:00
parent 57059b647b
commit 696c513ed2
13 changed files with 13 additions and 106 deletions

View File

@ -103,7 +103,7 @@ PythonCPUPolicy::activate() throw(UserInterruptException, MalformedPolicyExcepti
Glib::RecMutex::Lock lock(_mtx);; Glib::RecMutex::Lock lock(_mtx);;
set_callback_policy(const_cast<PythonCPUPolicy*>(this)); set_callback_policy(const_cast<PythonCPUPolicy*>(this));
// FIXME write the rest, taking away code from constructor // TODO write the rest, taking away code from constructor
configure(); configure();
@ -117,7 +117,7 @@ PythonCPUPolicy::deactivate()
Glib::RecMutex::Lock lock(_mtx);; Glib::RecMutex::Lock lock(_mtx);;
set_callback_policy(const_cast<PythonCPUPolicy*>(this)); set_callback_policy(const_cast<PythonCPUPolicy*>(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() // destructor, AFTER having written activate()
_parameters.clear(); _parameters.clear();

View File

@ -16,10 +16,5 @@ class python_loader_configure(CPUPolicy) :
def get_time_slice(self): def get_time_slice(self):
return -1 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): def sort_queue(self, queue):
pass pass

View File

@ -17,10 +17,5 @@ class python_loader_get_time_slice(CPUPolicy) :
pass pass
return -1 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): def sort_queue(self, queue):
pass pass

View File

@ -17,10 +17,5 @@ class python_loader_is_preemptive(CPUPolicy) :
def get_time_slice(self): def get_time_slice(self):
return -1 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): def sort_queue(self, queue):
pass pass

View File

@ -14,13 +14,6 @@ class python_loader_sort_queue(CPUPolicy) :
def get_time_slice(self): def get_time_slice(self):
return -1 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): def sort_queue(self, queue):
print "[II] Entering willingly an endless loop." print "[II] Entering willingly an endless loop."
while True: while True:

View File

@ -89,12 +89,8 @@ main(int argc, char** argv)
CPUPolicy* pol = find_pol_by_name(policies, "python_loader_configure"); CPUPolicy* pol = find_pol_by_name(policies, "python_loader_configure");
assert(pol != NULL); assert(pol != NULL);
// FIXME : Maybe activating a policy only to configure it is an overkill? // activate_policy will also configure the policy
// Who gives a fuck about it?
pgk.activate_policy(&his, pol); pgk.activate_policy(&his, pol);
//already done by activate_policy
//pol->configure();
} }
catch (UserInterruptException e) catch (UserInterruptException e)
{ {

View File

@ -251,12 +251,11 @@ XMLSerializerFactory::create_subrequest(Parameters& parameters)
int old_key = 0; int old_key = 0;
int lasts_for = 0; int lasts_for = 0;
//int places=1;
Parameters::iterator pos; Parameters::iterator pos;
resource_key_t new_key = 0; resource_key_t new_key = 0;
// read "arrival-time" property // read "resource" property
pos = parameters.find(Glib::ustring("resource")); pos = parameters.find(Glib::ustring("resource"));
if (pos != parameters.end()) if (pos != parameters.end())
{ {
@ -271,23 +270,16 @@ XMLSerializerFactory::create_subrequest(Parameters& parameters)
} }
} }
// read "priority" property // read "lasts-for" property
//pos = parameters.find(Glib::ustring("how-many"));
//if (pos != parameters.end()) {
// string_to_int(pos->second, places);
//}
// read "priority" property
pos = parameters.find(Glib::ustring("lasts-for")); pos = parameters.find(Glib::ustring("lasts-for"));
if (pos != parameters.end()) if (pos != parameters.end())
{ {
string_to_int(pos->second, lasts_for); string_to_int(pos->second, lasts_for);
} }
//FIXME places? return _hist->add_subrequest(*_last_request, new_key, (History::time_t)lasts_for);
return _hist->add_subrequest(*_last_request, new_key, (History::time_t)lasts_for/*, (History::size_t)places*/);
} }
// add a sub request - Request, resource_key, duration, places // add a sub request - Request, resource_key, duration
} }

View File

@ -298,16 +298,12 @@ void XMLVisitor::from_subrequest(xmlNodePtr parent, const SubRequest& obj) throw
{ {
Glib::ustring strResource; Glib::ustring strResource;
//Glib::ustring strHowMany;
Glib::ustring strLastsFor; Glib::ustring strLastsFor;
int_to_string(obj.get_resource_key(), strResource); int_to_string(obj.get_resource_key(), strResource);
//FIXME places?
//int_to_string(obj.get_places(), strHowMany);
int_to_string(obj.get_length(), strLastsFor); int_to_string(obj.get_length(), strLastsFor);
xmlNodePtr subrequest_node = xmlNewChild(parent, NULL, (const xmlChar *) "subrequest", NULL); 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 *) "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()); xmlNewProp(subrequest_node, (const xmlChar *) "lasts-for", (const xmlChar *) strLastsFor.c_str());
} }
else else

View File

@ -22,30 +22,14 @@
#include "cpu_policy_manager.hh" #include "cpu_policy_manager.hh"
#include "cpu_policies_gatekeeper.hh" #include "cpu_policies_gatekeeper.hh"
CPUPolicyManager*
CPUPolicyManager::_registered = NULL;
CPUPolicyManager::CPUPolicyManager() CPUPolicyManager::CPUPolicyManager()
{ {
//FIXME remove this when get_registered_manager is dropped
_registered = this;
CPUPoliciesGatekeeper::get_instance().register_manager(this); CPUPoliciesGatekeeper::get_instance().register_manager(this);
} }
CPUPolicyManager::~CPUPolicyManager() 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); CPUPoliciesGatekeeper::get_instance().unregister_manager(this);
} }
CPUPolicyManager&
CPUPolicyManager::get_registered_manager()
{
return *_registered;
}

View File

@ -51,14 +51,6 @@ namespace sgpem
virtual ~CPUPolicyManager() = 0; 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. Init (or reset if yet initialized) the manager.
FIXME deprecated FIXME deprecated
@ -67,21 +59,10 @@ namespace sgpem
virtual const std::vector<CPUPolicy*>& get_avail_policies() = 0; virtual const std::vector<CPUPolicy*>& get_avail_policies() = 0;
/** \brief Get the registered manager instance
* FIXME deprecated
*
* \return The registered policy manager instance.
*/
static CPUPolicyManager& get_registered_manager();
protected: protected:
virtual void collect_policies() = 0; virtual void collect_policies() = 0;
std::vector<CPUPolicy*> _policies; std::vector<CPUPolicy*> _policies;
private:
/** A pointer to the registered instance */
static CPUPolicyManager* _registered;
}; };
} //~ namespace sgpem } //~ namespace sgpem

View File

@ -101,8 +101,6 @@ DynamicProcess::get_state() const
{ {
state thread_state = (*seq)->get_state(); state thread_state = (*seq)->get_state();
// TODO Is this OK? Must be tested...
switch(thread_state) switch(thread_state)
{ {
case state_running: // (a) case state_running: // (a)
@ -145,7 +143,6 @@ DynamicProcess::get_state() const
void void
DynamicProcess::serialize(SerializeVisitor& translator) const DynamicProcess::serialize(SerializeVisitor& translator) const
{ {
// translator.from_process(*_core);
translator.from_process(*this); translator.from_process(*this);
} }

View File

@ -108,19 +108,15 @@ ResourcePoliciesGatekeeper::deactivate_policies(const ResourcePolicyManager& man
for (AvailableIt avail_it = policies.begin(); avail_it != policies.end(); ++avail_it) 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();) for (PolicyIterator it = _active_policies.begin(); it != _active_policies.end();)
{ {
// FIXME Is this necessary? It just came across my mind the idea that // NOTE we use postfix ++ because I'm not sure if it's
// incrementing an invalid iterator might be unsafe... // safe to increment an invalid iterator (set::erase() makes the iterator
PolicyIterator next = it; // invalid)
++next;
if (it->second == *avail_it) if (it->second == *avail_it)
_active_policies.erase(it); _active_policies.erase(it++);
else
it = next; ++it;
} }
} //~ for(avail_it) } //~ for(avail_it)
} }

View File

@ -229,10 +229,6 @@ TextSimulation::get_parameter(CommandParameter<T>& parameter)
T value; 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) if (tokenize(input).size() > 0)
{ {
try try
@ -285,17 +281,12 @@ namespace sgpem
buf = readline(); 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); Tokens tokens = tokenize(buf);
if (tokens.size() == 0 && parameter.required) if (tokens.size() == 0 && parameter.required)
p_stderr(_("ERROR: This is a mandatory atribute; you MUST provide a valid value!\n")); p_stderr(_("ERROR: This is a mandatory atribute; you MUST provide a valid value!\n"));
else else
{ {
// FIXME should we assign the entire line here or just a token?
parameter.value = buf; parameter.value = buf;
loop = false; loop = false;
} }
@ -324,10 +315,6 @@ namespace sgpem
ustring str = readline(); 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); Tokens tokens = tokenize(str);
if (tokens.size() != 0) if (tokens.size() != 0)