- 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:
parent
aaf8e068d3
commit
d3c7b46853
108 changed files with 3196 additions and 3180 deletions
|
@ -42,7 +42,7 @@ using namespace std;
|
|||
|
||||
/*
|
||||
* This program tests the XML serialization via the XMLSerializer class.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
@ -62,13 +62,13 @@ main(int argc, char** argv)
|
|||
{
|
||||
// output file name
|
||||
Glib::ustring outfile("xml-visit.xml");
|
||||
|
||||
|
||||
// string stream to compare print dump of environment
|
||||
ostringstream os1;
|
||||
ostringstream os2;
|
||||
ostringstream os3;
|
||||
ostringstream os4;
|
||||
|
||||
|
||||
ConcreteHistory hist;
|
||||
cout << "create ConcreteHistory hist" << endl;
|
||||
|
||||
|
@ -90,38 +90,38 @@ main(int argc, char** argv)
|
|||
// add something other to history
|
||||
addSomethingHistory(hist);
|
||||
cout << "add other data to hist" << endl;
|
||||
|
||||
|
||||
// print on a string stream os2
|
||||
dumpEnvironment(hist.get_last_environment(), os2);
|
||||
os2 << ends; // null terminated string
|
||||
cout << "dump hist(t2) in print format into os2" << endl;
|
||||
|
||||
cout << "Comparing dump of hist(t1) and hist(t2): " << (os1.str()==os2.str()?"equals":"not equals") << endl;
|
||||
|
||||
cout << "Comparing dump of hist(t1) and hist(t2): " << (os1.str() == os2.str() ? "equals" : "not equals") << endl;
|
||||
|
||||
ConcreteHistory hist2;
|
||||
xmlser.restore_snapshot(outfile, hist2);
|
||||
cout << "create ConcreteHistory hist" << endl;
|
||||
cout << "read XML data from file " << outfile << " and put into hist2(t3)"<< endl;
|
||||
cout << "read XML data from file " << outfile << " and put into hist2(t3)" << endl;
|
||||
|
||||
dumpEnvironment(hist2.get_last_environment(), os3);
|
||||
os3 << ends; // null terminated string
|
||||
cout << "dump hist2(t3) in print format into os3" << endl;
|
||||
|
||||
cout << "Comparing dump of hist(t1) and hist2(t3): " << (os1.str()==os3.str()?"equals":"not equals") << endl;
|
||||
|
||||
cout << "Comparing dump of hist(t1) and hist2(t3): " << (os1.str() == os3.str() ? "equals" : "not equals") << endl;
|
||||
|
||||
xmlser.restore_snapshot(outfile, hist);
|
||||
cout << "read XML data from file " << outfile << " and put into hist(t4)"<< endl;
|
||||
|
||||
cout << "read XML data from file " << outfile << " and put into hist(t4)" << endl;
|
||||
|
||||
dumpEnvironment(hist.get_last_environment(), os4);
|
||||
os4 << ends; // null terminated string
|
||||
cout << "dump hist(t3) in print format into os4" << endl;
|
||||
|
||||
cout << "Comparing dump of hist(t1) and hist(t4): " << (os1.str()==os4.str()?"equals":"not equals") << endl;
|
||||
|
||||
|
||||
cout << "Comparing dump of hist(t1) and hist(t4): " << (os1.str() == os4.str() ? "equals" : "not equals") << endl;
|
||||
|
||||
int ret = 1;
|
||||
if(os1.str()!=os2.str()
|
||||
&& os1.str()==os3.str()
|
||||
&& os1.str()==os4.str())
|
||||
if (os1.str() != os2.str()
|
||||
&& os1.str() == os3.str()
|
||||
&& os1.str() == os4.str())
|
||||
{
|
||||
cout << "test successful" << endl;
|
||||
ret = 0;
|
||||
|
@ -131,7 +131,7 @@ main(int argc, char** argv)
|
|||
cout << "test failed" << endl;
|
||||
ret = 1;
|
||||
}
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
@ -145,10 +145,10 @@ void fillHistory(History &hist)
|
|||
History::ResourcePair respair0 = hist.add_resource(Glib::ustring("Resource 0"), false, 1, 2);
|
||||
// add a resource - name, preemptable, places, availability
|
||||
History::ResourcePair respair00 = hist.add_resource(Glib::ustring("Resource 00"), false, 1, 2);
|
||||
|
||||
|
||||
// add a resource - name, preemptable, places, availability
|
||||
History::ResourcePair respair = hist.add_resource(Glib::ustring("Resource 1"), false, 1, 2);
|
||||
|
||||
|
||||
// add a resource - name, preemptable, places, availability
|
||||
History::ResourcePair respair2 = hist.add_resource(Glib::ustring("Invalid? Resource <n> 1"), false, 1, 2);
|
||||
// and print his values
|
||||
|
@ -201,32 +201,32 @@ void addSomethingHistory(History &hist)
|
|||
// print entire environment into the passed ostream
|
||||
void dumpEnvironment(const Environment& env, ostream &os)
|
||||
{
|
||||
os << "dump environment start " <<endl;
|
||||
os << "dump environment start " << endl;
|
||||
|
||||
const Environment::Resources& rvect = env.get_resources();
|
||||
typedef Environment::Resources::const_iterator res_iterator;
|
||||
|
||||
res_iterator riter = rvect.begin();
|
||||
while(riter!=rvect.end())
|
||||
while (riter != rvect.end())
|
||||
{
|
||||
Resource* r = (*riter).second;
|
||||
os << " resource name: " << r->get_name()
|
||||
/* << " key: " << (*riter).first */
|
||||
<< " places: " << r->get_places() << endl;
|
||||
/* << " key: " << (*riter).first */
|
||||
<< " places: " << r->get_places() << endl;
|
||||
riter++;
|
||||
}
|
||||
|
||||
|
||||
const Environment::Processes& pvect = env.get_processes();
|
||||
typedef std::vector<Process*>::const_iterator proc_iterator;
|
||||
|
||||
proc_iterator iter = pvect.begin();
|
||||
proc_iterator end = pvect.end();
|
||||
while(iter!=end)
|
||||
while (iter != end)
|
||||
{
|
||||
Process* p = (*iter);
|
||||
os << " process name: " << p->get_name()
|
||||
<< " arrival_time: " << p->get_arrival_time()
|
||||
<< " base_priority: " << p->get_base_priority() << endl;
|
||||
<< " arrival_time: " << p->get_arrival_time()
|
||||
<< " base_priority: " << p->get_base_priority() << endl;
|
||||
iter++;
|
||||
|
||||
typedef std::vector<Thread*> Threads;
|
||||
|
@ -234,20 +234,20 @@ void dumpEnvironment(const Environment& env, ostream &os)
|
|||
const Threads& tvect = p->get_threads();
|
||||
thr_iterator iter1 = tvect.begin();
|
||||
thr_iterator end1 = tvect.end();
|
||||
while(iter1!=end1)
|
||||
while (iter1 != end1)
|
||||
{
|
||||
|
||||
Thread* t = (*iter1);
|
||||
os << " thread name: " << t->get_name()
|
||||
<< " arrival_time: " << t->get_arrival_time()
|
||||
<< " base_priority: " << t->get_base_priority() << endl;
|
||||
<< " arrival_time: " << t->get_arrival_time()
|
||||
<< " base_priority: " << t->get_base_priority() << endl;
|
||||
|
||||
typedef std::vector<Request*> Requests;
|
||||
typedef std::vector<Request*>::const_iterator req_iterator;
|
||||
const Requests& rvect = t->get_requests();
|
||||
req_iterator iter2 = rvect.begin();
|
||||
req_iterator end2 = rvect.end();
|
||||
while(iter2!=end2)
|
||||
while (iter2 != end2)
|
||||
{
|
||||
|
||||
Request* r = (*iter2);
|
||||
|
@ -258,14 +258,15 @@ void dumpEnvironment(const Environment& env, ostream &os)
|
|||
const SubRequests& srvect = r->get_subrequests();
|
||||
subreq_iterator iter3 = srvect.begin();
|
||||
subreq_iterator end3 = srvect.end();
|
||||
while(iter3!=end3)
|
||||
while (iter3 != end3)
|
||||
{
|
||||
|
||||
SubRequest* sr = (*iter3);
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue