|
From: <mar...@us...> - 2010-03-11 15:24:02
|
Revision: 687
http://scstudio.svn.sourceforge.net/scstudio/?rev=687&view=rev
Author: martinnrt
Date: 2010-03-11 15:23:54 +0000 (Thu, 11 Mar 2010)
Log Message:
-----------
add 2 files | traverse_erase - removes constraints in all hmsc | changed find_block_test, to be able to test new added files
Modified Paths:
--------------
trunk/src/check/time/CMakeLists.txt
trunk/src/check/time/hmsc_block_paths.cpp
trunk/tests/find_block_test.cpp
Added Paths:
-----------
trunk/src/check/time/traverse_erase.cpp
trunk/src/check/time/traverse_erase.h
Modified: trunk/src/check/time/CMakeLists.txt
===================================================================
--- trunk/src/check/time/CMakeLists.txt 2010-03-11 15:08:00 UTC (rev 686)
+++ trunk/src/check/time/CMakeLists.txt 2010-03-11 15:23:54 UTC (rev 687)
@@ -16,6 +16,8 @@
find_block.h
hmsc_block_paths.h
hmsc_block_paths.cpp
+ traverse_erase.h
+ traverse_erase.cpp
)
TARGET_LINK_LIBRARIES(sctime
Modified: trunk/src/check/time/hmsc_block_paths.cpp
===================================================================
--- trunk/src/check/time/hmsc_block_paths.cpp 2010-03-11 15:08:00 UTC (rev 686)
+++ trunk/src/check/time/hmsc_block_paths.cpp 2010-03-11 15:23:54 UTC (rev 687)
@@ -24,7 +24,6 @@
allpaths.add_path_found_listener(l);
allpaths.traverse();
m_last.clear();
- std::cout << "dojdeme na koniec aspon" << std::endl;
//don't know exatly what is result of allpaths.traverse() -- maybe list of path found listener??
}
}
Added: trunk/src/check/time/traverse_erase.cpp
===================================================================
--- trunk/src/check/time/traverse_erase.cpp (rev 0)
+++ trunk/src/check/time/traverse_erase.cpp 2010-03-11 15:23:54 UTC (rev 687)
@@ -0,0 +1,61 @@
+#include "check/time/traverse_erase.h"
+
+
+void TraverseErase::on_white_node_found(HMscNode* n)
+{
+ ReferenceNode* v= dynamic_cast<ReferenceNode*>(n);
+ if (v!=NULL)
+ {
+ erase_hmsc_constraints(v);
+ BMscPtr bmsc= v->get_bmsc();
+ if (bmsc!=NULL)
+ {
+ traverse_erase_bmsc(bmsc);
+ }
+ }
+}
+
+void TraverseErase::erase_hmsc_constraints(ReferenceNode* n)
+{
+ TimeRelationRefNodePtrSet node_constraints_bottom;
+ TimeRelationRefNodePtrSet node_constraints_top;
+ node_constraints_top.insert(n->get_time_relations_top().begin(), n->get_time_relations_top().end()); //fill with contraints in node v
+ node_constraints_bottom.insert(n->get_time_relations_bottom().begin(), n->get_time_relations_bottom().end()); //fill with contraints in node v
+ for (std::set<TimeRelationRefNodePtr>::iterator it = node_constraints_bottom.begin(); it != node_constraints_bottom.end(); it++) //iterate node constraints
+ {
+ n->remove_time_relation_bottom(*it);
+ }
+ for (std::set<TimeRelationRefNodePtr>::iterator it = node_constraints_top.begin(); it != node_constraints_top.end(); it++) //iterate node constraints
+ {
+ n->remove_time_relation_top(*it);
+ }
+
+std::cout << "Tu vymazane hmsc cons" << std::endl;
+ //erase top and bottom contraints
+}
+
+void TraverseErase::traverse_erase_bmsc(BMscPtr bmsc)
+{
+ DFSEventsTraverser* trav_bmsc_erase= new DFSEventsTraverser();
+ BmscTraverseErase* my_bmsc_trav= new BmscTraverseErase();
+ trav_bmsc_erase->add_white_event_found_listener(my_bmsc_trav);
+ trav_bmsc_erase->traverse(bmsc);
+}
+
+void BmscTraverseErase::on_white_event_found(Event* e)
+{
+ erase_bmsc_constraints(e);
+}
+
+void BmscTraverseErase::erase_bmsc_constraints(Event* e)
+{
+ e->clear_time_relations();
+ std::cout << "Tu vymazane bmsc cons" << std::endl;
+}
+
+
+
+
+
+
+
Added: trunk/src/check/time/traverse_erase.h
===================================================================
--- trunk/src/check/time/traverse_erase.h (rev 0)
+++ trunk/src/check/time/traverse_erase.h 2010-03-11 15:23:54 UTC (rev 687)
@@ -0,0 +1,50 @@
+
+#include "data/dfs_bmsc_graph_traverser.h" //hmsc traverser
+#include "data/dfs_events_traverser.h"
+#include "export.h"
+
+
+class SCTIME_EXPORT TraverseErase: public WhiteNodeFoundListener
+{
+public:
+ TraverseErase()
+ {}
+ virtual ~TraverseErase()
+ {}
+
+ virtual void on_white_node_found(HMscNode* n);
+ void erase_hmsc_constraints(ReferenceNode* n);
+ void traverse_erase_bmsc(BMscPtr bmsc);
+};
+
+class SCMSC_EXPORT BmscTraverseErase:public WhiteEventFoundListener//dfs event traverser
+{
+public:
+ BmscTraverseErase()
+ {}
+ virtual ~BmscTraverseErase()
+ {}
+
+ virtual void on_white_event_found(Event* e);
+ void erase_bmsc_constraints(Event* e);
+};
+
+class EraseAllConstraints
+{
+public:
+ EraseAllConstraints()
+ {}
+
+ void erase_all_constraints(HMscPtr hmsc)
+ {
+ DFSBMscGraphTraverser* trav_erase= new DFSBMscGraphTraverser();
+ TraverseErase* my_trav= new TraverseErase();
+ trav_erase->add_white_node_found_listener(my_trav);
+ trav_erase->traverse(hmsc);
+ }
+};
+
+
+
+
+
Modified: trunk/tests/find_block_test.cpp
===================================================================
--- trunk/tests/find_block_test.cpp 2010-03-11 15:08:00 UTC (rev 686)
+++ trunk/tests/find_block_test.cpp 2010-03-11 15:23:54 UTC (rev 687)
@@ -2,6 +2,7 @@
#include "data/msc.h"
#include "check/time/find_block.h"
+#include "check/time/traverse_erase.h"
#include "check/time/tightening.h"
#include "check/time/hmsc_block_paths.h"
#include "check/liveness/deadlock_checker.h"
@@ -75,9 +76,20 @@
{
std::cout << "Blok:" << (*it).get_number() << " if_end:" << (*it).get_if_end() << std::endl;
}
- AllPathsAllBlocks* apab= new AllPathsAllBlocks(trav_mark->m_list_of_blocks, h1);
- apab->all_paths_all_blocks();
+// AllPathsAllBlocks* apab= new AllPathsAllBlocks(trav_mark->m_list_of_blocks, h1);
+// apab->all_paths_all_blocks();
+
+
+
+
+
+
+
+ EraseAllConstraints* eac= new EraseAllConstraints();
+ eac->erase_all_constraints(h1);
+
+
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|