- Give code a round of indentation. Thank astyle, not me.

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@837 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-08-09 14:38:45 +00:00
parent aaf8e068d3
commit d3c7b46853
108 changed files with 3196 additions and 3180 deletions

View File

@ -265,7 +265,8 @@ void dumpEnvironment(const Environment& env, ostream &os)
os << " sub request: " /* << " resource_key: " << sr->get_resource_key() */; os << " sub request: " /* << " resource_key: " << sr->get_resource_key() */;
Environment::Resources::const_iterator pos = env.get_resources().find(sr->get_resource_key()); Environment::Resources::const_iterator pos = env.get_resources().find(sr->get_resource_key());
if (pos != env.get_resources().end()) { if (pos != env.get_resources().end())
{
os << " name: " << pos->second->get_name(); os << " name: " << pos->second->get_name();
} }

View File

@ -31,12 +31,10 @@
using namespace sgpem; using namespace sgpem;
XMLSerializer::~XMLSerializer() XMLSerializer::~XMLSerializer()
{ {}
}
XMLSerializer::XMLSerializer() XMLSerializer::XMLSerializer()
{ {}
}
@ -48,7 +46,8 @@ void XMLSerializer::save_snapshot(const Glib::ustring& filename, const History&
xmlDocPtr doc; xmlDocPtr doc;
doc = xmlNewDoc((const xmlChar *)"1.0"); doc = xmlNewDoc((const xmlChar *)"1.0");
if(doc!=NULL){ if (doc != NULL)
{
fill_doc(doc, hist); fill_doc(doc, hist);
int nwritten = xmlSaveFormatFile (filename.c_str(), doc, 1); int nwritten = xmlSaveFormatFile (filename.c_str(), doc, 1);
if (nwritten < 0) if (nwritten < 0)
@ -80,7 +79,8 @@ void XMLSerializer::restore_snapshot(const Glib::ustring& filename, History& his
* build an XML tree from a the file; * build an XML tree from a the file;
*/ */
doc = xmlParseFile(filename.c_str()); doc = xmlParseFile(filename.c_str());
if (doc == NULL) { if (doc == NULL)
{
xmlCleanupParser(); xmlCleanupParser();
throw SerializerError("Parsing Error: doc is invalid."); throw SerializerError("Parsing Error: doc is invalid.");
} }
@ -229,7 +229,8 @@ void XMLSerializer::read_doc(xmlDocPtr doc, XMLSerializerFactory& fact) throw(Se
*/ */
xmlNodePtr root; xmlNodePtr root;
root = xmlDocGetRootElement(doc); root = xmlDocGetRootElement(doc);
if (root == NULL) { if (root == NULL)
{
xmlFreeDoc(doc); xmlFreeDoc(doc);
xmlCleanupParser(); xmlCleanupParser();
throw SerializerError("Reading Error: xml doc is empty."); throw SerializerError("Reading Error: xml doc is empty.");
@ -258,8 +259,10 @@ XMLSerializerFactory::Parameters* read_properties(xmlAttrPtr prop)
return NULL; return NULL;
XMLSerializerFactory::Parameters* par = new XMLSerializerFactory::Parameters(); XMLSerializerFactory::Parameters* par = new XMLSerializerFactory::Parameters();
while (prop != NULL) { while (prop != NULL)
if(prop->children && xmlNodeIsText(prop->children)){ {
if (prop->children && xmlNodeIsText(prop->children))
{
xmlChar *key = xmlNodeGetContent (prop->children); xmlChar *key = xmlNodeGetContent (prop->children);
// xmlChar *key = xmlNodeListGetString(doc, prop->children, 1); // xmlChar *key = xmlNodeListGetString(doc, prop->children, 1);
if (key != NULL) if (key != NULL)

View File

@ -36,12 +36,10 @@ using namespace std;
XMLSerializerFactory::XMLSerializerFactory(History& hist) XMLSerializerFactory::XMLSerializerFactory(History& hist)
: _hist(&hist) : _hist(&hist)
{ {}
}
XMLSerializerFactory::~XMLSerializerFactory() XMLSerializerFactory::~XMLSerializerFactory()
{ {}
}
History* XMLSerializerFactory::get_history() History* XMLSerializerFactory::get_history()
{ {
@ -93,13 +91,15 @@ XMLSerializerFactory::create_resource(Parameters& parameters)
// read "name" property // read "name" property
pos = parameters.find(Glib::ustring("name")); pos = parameters.find(Glib::ustring("name"));
if (pos != parameters.end()) { if (pos != parameters.end())
{
name = pos->second; name = pos->second;
} }
// read "key" property // read "key" property
pos = parameters.find(Glib::ustring("id")); pos = parameters.find(Glib::ustring("id"));
if (pos != parameters.end()) { if (pos != parameters.end())
{
Glib::ustring id = key = pos->second; Glib::ustring id = key = pos->second;
if (id.length() > 6 && id.substr(0, 6) == Glib::ustring("reskey")) if (id.length() > 6 && id.substr(0, 6) == Glib::ustring("reskey"))
{ {
@ -110,19 +110,22 @@ XMLSerializerFactory::create_resource(Parameters& parameters)
// read "preemptable" property // read "preemptable" property
pos = parameters.find(Glib::ustring("preemptable")); pos = parameters.find(Glib::ustring("preemptable"));
if (pos != parameters.end()) { if (pos != parameters.end())
{
preemptable = (pos->second == "true"); preemptable = (pos->second == "true");
} }
// read "arrival-time" property // read "arrival-time" property
pos = parameters.find(Glib::ustring("arrival-time")); pos = parameters.find(Glib::ustring("arrival-time"));
if (pos != parameters.end()) { if (pos != parameters.end())
{
string_to_int(pos->second, arrival_time); string_to_int(pos->second, arrival_time);
} }
// read "how-many" property // read "how-many" property
pos = parameters.find(Glib::ustring("how-many")); pos = parameters.find(Glib::ustring("how-many"));
if (pos != parameters.end()) { if (pos != parameters.end())
{
string_to_int(pos->second, how_many); string_to_int(pos->second, how_many);
} }
@ -148,19 +151,22 @@ XMLSerializerFactory::create_process(Parameters& parameters)
// read "name" property // read "name" property
pos = parameters.find(Glib::ustring("name")); pos = parameters.find(Glib::ustring("name"));
if (pos != parameters.end()) { if (pos != parameters.end())
{
name = pos->second; name = pos->second;
} }
// read "arrival-time" property // read "arrival-time" property
pos = parameters.find(Glib::ustring("arrival-time")); pos = parameters.find(Glib::ustring("arrival-time"));
if (pos != parameters.end()) { if (pos != parameters.end())
{
string_to_int(pos->second, arrival_time); string_to_int(pos->second, arrival_time);
} }
// read "priority" property // read "priority" property
pos = parameters.find(Glib::ustring("priority")); pos = parameters.find(Glib::ustring("priority"));
if (pos != parameters.end()) { if (pos != parameters.end())
{
string_to_int(pos->second, priority); string_to_int(pos->second, priority);
} }
@ -185,25 +191,29 @@ XMLSerializerFactory::create_thread(Parameters& parameters)
// read "name" property // read "name" property
pos = parameters.find(Glib::ustring("name")); pos = parameters.find(Glib::ustring("name"));
if (pos != parameters.end()) { if (pos != parameters.end())
{
name = pos->second; name = pos->second;
} }
// read "arrival-time" property // read "arrival-time" property
pos = parameters.find(Glib::ustring("arrival-delta")); pos = parameters.find(Glib::ustring("arrival-delta"));
if (pos != parameters.end()) { if (pos != parameters.end())
{
string_to_int(pos->second, arrival_time); string_to_int(pos->second, arrival_time);
} }
// read "priority" property // read "priority" property
pos = parameters.find(Glib::ustring("priority")); pos = parameters.find(Glib::ustring("priority"));
if (pos != parameters.end()) { if (pos != parameters.end())
{
string_to_int(pos->second, priority); string_to_int(pos->second, priority);
} }
// read "priority" property // 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);
} }
@ -223,7 +233,8 @@ XMLSerializerFactory::create_request(Parameters& parameters)
// read "arrival-time" property // read "arrival-time" property
pos = parameters.find(Glib::ustring("arrival-time")); pos = parameters.find(Glib::ustring("arrival-time"));
if (pos != parameters.end()) { if (pos != parameters.end())
{
string_to_int(pos->second, arrival_time); string_to_int(pos->second, arrival_time);
} }
@ -247,12 +258,14 @@ XMLSerializerFactory::create_subrequest(Parameters& parameters)
// read "arrival-time" property // read "arrival-time" property
pos = parameters.find(Glib::ustring("resource")); pos = parameters.find(Glib::ustring("resource"));
if (pos != parameters.end()) { if (pos != parameters.end())
{
string_to_int(pos->second, old_key); string_to_int(pos->second, old_key);
TempMap::iterator temp_pos; TempMap::iterator temp_pos;
temp_pos = _temp_map.find((resource_key_t)old_key); temp_pos = _temp_map.find((resource_key_t)old_key);
if (temp_pos != _temp_map.end()) { if (temp_pos != _temp_map.end())
{
//take key of resource in _hist //take key of resource in _hist
new_key = temp_pos->second; new_key = temp_pos->second;
} }
@ -266,7 +279,8 @@ XMLSerializerFactory::create_subrequest(Parameters& parameters)
// read "priority" property // 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);
} }

View File

@ -37,12 +37,10 @@ using namespace sgpem;
XMLVisitor::XMLVisitor(xmlNodePtr current) XMLVisitor::XMLVisitor(xmlNodePtr current)
: _current(current) : _current(current)
{ {}
}
XMLVisitor::~XMLVisitor() XMLVisitor::~XMLVisitor()
{ {}
}
void XMLVisitor::from_resource(const Resource& obj) throw(SerializerError) void XMLVisitor::from_resource(const Resource& obj) throw(SerializerError)
{ {

View File

@ -187,7 +187,8 @@ namespace sgpem
SubRequestQueues _sreq_queues; SubRequestQueues _sreq_queues;
}; //~ class ConcreteEnvironment }
; //~ class ConcreteEnvironment
} //~ namespace sgpem } //~ namespace sgpem

View File

@ -95,7 +95,8 @@ namespace sgpem
// Disable assignment, implement it only if needed // Disable assignment, implement it only if needed
ConcreteHistory& operator=(const ConcreteHistory& op2); ConcreteHistory& operator=(const ConcreteHistory& op2);
}; //~ class ConcreteHistory }
; //~ class ConcreteHistory
}//~ namespace sgpem }//~ namespace sgpem

View File

@ -58,8 +58,7 @@ DynamicSubRequest::DynamicSubRequest(const DynamicSubRequest& other,
} }
DynamicSubRequest::~DynamicSubRequest() DynamicSubRequest::~DynamicSubRequest()
{ {}
}
bool bool

View File

@ -157,7 +157,8 @@ GlobalPreferences::key_file_read(KeyFile& kf)
{ {
int new_speed; int new_speed;
const Glib::ustring* val = kf.search_value(Glib::ustring("speed")); const Glib::ustring* val = kf.search_value(Glib::ustring("speed"));
if(val){ if (val)
{
string_to_int(*val, new_speed); string_to_int(*val, new_speed);
set_speed(new_speed); set_speed(new_speed);
} }
@ -230,7 +231,8 @@ GlobalPreferences::key_file_write(KeyFile& kf)
dir_iterator iter = _mod_dirs.begin(); dir_iterator iter = _mod_dirs.begin();
dir_iterator end = _mod_dirs.end(); dir_iterator end = _mod_dirs.end();
int n = 0; int n = 0;
while(iter!=end){ while (iter != end)
{
std::ostringstream ostr; std::ostringstream ostr;
n++; n++;
ostr << "modules-dir-" << n; // << std::ends; ostr << "modules-dir-" << n; // << std::ends;
@ -252,7 +254,8 @@ GlobalPreferences::key_file_write(KeyFile& kf)
dir_iterator iter = _pol_dirs.begin(); dir_iterator iter = _pol_dirs.begin();
dir_iterator end = _pol_dirs.end(); dir_iterator end = _pol_dirs.end();
int n = 0; int n = 0;
while(iter!=end){ while (iter != end)
{
std::ostringstream ostr; std::ostringstream ostr;
n++; n++;
ostr << "policies-dir-" << n; // << std::ends; ostr << "policies-dir-" << n; // << std::ends;

View File

@ -90,7 +90,8 @@ namespace sgpem
{ {
GlobalPreferences::dir_iterator iter = _globalPreferences.modules_dir_begin(); GlobalPreferences::dir_iterator iter = _globalPreferences.modules_dir_begin();
int n = 0; int n = 0;
while(iter!=_globalPreferences.modules_dir_end()){ while (iter != _globalPreferences.modules_dir_end())
{
std::ostringstream ostr; std::ostringstream ostr;
n++; n++;
ostr << "modules-dir-" << n << std::ends; ostr << "modules-dir-" << n << std::ends;
@ -108,7 +109,8 @@ namespace sgpem
{ {
GlobalPreferences::dir_iterator iter = _globalPreferences.policies_dir_begin(); GlobalPreferences::dir_iterator iter = _globalPreferences.policies_dir_begin();
int n = 0; int n = 0;
while(iter!=_globalPreferences.policies_dir_end()){ while (iter != _globalPreferences.policies_dir_end())
{
std::ostringstream ostr; std::ostringstream ostr;
n++; n++;
ostr << "policies-dir-" << n << std::ends; ostr << "policies-dir-" << n << std::ends;

View File

@ -31,13 +31,11 @@ using namespace std;
History::History() History::History()
: _notify(true) : _notify(true)
{ {}
}
History::~History() History::~History()
{ {}
}
void void

View File

@ -123,7 +123,8 @@ namespace sgpem
private: private:
bool _notify; bool _notify;
}; //~ class History }
; //~ class History
}//~ namespace sgpem }//~ namespace sgpem

View File

@ -34,7 +34,8 @@ namespace sgpem
virtual void update(const History& changed_history) = 0; virtual void update(const History& changed_history) = 0;
virtual ~HistoryObserver(); virtual ~HistoryObserver();
}; // class HistoryObserver }
; // class HistoryObserver
}//~ namespace sgpem }//~ namespace sgpem

View File

@ -56,7 +56,8 @@ namespace sgpem
std::set<const Resource*> _resources; std::set<const Resource*> _resources;
std::set<const Thread*> _active_threads; std::set<const Thread*> _active_threads;
Requests _active_requests; Requests _active_requests;
}; // class HistoryObserver }
; // class HistoryObserver
}//~ namespace sgpem }//~ namespace sgpem

View File

@ -26,5 +26,4 @@ using namespace sgpem;
InvalidPluginException::InvalidPluginException(const std::string& what) : InvalidPluginException::InvalidPluginException(const std::string& what) :
std::runtime_error(what) std::runtime_error(what)
{ {}
}

View File

@ -31,7 +31,8 @@ namespace sgpem
{ {
public: public:
InvalidPluginException(const std::string& what); InvalidPluginException(const std::string& what);
}; //~ class InvalidPluginException }
; //~ class InvalidPluginException
} //~ namespace sgpem } //~ namespace sgpem

View File

@ -122,7 +122,8 @@ namespace sgpem
if (os) if (os)
{ {
elements_iterator iter; elements_iterator iter;
for(iter = elements_begin(); iter != elements_end(); iter++){ for (iter = elements_begin(); iter != elements_end(); iter++)
{
os << (*iter).first << "=" << (*iter).second << std::endl; os << (*iter).first << "=" << (*iter).second << std::endl;
} }
} // end - if(ofs) } // end - if(ofs)

View File

@ -64,7 +64,8 @@ namespace sgpem
f_ustring get_author_ptr; f_ustring get_author_ptr;
f_float get_version_ptr; f_float get_version_ptr;
}; //~ class Module }
; //~ class Module
} //~ namespace sgpem } //~ namespace sgpem

View File

@ -49,7 +49,8 @@ namespace sgpem
std::vector<Module*> _modules; std::vector<Module*> _modules;
}; //~ class PluginManager }
; //~ class PluginManager
} //~ namespace sgpem } //~ namespace sgpem

View File

@ -97,8 +97,7 @@ ResourcePoliciesGatekeeper::activate_policy(History *history, ResourcePolicy* po
} }
ResourcePoliciesGatekeeper::ResourcePoliciesGatekeeper() ResourcePoliciesGatekeeper::ResourcePoliciesGatekeeper()
{ {}
}
void void
ResourcePoliciesGatekeeper::deactivate_policies(const ResourcePolicyManager& manager) ResourcePoliciesGatekeeper::deactivate_policies(const ResourcePolicyManager& manager)
@ -115,7 +114,8 @@ ResourcePoliciesGatekeeper::deactivate_policies(const ResourcePolicyManager& man
{ {
// FIXME Is this necessary? It just came across my mind the idea that // FIXME Is this necessary? It just came across my mind the idea that
// incrementing an invalid iterator might be unsafe... // incrementing an invalid iterator might be unsafe...
PolicyIterator next = it; ++next; PolicyIterator next = it;
++next;
if (it->second == *avail_it) if (it->second == *avail_it)
_active_policies.erase(it); _active_policies.erase(it);

View File

@ -468,8 +468,7 @@ static void prepare_ready_queue(ConcreteEnvironment& snapshot,
//private constructor. The parameter is discarded //private constructor. The parameter is discarded
Scheduler::Scheduler() Scheduler::Scheduler()
: _ready_queue(NULL), _policy(NULL), _step_mutex() : _ready_queue(NULL), _policy(NULL), _step_mutex()
{ {}
}
ReadyQueue* ReadyQueue*

View File

@ -26,5 +26,4 @@ using namespace sgpem;
SerializerError::SerializerError(const std::string& what) : SerializerError::SerializerError(const std::string& what) :
std::runtime_error(what) std::runtime_error(what)
{ {}
}

View File

@ -31,7 +31,8 @@ namespace sgpem
{ {
public: public:
SerializerError(const std::string& what); SerializerError(const std::string& what);
}; //~ class SerializerError }
; //~ class SerializerError
} //~ namespace sgpem } //~ namespace sgpem

View File

@ -30,8 +30,7 @@ template class SG_DLLEXPORT Singleton<ConcreteSimulation>;
Simulation::~Simulation() Simulation::~Simulation()
{ {}
}
Simulation& Simulation&
Simulation::get_instance() Simulation::get_instance()

View File

@ -27,8 +27,7 @@ using namespace sgpem;
CairoElements::CairoElements(cairo_t* const ctx) CairoElements::CairoElements(cairo_t* const ctx)
: _ctx(ctx) : _ctx(ctx)
{ {}
}
void void
@ -175,12 +174,10 @@ CairoElements::draw_expandable(const Rectangle& area, bool expanded)
Rectangle draw_thread_status(const Point& top_left_crn, Rectangle draw_thread_status(const Point& top_left_crn,
const Thread& thread_info) const Thread& thread_info)
{ {}
}
Rectangle draw_process_status(const Point& top_left_crn, Rectangle draw_process_status(const Point& top_left_crn,
const Process& process_info) const Process& process_info)
{ {}
}

View File

@ -81,8 +81,7 @@ GuiBuilder::GuiBuilder(const std::string& gladefile)
GuiBuilder::~GuiBuilder() GuiBuilder::~GuiBuilder()
{ {}
}
Gtk::Window& Gtk::Window&

View File

@ -31,7 +31,8 @@
/** \brief This class initialize and starts the whole GUI /** \brief This class initialize and starts the whole GUI
*/ */
namespace sgpem { namespace sgpem
{
class GuiBuilder class GuiBuilder
{ {

View File

@ -29,13 +29,11 @@ using namespace sgpem;
SchedulablesWidget::SchedulablesWidget() SchedulablesWidget::SchedulablesWidget()
: Glib::ObjectBase("sgpem_SchedulablesWidget"), CairoWidget() : Glib::ObjectBase("sgpem_SchedulablesWidget"), CairoWidget()
{ {}
}
SchedulablesWidget::~SchedulablesWidget() SchedulablesWidget::~SchedulablesWidget()
{ {}
}
void void

View File

@ -32,7 +32,8 @@
// from here and further until the bottom, all to throw away I suppose // from here and further until the bottom, all to throw away I suppose
int int
main(int argc, char** argv) { main(int argc, char** argv)
{
using namespace sgpem; using namespace sgpem;
using Glib::ustring; using Glib::ustring;

View File

@ -31,7 +31,8 @@
// from here and further until the bottom, all to throw away I suppose // from here and further until the bottom, all to throw away I suppose
int int
main(int argc, char** argv) { main(int argc, char** argv)
{
using namespace sgpem; using namespace sgpem;
using Glib::ustring; using Glib::ustring;

View File

@ -213,7 +213,6 @@ namespace sgpem
// this class should invoke the Scheduler Stepforward method. // this class should invoke the Scheduler Stepforward method.
class StepForwardTester class StepForwardTester
{ {
} }
// from here and further until the bottom, all to throw away I suppose // from here and further until the bottom, all to throw away I suppose

View File

@ -77,8 +77,7 @@ namespace sgpem
description(_description), low_bound(_low_bound), description(_description), low_bound(_low_bound),
up_bound(_up_bound), required(_required), preset(_preset), up_bound(_up_bound), required(_required), preset(_preset),
value(_preset) value(_preset)
{ {}
}
template <typename T> template <typename T>
CommandParameter<T>::CommandParameter(const PolicyParameters::Parameter<T>& pparam) : CommandParameter<T>::CommandParameter(const PolicyParameters::Parameter<T>& pparam) :
@ -86,19 +85,16 @@ namespace sgpem
low_bound(pparam.get_lower_bound()), low_bound(pparam.get_lower_bound()),
up_bound(pparam.get_upper_bound()), required(pparam.is_required()), up_bound(pparam.get_upper_bound()), required(pparam.is_required()),
preset(pparam.get_default()), value(pparam.get_value()) preset(pparam.get_default()), value(pparam.get_value())
{ {}
}
} }
TextSimulation::TextSimulation() : TextSimulation::TextSimulation() :
_saved(true) _saved(true)
{ {}
}
TextSimulation::~TextSimulation() TextSimulation::~TextSimulation()
{ {}
}
bool bool
TextSimulation::check_arguments_num(const Tokens& arguments, unsigned int num) TextSimulation::check_arguments_num(const Tokens& arguments, unsigned int num)
@ -202,7 +198,7 @@ namespace sgpem
} }
} }
} } //~ namespace sgpem
template <typename T> template <typename T>
void void