- 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:
parent
57059b647b
commit
696c513ed2
|
@ -103,7 +103,7 @@ PythonCPUPolicy::activate() throw(UserInterruptException, MalformedPolicyExcepti
|
|||
Glib::RecMutex::Lock lock(_mtx);;
|
||||
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();
|
||||
|
||||
|
@ -117,7 +117,7 @@ PythonCPUPolicy::deactivate()
|
|||
Glib::RecMutex::Lock lock(_mtx);;
|
||||
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()
|
||||
|
||||
_parameters.clear();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<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:
|
||||
virtual void collect_policies() = 0;
|
||||
|
||||
std::vector<CPUPolicy*> _policies;
|
||||
|
||||
private:
|
||||
/** A pointer to the registered instance */
|
||||
static CPUPolicyManager* _registered;
|
||||
};
|
||||
|
||||
} //~ namespace sgpem
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -229,10 +229,6 @@ TextSimulation::get_parameter(CommandParameter<T>& 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)
|
||||
|
|
Loading…
Reference in New Issue