- 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() */;
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();
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -122,7 +122,8 @@ namespace sgpem
if (os)
{
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;
}
} // end - if(ofs)

View File

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

View File

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

View File

@ -97,8 +97,7 @@ ResourcePoliciesGatekeeper::activate_policy(History *history, ResourcePolicy* po
}
ResourcePoliciesGatekeeper::ResourcePoliciesGatekeeper()
{
}
{}
void
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
// incrementing an invalid iterator might be unsafe...
PolicyIterator next = it; ++next;
PolicyIterator next = it;
++next;
if (it->second == *avail_it)
_active_policies.erase(it);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -213,7 +213,6 @@ namespace sgpem
// this class should invoke the Scheduler Stepforward method.
class StepForwardTester
{
}
// 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),
up_bound(_up_bound), required(_required), preset(_preset),
value(_preset)
{
}
{}
template <typename T>
CommandParameter<T>::CommandParameter(const PolicyParameters::Parameter<T>& pparam) :
@ -86,19 +85,16 @@ namespace sgpem
low_bound(pparam.get_lower_bound()),
up_bound(pparam.get_upper_bound()), required(pparam.is_required()),
preset(pparam.get_default()), value(pparam.get_value())
{
}
{}
}
TextSimulation::TextSimulation() :
_saved(true)
{
}
{}
TextSimulation::~TextSimulation()
{
}
{}
bool
TextSimulation::check_arguments_num(const Tokens& arguments, unsigned int num)
@ -202,7 +198,7 @@ namespace sgpem
}
}
}
} //~ namespace sgpem
template <typename T>
void