diff options
author | dmack <dmack@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-03-20 20:21:31 +0000 |
---|---|---|
committer | dmack <dmack@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-03-20 20:21:31 +0000 |
commit | 6bca083122bcdffbdb917f7962031c44e688edbd (patch) | |
tree | 9cf5442e0a5a7e07a43aa92a6c6d8e91f8e2dc8b | |
parent | 90323a16aa7457ce2096a6fcfdb72fa3b7840570 (diff) | |
download | ATCD-6bca083122bcdffbdb917f7962031c44e688edbd.tar.gz |
Fri Mar 20 19:45:41 UTC 2009 Daniel L.C. Mack <daniel.l.mack@vanderbilt.edu>
-rw-r--r-- | SA_POP/C2W/C2W_Demo.cpp | 3 | ||||
-rw-r--r-- | SA_POP/C2W/C2W_Demo.mpc | 2 | ||||
-rw-r--r-- | SA_POP/ChangeLog | 50 | ||||
-rw-r--r-- | SA_POP/LogGraphOut.cpp | 373 | ||||
-rw-r--r-- | SA_POP/LogGraphOut.h | 86 | ||||
-rw-r--r-- | SA_POP/LogGraphOut_Export.h | 58 | ||||
-rw-r--r-- | SA_POP/Planner.cpp | 5 | ||||
-rw-r--r-- | SA_POP/Planner.h | 3 | ||||
-rw-r--r-- | SA_POP/SANet/SANet.cpp | 40 | ||||
-rw-r--r-- | SA_POP/SANet/SANet.h | 2 | ||||
-rw-r--r-- | SA_POP/SAPOP_w_ACE.mpc | 5 |
11 files changed, 608 insertions, 19 deletions
diff --git a/SA_POP/C2W/C2W_Demo.cpp b/SA_POP/C2W/C2W_Demo.cpp index fedbf3ad737..a49d4d55560 100644 --- a/SA_POP/C2W/C2W_Demo.cpp +++ b/SA_POP/C2W/C2W_Demo.cpp @@ -143,6 +143,7 @@ int main (int argc, char* argv[]) SA_POP::Planner *planner = 0; SA_POP::LogGraphOut graph_out (std::cout, 1); + try { @@ -184,7 +185,7 @@ int main (int argc, char* argv[]) //Configure the OutAdapters to use SA_POP::LogScreenOut screen_out (std::cout); - + graph_out.addTracking(toCheck); planner->add_out_adapter (&graph_out); //SA_POP::SchemaOut s_out (std::cout, *kconds); //planner->add_out_adapter (&s_out); diff --git a/SA_POP/C2W/C2W_Demo.mpc b/SA_POP/C2W/C2W_Demo.mpc index 31212c97f6b..319c9388319 100644 --- a/SA_POP/C2W/C2W_Demo.mpc +++ b/SA_POP/C2W/C2W_Demo.mpc @@ -17,7 +17,6 @@ project(C2W_Demo) : xerces, aceexe { Source_Files { C2W_Demo.cpp UserInput.cpp - LogGraphOut.cpp } Inline_Files { @@ -25,7 +24,6 @@ project(C2W_Demo) : xerces, aceexe { Header_Files { UserInput.h - LogGraphOut.h } Documentation_Files { diff --git a/SA_POP/ChangeLog b/SA_POP/ChangeLog index 03212efe04a..66c6240bfd5 100644 --- a/SA_POP/ChangeLog +++ b/SA_POP/ChangeLog @@ -1,3 +1,37 @@ +Fri Mar 20 19:45:41 UTC 2009 Daniel L.C. Mack <daniel.l.mack@vanderbilt.edu> + + * C2W/C2W_Demo.mpc: + Removed the LogGraphOut class as part of the project. + + * C2W/C2W_Demo.cpp: + Added the Replan functions into the demo. Also made some changes on keeping track of external conditoon. + + * LogGraphOut.h: + Added to SA-POP Root and Exported out for the Library + + * LogGraphOut.cpp: + Added to SA-POP Root + + * LogGraphOut_Export.h: + Generated to provide accessibility as an outside hook into the Library. + + * Planner.h: + Added function prototype for updating effect link(update_effect) and printing the entire SANet for Visualization(print_graph) + + * Planner.cpp: + Implements the functions update_effect and print_graph for the Planner. + + * SANet/SANet.h: + Added function prototype for update_effect_link, which propogates the effect link change to the SANet itself. + Added function prototype for print_graphviz, which prints the SANet out into the graphviz dot framework. + + * SANet/SANet.cpp: + Implements the two new prototypes: update_effect_link and print_graphviz + + * SAPOP_w_ACE.mpc: + Added the LogGraphOut as part of the SAPOP project, and allows it to export out the functionality to programs that link to the SAPOP library + + Thu Mar 19 21:45:00 UTC 2009 John S. Kinnebrew <john.s.kinnebrew@vanderbilt.edu> * Instructions for building middleware RACE SA-POP and CoSMIC.txt @@ -17,32 +51,32 @@ Wed Mar 18 21:25:00 UTC 2009 John S. Kinnebrew <john.s.kinnebrew@vanderbilt.ed * Instructions for building middleware, RACE, SA-POP, & CoSMIC.txt: * Instructions for building SA-POP Federate.txt: - Added instructions for building SA-POP, etc. + Added instructions for building SA-POP, etc. Thu Jan 15 18:55:00 UTC 2009 Daniel L.C. Mack <daniel.l.mack@vanderbilt.edu> * C2W/C2W_Demo.cpp: - Uses the replan function in the planner for effects and condition updating + Uses the replan function in the planner for effects and condition updating * SANet/SANode.cpp: - Updates CondNode::update and TaskNode::Update to handle effect link weighting changes. + Updates CondNode::update and TaskNode::Update to handle effect link weighting changes. * SA_PlanStrategy.h: * SA_PlanStrategy.cpp: - Implements a reset function for the PlanStrategy. + Implements a reset function for the PlanStrategy. * SA_SchedStrategy.h: * SA_SchedStrategy.cpp: - Implements a reset function for the SchedStrategy + Implements a reset function for the SchedStrategy * SA_WorkingPlan.h: * SA_WorkingPlan.cpp: - Calls the reset functions for both SchedStrategy and PlanStrategy in the replanning function. - Updated sched_links_ and reused_insts_ to reflect naming conventions. + Calls the reset functions for both SchedStrategy and PlanStrategy in the replanning function. + Updated sched_links_ and reused_insts_ to reflect naming conventions. * SchedStrategy.h: - Added virtual function for reset function + Added virtual function for reset function Fri Jan 9 21:39:55 UTC 2009 Daniel L.C. Mack <daniel.l.mack@vanderbilt.edu> diff --git a/SA_POP/LogGraphOut.cpp b/SA_POP/LogGraphOut.cpp new file mode 100644 index 00000000000..95ba262c90c --- /dev/null +++ b/SA_POP/LogGraphOut.cpp @@ -0,0 +1,373 @@ +// -*- C++ -*- +// + +//============================================================================= +/** + * @file LogGraphOut.cpp + * + * This file contains the LogGraphOut class implementation for the output adapter + * that displays graph visualizations of the plan. + * + * @author Daniel L.C. Mack <daniel.l.mack@vanderbilt.edu> + */ +//============================================================================= + +//For Spawning a new Thread: +//#include <windows.h> + + +#include <iostream> +#include <algorithm> +#include <time.h> +#include "SA_POP_Types.h" +#include "LogGraphOut.h" +#include "SANet/SANetFileIn.h" +#include "Planner.h" +#include <fstream> +#include <vector> +//#include "gvc.h" +//#include "mfg_draw_graph.h" +//#include "mfg_graph_drawer.h" + +using namespace SA_POP; + +// Constructor. +LogGraphOut::LogGraphOut (std::ostream &out, int startstep) +: out_ (out) +{ + graphn = startstep; + hasTracks = false; + // Nothing to do. +} + +// Destructor. +LogGraphOut::~LogGraphOut (void) +{ + // Nothing to do. +} + + +//add Tracking +void LogGraphOut::addTracking(std::vector<SANet::CondID> checks) +{ + tracks = checks; + hasTracks = true; +} + +// Notify about task future expected utility changes. +void LogGraphOut::notify_eu (SA_POP::Planner *planner) +{ + time_t cur_time = time(0); + this->out_ << std::endl; + this->out_ << "EU Changes:" << std::endl; + this->out_ << ctime (&cur_time) << std::endl; + + TaskEUMap eu_changes = planner->get_eu_changes (); + for (TaskEUMap::iterator iter = eu_changes.begin (); + iter != eu_changes.end (); + iter++) + { + this->out_ << "Task " << iter->first << " = " << iter->second; + this->out_ << std::endl; + } +} + +unsigned long WINAPI SecondThread(PVOID pvParam) +{ + system("dot -Tgif GViz.dot -o step.gif"); + system("step.gif"); + return 0; +} + + +// Notify about plan changes. +void LogGraphOut::notify_plan (SA_POP::Planner *planner) +{ + Plan plan = planner->get_plan (); + + time_t cur_time = time(0); + bool done = false; + + /* + GVC_t *gvc; + graph_t *g; + FILE *fp; + + mfg::DrawGraph * graph; + */ + + //gvc = gvContext(); + //This + this->out_ << std::endl; + this->out_ << "Plan (" << plan.name << ") Changed at " << std::endl; + this->out_ << ctime (&cur_time) << std::endl; + this->out_ << "ID: " << plan.plan_id << std::endl; + + this->out_ << "Start Window: [" << plan.start_window.first << ", "; + this->out_ << plan.start_window.second << "]" << std::endl; + + this->out_ << "End Window: [" << plan.end_window.first << ", "; + this->out_ << plan.end_window.second << "]" << std::endl; + + std::vector<int> startimes; + + //Find the plan, and find the ealiest time for the latest time step + //Make sure we don't run out of bounds + int lastime = 0; + int plansize = 0; + if(graphn > 0) + { + for (PlanInstSet::iterator inst_iter = plan.task_insts.begin (); + inst_iter != plan.task_insts.end (); + inst_iter++) + { + PlanTaskInst inst = *inst_iter; + startimes.push_back(inst.start_window.first); + } + + std::sort(startimes.begin(), startimes.end()); + if(graphn < startimes.size()) + { + lastime = startimes[graphn]; + } + else + { + lastime = startimes[startimes.size() - 1]; + done = true; + } + + } + + //Open File we are going to save to, constant for the moment. + + ofstream gfile; + gfile.open("GViz.dot"); + + + gfile << "strict digraph graph" << graphn << " {\n"; + + if(graphn == 0) + { + planner->print_graph(gfile, graphmap); + for (CLSet::iterator cl_iter = plan.causal_links.begin (); + cl_iter != plan.causal_links.end (); + cl_iter++) + { + CausalLink clink = *cl_iter; + //this->out_ << "Build Graph from links.." << std::endl; + gfile << "\t" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << "[shape=box];\n"; + gfile << "\t" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " -> "; + gfile << planner->get_cond_name (clink.cond.id) << ";\n"; + gfile << "\t" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << "[shape=box];\n"; + gfile << "\t" << planner->get_cond_name (clink.cond.id) << " -> "; + gfile << planner->get_task_name ( + planner->get_task_from_inst (clink.second)) << "\n"; + } + } + else if(graphn == 1) + { + planner->print_graph(gfile, graphmap); + for (CLSet::iterator cl_iter = plan.causal_links.begin (); + cl_iter != plan.causal_links.end (); + cl_iter++) + { + CausalLink clink = *cl_iter; + //this->out_ << "Build Graph from links.." << std::endl; + + if(planner->get_start_window (clink.first).first <= lastime) + { + if(planner->get_start_window (clink.first).first == lastime && !done) + { + std::map<std::string, std::string>::iterator citer = graphmap.find(planner->get_task_name (planner->get_task_from_inst (clink.first))); + if(citer != graphmap.end()) + { + (*citer).second = "green"; + } + citer = graphmap.find(planner->get_cond_name (clink.cond.id)); + if(citer != graphmap.end()) + { + (*citer).second = "green"; + } + gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << "[shape=box, color= green];\n"; + gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << " [shape=box, style=filled ,color = orange];\n"; + gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << " -> "; + gfile << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << ";\n"; + } + else + { + std::map<std::string, std::string>::iterator citer = graphmap.find(planner->get_task_name (planner->get_task_from_inst (clink.first))); + if(citer != graphmap.end()) + { + (*citer).second = "blue"; + } + citer = graphmap.find(planner->get_cond_name (clink.cond.id)); + if(citer != graphmap.end()) + { + (*citer).second = "blue"; + } + gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << "[shape=box, color= turquoise1];\n"; + gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[style=filled, color = turquoise1];\n"; + gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << " -> "; + gfile << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << ";\n"; + } + + if(planner->get_start_window (clink.second).first <= lastime) + { + if(planner->get_start_window (clink.second).first == lastime && !done) + { + gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << "[shape=box, color = green];\n"; + //gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[color = green];\n"; + gfile << "\t" << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << " -> "; + gfile << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << ";\n"; + } + else + { + gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << "[shape=box, color = turquoise1];\n"; + gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[color = turquoise1];\n"; + gfile << "\t" << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << " -> "; + gfile << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << ";\n"; + + } + } + } + } + } + else + { + for (CLSet::iterator cl_iter = plan.causal_links.begin (); + cl_iter != plan.causal_links.end (); + cl_iter++) + { + CausalLink clink = *cl_iter; + //this->out_ << "Build Graph from links.." << std::endl; + + if(planner->get_start_window (clink.first).first <= lastime) + { + if(planner->get_start_window (clink.first).first == lastime && !done) + { + std::map<std::string, std::string>::iterator citer = graphmap.find(planner->get_task_name (planner->get_task_from_inst (clink.first))); + if(citer != graphmap.end()) + { + (*citer).second = "green"; + } + citer = graphmap.find(planner->get_cond_name (clink.cond.id)); + if(citer != graphmap.end()) + { + (*citer).second = "green"; + } + gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << "[shape=box, style=filled ,color= green];\n"; + gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[ style=filled , color = orange];\n"; + gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << " -> "; + gfile << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << ";\n"; + } + else + { + std::map<std::string, std::string>::iterator citer = graphmap.find(planner->get_task_name (planner->get_task_from_inst (clink.first))); + if(citer != graphmap.end()) + { + (*citer).second = "blue"; + } + citer = graphmap.find(planner->get_cond_name (clink.cond.id)); + if(citer != graphmap.end()) + { + (*citer).second = "blue"; + } + gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << "[shape=box, style=filled ,color= turquoise1];\n"; + gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[ style=filled ,color = turquoise1];\n"; + gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << " -> "; + gfile << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << ";\n"; + } + + if(planner->get_start_window (clink.second).first <= lastime) + { + if(planner->get_start_window (clink.second).first == lastime && !done) + { + gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << "[shape=box, style=filled , color = green];\n"; + //gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[color = green];\n"; + gfile << "\t" << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << " -> "; + gfile << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << ";\n"; + } + else + { + gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << "[shape=box, style=filled , color = turquoise1];\n"; + gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[style=filled , color = turquoise1];\n"; + gfile << "\t" << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << " -> "; + gfile << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << ";\n"; + + } + } + } + } + } + + + if(hasTracks) + { + for(int i = 0; i < tracks.size(); i++) + { + SANet::CondID ccid = tracks[i]; + double prob = planner->get_cond_val(ccid); + if(prob == 1) + { + gfile << "\t\"" << planner->get_cond_name (ccid) << " " << ccid << "\" " << "[color = green];\n"; + } + else + { + gfile << "\t\"" << planner->get_cond_name (ccid) << " " << ccid << "\" " << "[color = red];\n"; + } + } + } + if(done) + { + SA_POP::GoalMap curgoals = planner->get_goals(); + SA_POP::GoalMap::iterator giter; + for(giter = curgoals.begin(); giter != curgoals.end(); giter++) + { + + gfile << "\t\"" << planner->get_cond_name (giter->first) << " " << giter->first << "\" " << "[color = green];\n"; + } + } + gfile << "}\n"; + + gfile.close(); + this->out_ << std::endl; + + //Regardless, we turn it into a gif and display it Now with Threading. + unsigned long dwThreadId; + // Create a new thread. + char *imageName = "step.gif"; + HANDLE hThread = CreateThread(NULL, 0, SecondThread, (PVOID) imageName, + 0, &dwThreadId); + CloseHandle(hThread); + //system("dot -Tgif GViz.dot -o step.gif"); + //system("step.gif"); + + for (SchedLinkSet::iterator sched_iter = plan.sched_links.begin (); + sched_iter != plan.sched_links.end (); + sched_iter++) + { + SchedLink sched_link = (*sched_iter); + this->out_ << "Scheduling Link:" << std::endl; + this->out_ << " " << sched_link.first << " ("; + this->out_ << planner->get_task_name ( + planner->get_task_from_inst (sched_link.first)) << ") -> "; + this->out_ << sched_link.second << " ("; + this->out_ << planner->get_task_name ( + planner->get_task_from_inst (sched_link.second)) << ")" << std::endl; + + } + + + this->out_ << std::endl; +}; + + +void LogGraphOut::moveStep() +{ + graphn++; +}; + +void LogGraphOut::resetStep() +{ + graphn = 1; +};
\ No newline at end of file diff --git a/SA_POP/LogGraphOut.h b/SA_POP/LogGraphOut.h new file mode 100644 index 00000000000..900c50c1be8 --- /dev/null +++ b/SA_POP/LogGraphOut.h @@ -0,0 +1,86 @@ +// -*- C++ -*- +// + +//============================================================================= +/** + * @file LogGraphOut.h + * + * This file contains the Class Description for LogGraph which is an output adapater + * that creates graphic visualizations of the output plan. + * + * @author Daniel L.C. Mack <daniel.l.mack@vanderbilt.edu> + */ +//============================================================================= + +#ifndef SA_POP_LOG_GRAPH_OUT_H_ +#define SA_POP_LOG_GRAPH_OUT_H_ + +#include <iostream> +#include <map> +#include <vector> +#include "OutAdapter.h" +#include "SA_POP_Types.h" +#include "SANet/SANetFileIn.h" +#include "LogGraphOut_Export.h" + +namespace SA_POP { + + /** + * @class LogGraphOut + * + * @brief Output adapter that creates a graph visualization of the plan + * as they occur. + */ + class LOGGRAPHOUT_Export LogGraphOut : public OutAdapter { + public: + /// Constructor. + /** + * @param strm Output stream to log to. + */ + LogGraphOut (std::ostream &out, int startStep); + + /// Destructor. + virtual ~LogGraphOut (void); + + /// Notify about task future expected utility changes. + /** + * @param planner Planner for which changes have occurred. + */ + virtual void notify_eu (SA_POP::Planner *planner); + + /// Notify about plan changes. + /** + * @param planner Planner for which changes have occurred. + */ + virtual void notify_plan (SA_POP::Planner *planner); + + /// Advance the drawing by one step in the plan + /** + * + */ + void moveStep(); + + /// Go Back to the Beginning + /** + * + */ + void resetStep(); + + ///Add tracking to the adapter + /** + * + */ + void addTracking(std::vector<SANet::CondID> checks); + + protected: + /// Output stream to log to. + std::ostream &out_; + int graphn; + bool hasTracks; + std::map<std::string, std::string> graphmap; + std::vector<SANet::CondID> tracks; + }; + +}; /* SA_POP namespace */ + +#endif /* SA_POP_LOG_GRAPH_OUT_H_ */ diff --git a/SA_POP/LogGraphOut_Export.h b/SA_POP/LogGraphOut_Export.h new file mode 100644 index 00000000000..2e476528e72 --- /dev/null +++ b/SA_POP/LogGraphOut_Export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl LOGGRAPHOUT +// ------------------------------ +#ifndef LOGGRAPHOUT_EXPORT_H +#define LOGGRAPHOUT_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (LOGGRAPHOUT_HAS_DLL) +# define LOGGRAPHOUT_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && LOGGRAPHOUT_HAS_DLL */ + +#if !defined (LOGGRAPHOUT_HAS_DLL) +# define LOGGRAPHOUT_HAS_DLL 1 +#endif /* ! LOGGRAPHOUT_HAS_DLL */ + +#if defined (LOGGRAPHOUT_HAS_DLL) && (LOGGRAPHOUT_HAS_DLL == 1) +# if defined (LOGGRAPHOUT_BUILD_DLL) +# define LOGGRAPHOUT_Export ACE_Proper_Export_Flag +# define LOGGRAPHOUT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define LOGGRAPHOUT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* LOGGRAPHOUT_BUILD_DLL */ +# define LOGGRAPHOUT_Export ACE_Proper_Import_Flag +# define LOGGRAPHOUT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define LOGGRAPHOUT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* LOGGRAPHOUT_BUILD_DLL */ +#else /* LOGGRAPHOUT_HAS_DLL == 1 */ +# define LOGGRAPHOUT_Export +# define LOGGRAPHOUT_SINGLETON_DECLARATION(T) +# define LOGGRAPHOUT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* LOGGRAPHOUT_HAS_DLL == 1 */ + +// Set LOGGRAPHOUT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (LOGGRAPHOUT_NTRACE) +# if (ACE_NTRACE == 1) +# define LOGGRAPHOUT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define LOGGRAPHOUT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !LOGGRAPHOUT_NTRACE */ + +#if (LOGGRAPHOUT_NTRACE == 1) +# define LOGGRAPHOUT_TRACE(X) +#else /* (LOGGRAPHOUT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define LOGGRAPHOUT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (LOGGRAPHOUT_NTRACE == 1) */ + +#endif /* LOGGRAPHOUT_EXPORT_H */ + +// End of auto generated file. diff --git a/SA_POP/Planner.cpp b/SA_POP/Planner.cpp index 56552fbe0e6..d110a22ac9f 100644 --- a/SA_POP/Planner.cpp +++ b/SA_POP/Planner.cpp @@ -15,6 +15,7 @@ #include <string> #include <set> +#include <map> #include <stdlib.h> #include <fstream> #include "SA_POP_Types.h" @@ -530,9 +531,9 @@ TaskImplID Planner::get_impl_id (TaskInstID task_inst) } -void Planner::print_graph (std::basic_ostream<char, std::char_traits<char> >& strm) +void Planner::print_graph (std::basic_ostream<char, std::char_traits<char> >& strm, std::map<std::string, std::string>& graphmap) { - this->sanet_->print_graphviz(strm); + this->sanet_->print_graphviz(strm, graphmap); } diff --git a/SA_POP/Planner.h b/SA_POP/Planner.h index ef85438a7d3..1c6cbc8ae3f 100644 --- a/SA_POP/Planner.h +++ b/SA_POP/Planner.h @@ -19,6 +19,7 @@ #include <string> #include <set> +#include <map> #include "SA_POP_Types.h" #include "PlanStrategy.h" #include "SchedStrategy.h" @@ -506,7 +507,7 @@ namespace SA_POP { * * @return nothing */ - virtual void print_graph (std::basic_ostream<char, std::char_traits<char> >& strm); + virtual void print_graph (std::basic_ostream<char, std::char_traits<char> >& strm, std::map<std::string, std::string>& graphmap); protected: diff --git a/SA_POP/SANet/SANet.cpp b/SA_POP/SANet/SANet.cpp index a12798318f4..d87268acbc1 100644 --- a/SA_POP/SANet/SANet.cpp +++ b/SA_POP/SANet/SANet.cpp @@ -181,18 +181,52 @@ void SANet::Network::update_effect_link(TaskID task_ID, CondID cond_ID, }; -void SANet::Network::print_graphviz(std::basic_ostream<char, std::char_traits<char> >& strm) +void SANet::Network::print_graphviz(std::basic_ostream<char, std::char_traits<char> >& strm, std::map<std::string, std::string>& graphmap) { for (TaskNodeMap::iterator node_iter = task_nodes_.begin (); node_iter != task_nodes_.end (); node_iter++) { - strm << "\t" << "\"" << node_iter->second->get_name() << " " << node_iter->first << "\" " << "[shape=box, color = grey];\n"; + std::map<std::string, std::string>::iterator titer = graphmap.find(node_iter->second->get_name()); + if(titer != graphmap.end()) + { + if((*titer).second == "blue" ) + { + (*titer).second = "cornflowerblue"; + + } + else if((*titer).second == "green") + { + (*titer).second = "red"; + } + } + else + { + graphmap[node_iter->second->get_name()] = "grey"; + } + strm << "\t" << "\"" << node_iter->second->get_name() << " " << node_iter->first << "\" " << "[shape=box, style=filled, color = " << graphmap[node_iter->second->get_name()] <<"];\n"; } for (CondNodeMap::iterator node_iter = cond_nodes_.begin (); node_iter != cond_nodes_.end (); node_iter++) { - strm << "\t" << "\"" << node_iter->second->get_name() << " " << node_iter->first << "\" " << "[color = grey];\n"; + std::map<std::string, std::string>::iterator citer = graphmap.find(node_iter->second->get_name()); + if(citer != graphmap.end()) + { + if((*citer).second == "blue" ) + { + (*citer).second = "cornflowerblue"; + + } + else if((*citer).second == "green") + { + (*citer).second = "red"; + } + } + else + { + graphmap[node_iter->second->get_name()] = "grey"; + } + strm << "\t" << "\"" << node_iter->second->get_name() << " " << node_iter->first << "\" " << "[style=filled, color = " << graphmap[node_iter->second->get_name()] << "];\n"; } for (TaskNodeMap::iterator node_iter = task_nodes_.begin (); diff --git a/SA_POP/SANet/SANet.h b/SA_POP/SANet/SANet.h index 35d48c6bb59..d4dc6baba88 100644 --- a/SA_POP/SANet/SANet.h +++ b/SA_POP/SANet/SANet.h @@ -153,7 +153,7 @@ namespace SANet { /** * @param strm Output stream on which to print network representation. */ - virtual void print_graphviz (std::basic_ostream<char, std::char_traits<char> >& strm); + virtual void print_graphviz (std::basic_ostream<char, std::char_traits<char> >& strm, std::map<std::string, std::string>& graphmap); diff --git a/SA_POP/SAPOP_w_ACE.mpc b/SA_POP/SAPOP_w_ACE.mpc index df6755ecfc6..96261606c43 100644 --- a/SA_POP/SAPOP_w_ACE.mpc +++ b/SA_POP/SAPOP_w_ACE.mpc @@ -23,7 +23,8 @@ project(SA_POP) : xerces, acelib { SANETFILEIN_BUILD_DLL \ TASKMAPFILEIN_BUILD_DLL \ SA_BUILDER_BUILD_DLL \ - LOGSCREENOUT_BUILD_DLL + LOGSCREENOUT_BUILD_DLL \ + LOGGRAPHOUT_BUILD_DLL libs += SAPOP_XML_Utils @@ -59,6 +60,7 @@ project(SA_POP) : xerces, acelib { OutAdapter.h LogScreenOut.h LogFileOut.h + LogGraphOut.h SANet/SANetFileIn.h TaskMapFileIn.h @@ -86,6 +88,7 @@ project(SA_POP) : xerces, acelib { LogScreenOut.cpp LogFileOut.cpp + LogGraphOut.cpp SANet/SANetFileIn.cpp SANet/XML_SANet.cpp |