|
From: <mbe...@us...> - 2010-07-07 20:36:55
|
Revision: 828
http://scstudio.svn.sourceforge.net/scstudio/?rev=828&view=rev
Author: mbezdeka
Date: 2010-07-07 20:36:49 +0000 (Wed, 07 Jul 2010)
Log Message:
-----------
Message numbering:
- some changes in help
- fixed conflict with message sequence
Message snapping:
- add GUI to dialog Settings
Modified Paths:
--------------
trunk/doc/help/frontend/message-numbering.html
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/addon.h
trunk/src/view/visio/addon/dllmodule.rc
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/globalSettingsDlg.cpp
trunk/src/view/visio/addon/globalSettingsDlg.h
trunk/src/view/visio/addon/resource.h
trunk/src/view/visio/addon/scstudio.vcproj
Added Paths:
-----------
trunk/src/view/visio/addon/snapGlobalDlg.cpp
trunk/src/view/visio/addon/snapGlobalDlg.h
Modified: trunk/doc/help/frontend/message-numbering.html
===================================================================
--- trunk/doc/help/frontend/message-numbering.html 2010-07-06 19:26:23 UTC (rev 827)
+++ trunk/doc/help/frontend/message-numbering.html 2010-07-07 20:36:49 UTC (rev 828)
@@ -2,25 +2,25 @@
<html>
<head>
<title>Message Numbering – SCStudio frontend</title>
-<link href="../help.css" rel="stylesheet" type="text/css"/>
+<link href="../help.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1>Message Numbering</h1>
-<p>Message numbering allows users to enumerate all types of message shapes (left, right, lost, found).<br/>
-You can enumerate all messages on the active page (if no messages are selected) or the selection.<br/>
+<p>Message numbering allows users to enumerate all types of message shapes (left, right, lost, found).<br>
+You can enumerate all messages on the active page (if no messages are selected) or the selection.<br>
</p>
<h2>Enable message numbering</h2>
-<p>By pressing Message numbering button <img src="pictures/icon_message_enumeration.png" alt="Message Numbering" />, via menu <code>Check->Drawing->Message numbering->Message numbering</code> or by using hotkey <Code>Ctrl+Alt+E</Code> the dialog with options will be shown:</p>
+<p>By pressing Message numbering button <img src="pictures/icon_message_enumeration.png" alt="Message Numbering">, via menu <code>Check->Drawing->Message numbering->Message numbering</code> or by using hotkey <Code>Ctrl+Alt+E</Code> the dialog with options will be shown:</p>
<p>
-<img src="pictures/message_numbering_options.png" alt="Message Numbering options dialog"/>
+<img src="pictures/message_numbering_options.png" alt="Message Numbering options dialog">
</p>
-<p>You can choose:<br/>
-- specific numbering type (numbers, letters, capital letters, romans)<br/>
-- starting index (1-9999 for number, letters and capital letters and 1-3999 for romans)<br/>
-- and additional string following the index such as ".", "-", … (max 4 chars). A space between the index and the message label is added automatically.<br/>
+<p>You can choose:<br>
+- specific numbering type (numbers, letters, capital letters, romans)<br>
+- starting index (1-9999 for number, letters and capital letters and 1-3999 for romans)<br>
+- and additional string following the index such as ".", "-", … (max 4 chars). A space between the index and the message label is added automatically.<br>
</p>
<p>
@@ -40,31 +40,31 @@
<p>When a group of messages is numbered, user can select it by right-click on any of numbered messages from group and choose <code>Select numbering group</code> from context menu. Example is shown in the following picture:</p>
<p>
-<img src="pictures/select_numbering_group.png" alt="Select numbering group" />
+<img src="pictures/select_numbering_group.png" alt="Select numbering group">
</p>
<h2>Auto numbering</h2>
<p>New messages can be automatically numbered after they are dropped on the page. Specific behavior can be set via menu <code>Check->Drawing->Settings</code>, tab Numbering. Following dialog will be shown:</p>
<p>
-<img src="pictures/message_numbering_autoenum_options.png" alt="Auto numbering options" />
+<img src="pictures/message_numbering_autoenum_options.png" alt="Auto numbering options">
</p>
<p>
-Options are:<br />
-<p/>
+Options are:<br>
+</p>
<p>
-<code>automatic numbering new messages</code><br />
- - sets whether auto numbering is enabled, otherwise all other options are disabled.<br /><br />
-<code>as nearest message</code><br />
- - new messages will be numbered according to the group of the closest message on the active page. All message indexes in the current group will be recounted. If the closest message isn't numbered, new one won't be either. <br />
-<code>as nearest numbered message</code><br />
- - new messages will be numbered according to the closest <b>numbered</b> message on the active page. If there are no numbered messages on the active page you can choose between: <br /><br />
- <code>don't number</code><br />
- - don't number new messages if there are no numbered messages on the page.<br />
- <code>use numbering style</code><br />
- - use specific numbering style if there are no numbered messages on the page.<br />
+<code>automatic numbering new messages</code><br>
+ - sets whether auto numbering is enabled, otherwise all other options are disabled.<br><br>
+<code>as nearest message</code><br>
+ - new messages will be numbered according to the group of the closest message on the active page. All message indexes in the current group will be recounted. If the closest message isn't numbered, new one won't be either. <br>
+<code>as nearest numbered message</code><br>
+ - new messages will be numbered according to the closest <b>numbered</b> message on the active page. If there are no numbered messages on the active page you can choose between: <br><br>
+ <code>don't number</code><br>
+ - don't number new messages if there are no numbered messages on the page.<br>
+ <code>use numbering style</code><br>
+ - use specific numbering style if there are no numbered messages on the page.<br>
</p>
</body>
</html>
\ No newline at end of file
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2010-07-06 19:26:23 UTC (rev 827)
+++ trunk/src/view/visio/addon/addon.cpp 2010-07-07 20:36:49 UTC (rev 828)
@@ -661,20 +661,23 @@
docMon->drawNumbers(shapesPtr,*it);
m_enumerationGroups.clear();
-
- //Check whether there are still some numbered messages, otherwise erase enum info
- bool bNumberedMsg = false;
- for(int i=1; i<=vsoApp->ActivePage->Shapes->Count; i++)
+
+ if(m_bShapeDeleted)
{
- Visio::IVShapePtr shape = vsoApp->ActivePage->Shapes->Item[i];
- if(docMon->isMessageShape(shape) && _tcsicmp(shape->Data1,_T("1")) == 0)
+ //Check whether there are still some numbered messages, otherwise erase enum info
+ bool bNumberedMsg = false;
+ for(int i=1; i<=vsoApp->ActivePage->Shapes->Count; i++)
{
- bNumberedMsg = true;
- break;
+ Visio::IVShapePtr shape = vsoApp->ActivePage->Shapes->Item[i];
+ if(docMon->isMessageShape(shape) && _tcsicmp(shape->Data1,_T("1")) == 0)
+ {
+ bNumberedMsg = true;
+ break;
+ }
}
+ if(!bNumberedMsg)
+ CEnumerateUtils::eraseEnumInfo(vsoApp);
}
- if(!bNumberedMsg)
- CEnumerateUtils::eraseEnumInfo(vsoApp);
//Set variables to false to prevent this function from loop
m_bShapeDeleted = m_bCellChanged = false;
Modified: trunk/src/view/visio/addon/addon.h
===================================================================
--- trunk/src/view/visio/addon/addon.h 2010-07-06 19:26:23 UTC (rev 827)
+++ trunk/src/view/visio/addon/addon.h 2010-07-07 20:36:49 UTC (rev 828)
@@ -134,6 +134,7 @@
bool m_bMessageTextEdited;
bool m_bCellChanged;
bool m_bShapeDeleted;
+
std::set<_bstr_t> m_enumerationGroups;
std::map<long, double> m_prevMousePosY;
};
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2010-07-06 19:26:23 UTC (rev 827)
+++ trunk/src/view/visio/addon/dllmodule.rc 2010-07-07 20:36:49 UTC (rev 828)
@@ -224,7 +224,15 @@
GROUPBOX "If no nearest (numbered) message found:",IDC_STATIC,7,65,261,54,WS_GROUP
END
+IDD_SNAP_GLOBAL DIALOGEX 0, 0, 200, 98
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Dialog"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ CONTROL "Enable message snapping",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,98,10
+END
+
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
@@ -289,6 +297,14 @@
TOPMARGIN, 7
BOTTOMMARGIN, 119
END
+
+ IDD_SNAP_GLOBAL, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 193
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 91
+ END
END
#endif // APSTUDIO_INVOKED
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-07-06 19:26:23 UTC (rev 827)
+++ trunk/src/view/visio/addon/document.cpp 2010-07-07 20:36:49 UTC (rev 828)
@@ -1327,6 +1327,7 @@
Visio::IVPagePtr page = from->Application->ActivePage;
Visio::IVShapePtr vsoMsg = page->Drop(msgMaster, 0, 0);
vsoMsg->Text = caption;
+ vsoMsg->Data2 = caption; //NOTE: fixes bad captions when using auto message numbering
Visio::IVShapePtr fromShape = (fromCoregion == NULL ? from : fromCoregion);
Visio::IVShapePtr toShape = (toCoregion == NULL ? to : toCoregion);
Modified: trunk/src/view/visio/addon/globalSettingsDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/globalSettingsDlg.cpp 2010-07-06 19:26:23 UTC (rev 827)
+++ trunk/src/view/visio/addon/globalSettingsDlg.cpp 2010-07-07 20:36:49 UTC (rev 828)
@@ -23,13 +23,14 @@
CGlobalSettingsDlg::CGlobalSettingsDlg(ATL::_U_STRINGorID title,UINT uStartPage, HWND hWndParent):
CPropertySheetImpl<CGlobalSettingsDlg>(title,uStartPage,hWndParent)
{
- m_bCentered = false;
-
- //Disable APPLY button and CONTEXT HELP button
- m_psh.dwFlags |= PSH_NOAPPLYNOW | PSH_NOCONTEXTHELP;
+ m_bCentered = false;
- //Adding pages
- page1.SetTitle(_T("Numbering")); AddPage(page1);
+ //Disable APPLY button and CONTEXT HELP button
+ m_psh.dwFlags |= PSH_NOAPPLYNOW | PSH_NOCONTEXTHELP;
+
+ //Adding pages
+ page1.SetTitle(_T("Numbering")); AddPage(page1);
+ page2.SetTitle(_T("Snap && Glue")); AddPage(page2);
}
Modified: trunk/src/view/visio/addon/globalSettingsDlg.h
===================================================================
--- trunk/src/view/visio/addon/globalSettingsDlg.h 2010-07-06 19:26:23 UTC (rev 827)
+++ trunk/src/view/visio/addon/globalSettingsDlg.h 2010-07-07 20:36:49 UTC (rev 828)
@@ -21,27 +21,31 @@
#include <atldlgs.h>
#include <atlctrls.h>
#include <atlddx.h>
+
+//dialogs for tabs
#include "numberingGlobalDlg.h"
+#include "snapGlobalDlg.h"
class CGlobalSettingsDlg : public CPropertySheetImpl<CGlobalSettingsDlg>
{
public:
- CGlobalSettingsDlg(ATL::_U_STRINGorID title = (LPCTSTR) NULL,
- UINT uStartPage = 0, HWND hWndParent = NULL);
+ CGlobalSettingsDlg(ATL::_U_STRINGorID title = (LPCTSTR) NULL,
+ UINT uStartPage = 0, HWND hWndParent = NULL);
-BEGIN_MSG_MAP(CGlobalSettingsDlg)
- MSG_WM_SHOWWINDOW(OnShowWindow)
- CHAIN_MSG_MAP(CPropertySheetImpl<CGlobalSettingsDlg>)
-END_MSG_MAP()
+ BEGIN_MSG_MAP(CGlobalSettingsDlg)
+ MSG_WM_SHOWWINDOW(OnShowWindow)
+ CHAIN_MSG_MAP(CPropertySheetImpl<CGlobalSettingsDlg>)
+ END_MSG_MAP()
- //Message handlers
- void OnShowWindow(BOOL bShowing, int nReason);
+ //Message handlers
+ void OnShowWindow(BOOL bShowing, int nReason);
protected:
- bool m_bCentered;
+ bool m_bCentered;
- //Pages of property sheet
- CNumberingGlobalDlg page1;
+ //Pages of property sheet
+ CNumberingGlobalDlg page1;
+ CSnapGlobalDlg page2;
};
// $Id$
\ No newline at end of file
Modified: trunk/src/view/visio/addon/resource.h
===================================================================
--- trunk/src/view/visio/addon/resource.h 2010-07-06 19:26:23 UTC (rev 827)
+++ trunk/src/view/visio/addon/resource.h 2010-07-07 20:36:49 UTC (rev 828)
@@ -43,6 +43,8 @@
#define IDD_NUMBERING_GLOBAL 225
#define IDC_OPTIONS_SWITCH_BTN 226
#define IDC_OPTIONS_SWITCH_LBL 227
+#define IDD_DIALOG1 227
+#define IDD_SNAP_GLOBAL 227
#define IDC_OPTIONS_GROUP_BOX 228
#define IDC_IF_LBL1 229
#define IDC_IF_LBL2 230
@@ -106,7 +108,7 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 227
+#define _APS_NEXT_RESOURCE_VALUE 228
#define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 280
#define _APS_NEXT_SYMED_VALUE 105
Modified: trunk/src/view/visio/addon/scstudio.vcproj
===================================================================
--- trunk/src/view/visio/addon/scstudio.vcproj 2010-07-06 19:26:23 UTC (rev 827)
+++ trunk/src/view/visio/addon/scstudio.vcproj 2010-07-07 20:36:49 UTC (rev 828)
@@ -420,6 +420,14 @@
>
</File>
<File
+ RelativePath=".\snapGlobalDlg.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\snapGlobalDlg.h"
+ >
+ </File>
+ <File
RelativePath=".\stdafx.cpp"
>
<FileConfiguration
Added: trunk/src/view/visio/addon/snapGlobalDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/snapGlobalDlg.cpp (rev 0)
+++ trunk/src/view/visio/addon/snapGlobalDlg.cpp 2010-07-07 20:36:49 UTC (rev 828)
@@ -0,0 +1,32 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2010 Martin Bezdeka <mbe...@se...>
+ *
+ * $Id$
+ */
+
+#include "stdafx.h"
+#include "snapGlobalDlg.h"
+
+BOOL CSnapGlobalDlg::OnInitDialog(HWND hWndFocus, LPARAM lParam)
+{
+ return TRUE;
+}
+
+int CSnapGlobalDlg::OnApply()
+{
+ return PSNRET_NOERROR;
+}
+
+// $Id$
\ No newline at end of file
Property changes on: trunk/src/view/visio/addon/snapGlobalDlg.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/src/view/visio/addon/snapGlobalDlg.h
===================================================================
--- trunk/src/view/visio/addon/snapGlobalDlg.h (rev 0)
+++ trunk/src/view/visio/addon/snapGlobalDlg.h 2010-07-07 20:36:49 UTC (rev 828)
@@ -0,0 +1,54 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2010 Martin Bezdeka <mbe...@se...>
+ *
+ * $Id$
+ */
+
+#pragma once
+
+#include <atldlgs.h>
+#include <atlctrls.h>
+#include <atlddx.h>
+#include <atlcrack.h>
+#include <atlmisc.h>
+
+class CSnapGlobalDlg:
+ public CPropertyPageImpl<CSnapGlobalDlg>,
+ public CWinDataExchange<CSnapGlobalDlg>
+{
+public:
+ enum { IDD = IDD_SNAP_GLOBAL };
+
+ BEGIN_MSG_MAP(CSnapGlobalDlg)
+ MSG_WM_INITDIALOG(OnInitDialog)
+ CHAIN_MSG_MAP(CPropertyPageImpl<CSnapGlobalDlg>)
+ END_MSG_MAP()
+
+
+ BEGIN_DDX_MAP(CSnapGlobalDlg)
+ END_DDX_MAP()
+
+protected:
+
+public:
+ //Message handlers
+ BOOL OnInitDialog(HWND hWndFocus, LPARAM lParam);
+
+ //Property page notification handlers (override method)
+ int OnApply();
+
+};
+
+// $Id$
\ No newline at end of file
Property changes on: trunk/src/view/visio/addon/snapGlobalDlg.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mbe...@us...> - 2010-07-09 11:00:41
|
Revision: 829
http://scstudio.svn.sourceforge.net/scstudio/?rev=829&view=rev
Author: mbezdeka
Date: 2010-07-09 11:00:32 +0000 (Fri, 09 Jul 2010)
Log Message:
-----------
Message numbering:
- bugs fixed
- help image changed
Message snapping:
- added functionality
Modified Paths:
--------------
trunk/doc/help/frontend/pictures/message_numbering_autoenum_options.png
trunk/src/view/visio/addon/dllmodule.rc
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/document.h
trunk/src/view/visio/addon/numberingGlobalDlg.cpp
trunk/src/view/visio/addon/resource.h
trunk/src/view/visio/addon/scstudio.vcproj
trunk/src/view/visio/addon/shapeutils.h
trunk/src/view/visio/addon/snapGlobalDlg.cpp
trunk/src/view/visio/addon/snapGlobalDlg.h
trunk/src/view/visio/addon/stdafx.h
Modified: trunk/doc/help/frontend/pictures/message_numbering_autoenum_options.png
===================================================================
(Binary files differ)
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2010-07-07 20:36:49 UTC (rev 828)
+++ trunk/src/view/visio/addon/dllmodule.rc 2010-07-09 11:00:32 UTC (rev 829)
@@ -229,7 +229,7 @@
CAPTION "Dialog"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- CONTROL "Enable message snapping",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,98,10
+ CONTROL "Enable message snapping",IDC_SNAP_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,98,10
END
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-07-07 20:36:49 UTC (rev 828)
+++ trunk/src/view/visio/addon/document.cpp 2010-07-09 11:00:32 UTC (rev 829)
@@ -30,6 +30,8 @@
#include "enumerationDlg.h"
#include "GlobalSettingsDlg.h"
+#include "messageSnapping.h"
+
#include <fstream>
#include "data/msc.h"
@@ -260,7 +262,8 @@
case ST_BMSC_MESSAGE_FOUND:
if(vsoShape->Text.length() == 0)
vsoShape->Text = _T("NAME");
- autoEnumerate(vsoShape);
+ autoEnumerate(vsoShape);
+ autoSnapping(vsoShape);
break;
case ST_COMMENT:
@@ -1442,8 +1445,6 @@
long undo_id = vsoApp->BeginUndoScope("DeleteNumbering");
- //int ID = CEnumerateUtils::getGroupCount(vsoApp);
-
//get all NUMBERED messages on the page
int numberedMessages = 0;
for(int i=1; i<=page->Shapes->Count; i++)
@@ -2132,4 +2133,17 @@
return 0;
}
+void CDocumentMonitor::autoSnapping(Visio::IVShapePtr msgShape)
+{
+ //Step 1: Check whether snapping is enabled
+ if(!CMessageSnapping::isEnabled())
+ return;
+ //Step 2: Get all instance matching criteria
+ std::vector<Visio::IVShapePtr> instShapes = CMessageSnapping::getIntersectInstances(msgShape);
+ //Step 3: Get the closest instance on the left and on the right
+ std::pair<Visio::IVShapePtr,Visio::IVShapePtr> closestInst = CMessageSnapping::getClosestInstancePair(msgShape, instShapes);
+ //Step 4:Glue to them
+ CMessageSnapping::glueMsgToInstances(msgShape, closestInst.first, closestInst.second);
+}
+
// $Id$
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-07-07 20:36:49 UTC (rev 828)
+++ trunk/src/view/visio/addon/document.h 2010-07-09 11:00:32 UTC (rev 829)
@@ -25,9 +25,11 @@
#include "data/simulator.h"
#include "data/transformer.h"
#include "enums.h"
+
#include "pageutils.h"
#include "shapeutils.h"
#include "enumerateUtils.h"
+
#include "addon.h"
//! template used to create new documents
@@ -335,6 +337,10 @@
public:
Visio::IVUIObjectPtr GetMostCustomMenus();
Visio::IVUIObjectPtr GetMostCustomToolbars();
+
+
+// Message snapping
+ void autoSnapping(Visio::IVShapePtr msgShape);
};
// $Id$
Modified: trunk/src/view/visio/addon/numberingGlobalDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/numberingGlobalDlg.cpp 2010-07-07 20:36:49 UTC (rev 828)
+++ trunk/src/view/visio/addon/numberingGlobalDlg.cpp 2010-07-09 11:00:32 UTC (rev 829)
@@ -78,6 +78,12 @@
{
BOOL bResult = DoDataExchange(true);
+ if(!m_index.GetWindowTextLength())
+ {
+ MessageBox(_T("Starting index is empty!"), _T("Error"), MB_OK | MB_ICONERROR);
+ return 1;
+ }
+
BSTR temp = 0;
int index;
m_index.GetWindowText(temp);
Modified: trunk/src/view/visio/addon/resource.h
===================================================================
--- trunk/src/view/visio/addon/resource.h 2010-07-07 20:36:49 UTC (rev 828)
+++ trunk/src/view/visio/addon/resource.h 2010-07-09 11:00:32 UTC (rev 829)
@@ -103,6 +103,7 @@
#define IDC_ADDITION_GLOBAL 277
#define IDC_STARTING_INDEX_GLOBAL 278
#define IDC_CHECK1 279
+#define IDC_SNAP_ENABLED 279
// Next default values for new objects
//
Modified: trunk/src/view/visio/addon/scstudio.vcproj
===================================================================
--- trunk/src/view/visio/addon/scstudio.vcproj 2010-07-07 20:36:49 UTC (rev 828)
+++ trunk/src/view/visio/addon/scstudio.vcproj 2010-07-09 11:00:32 UTC (rev 829)
@@ -360,6 +360,10 @@
>
</File>
<File
+ RelativePath=".\messageSnapping.cpp"
+ >
+ </File>
+ <File
RelativePath=".\numberingGlobalDlg.cpp"
>
</File>
@@ -522,6 +526,10 @@
>
</File>
</Filter>
+ <File
+ RelativePath=".\messageSnapping.h"
+ >
+ </File>
</Files>
<Globals>
<Global
Modified: trunk/src/view/visio/addon/shapeutils.h
===================================================================
--- trunk/src/view/visio/addon/shapeutils.h 2010-07-07 20:36:49 UTC (rev 828)
+++ trunk/src/view/visio/addon/shapeutils.h 2010-07-09 11:00:32 UTC (rev 829)
@@ -34,6 +34,9 @@
static double GetShapeEndX(Visio::IVShapePtr shape) { return shape->CellsSRC[visSectionObject][visRowXForm1D][vis1DEndX]->Result[""]; }
static double GetShapeBeginY(Visio::IVShapePtr shape) { return shape->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginY]->Result[""]; }
static double GetShapeEndY(Visio::IVShapePtr shape) { return shape->CellsSRC[visSectionObject][visRowXForm1D][vis1DEndY]->Result[""]; }
+
+ static double GetShapeCellProperty(Visio::IVShapePtr shape, const _bstr_t & propertyName, const _bstr_t & units)
+ { return shape->Cells[propertyName]->Result[units]; }
static void GlueBeginToPos(Visio::IVShapePtr what, Visio::IVShapePtr where, const MscPoint& pos);
static void GlueBeginToShape(Visio::IVShapePtr what, Visio::IVShapePtr where);
Modified: trunk/src/view/visio/addon/snapGlobalDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/snapGlobalDlg.cpp 2010-07-07 20:36:49 UTC (rev 828)
+++ trunk/src/view/visio/addon/snapGlobalDlg.cpp 2010-07-09 11:00:32 UTC (rev 829)
@@ -18,15 +18,42 @@
#include "stdafx.h"
#include "snapGlobalDlg.h"
+#include "errors.h"
BOOL CSnapGlobalDlg::OnInitDialog(HWND hWndFocus, LPARAM lParam)
{
+ LoadRegistryData();
+
+ //Move values in variables into controls
+ DoDataExchange(FALSE);
+
return TRUE;
}
int CSnapGlobalDlg::OnApply()
{
+ //Move values in controls to variables
+ if(!DoDataExchange(TRUE))
+ return PSNRET_INVALID;
+
+ SaveRegistryData();
+
return PSNRET_NOERROR;
}
+int CSnapGlobalDlg::LoadRegistryData()
+{
+ TRACE(_T("CSnapGlobalDlg::LoadRegistryData() - Loading options from registry"));
+ m_bSnapEnabled = GetRegistry<bool>(GetRegistryFolder(), NULL, _T("SnapEnabled"), false);
+ return 0;
+}
+
+int CSnapGlobalDlg::SaveRegistryData()
+{
+ TRACE(_T("CSnapGlobalDlg::LoadRegistryData() - Saving options to registry"));
+ SetRegistry<bool>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("SnapEnabled"), m_bSnapEnabled);
+ return 0;
+}
+
+
// $Id$
\ No newline at end of file
Modified: trunk/src/view/visio/addon/snapGlobalDlg.h
===================================================================
--- trunk/src/view/visio/addon/snapGlobalDlg.h 2010-07-07 20:36:49 UTC (rev 828)
+++ trunk/src/view/visio/addon/snapGlobalDlg.h 2010-07-09 11:00:32 UTC (rev 829)
@@ -24,6 +24,9 @@
#include <atlcrack.h>
#include <atlmisc.h>
+// include macro definition for registry folder
+#include "dllmodule.h"
+
class CSnapGlobalDlg:
public CPropertyPageImpl<CSnapGlobalDlg>,
public CWinDataExchange<CSnapGlobalDlg>
@@ -31,6 +34,7 @@
public:
enum { IDD = IDD_SNAP_GLOBAL };
+protected:
BEGIN_MSG_MAP(CSnapGlobalDlg)
MSG_WM_INITDIALOG(OnInitDialog)
CHAIN_MSG_MAP(CPropertyPageImpl<CSnapGlobalDlg>)
@@ -38,10 +42,15 @@
BEGIN_DDX_MAP(CSnapGlobalDlg)
+ DDX_CHECK(IDC_SNAP_ENABLED, m_bSnapEnabled);
END_DDX_MAP()
-protected:
+ int LoadRegistryData();
+ int SaveRegistryData();
+ //Member variables
+ bool m_bSnapEnabled;
+
public:
//Message handlers
BOOL OnInitDialog(HWND hWndFocus, LPARAM lParam);
@@ -49,6 +58,9 @@
//Property page notification handlers (override method)
int OnApply();
+ //Registry folder
+ const wchar_t* GetRegistryFolder() { return SCSTUDIO_REGISTRY_ROOT _T("\\MessageSnapping"); }
+
};
// $Id$
\ No newline at end of file
Modified: trunk/src/view/visio/addon/stdafx.h
===================================================================
--- trunk/src/view/visio/addon/stdafx.h 2010-07-07 20:36:49 UTC (rev 828)
+++ trunk/src/view/visio/addon/stdafx.h 2010-07-09 11:00:32 UTC (rev 829)
@@ -42,6 +42,18 @@
#include <atlbase.h>
#include <atlapp.h>
+
+// adding common controls manifest to get XP look
+#if defined _M_IX86
+ #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#elif defined _M_IA64
+ #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#elif defined _M_X64
+ #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#else
+ #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#endif
+
// Import the Visio type library with named GUIDs for the type library entries.
// The namespace is "Visio".
#import "Visio.tlb" named_guids
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mbe...@us...> - 2010-07-11 22:04:26
|
Revision: 832
http://scstudio.svn.sourceforge.net/scstudio/?rev=832&view=rev
Author: mbezdeka
Date: 2010-07-11 22:04:20 +0000 (Sun, 11 Jul 2010)
Log Message:
-----------
Message snapping
- bugs fixed
- GUI improvements
- part of help added
Modified Paths:
--------------
trunk/doc/help/frontend.html
trunk/doc/help/scstudio.hhc
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/dllmodule.rc
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/messageSnapping.cpp
trunk/src/view/visio/addon/messageSnapping.h
trunk/src/view/visio/addon/resource.h
trunk/src/view/visio/addon/shapeutils.h
trunk/src/view/visio/addon/snapGlobalDlg.cpp
trunk/src/view/visio/addon/snapGlobalDlg.h
Added Paths:
-----------
trunk/doc/help/frontend/message-snapping.html
Added: trunk/doc/help/frontend/message-snapping.html
===================================================================
--- trunk/doc/help/frontend/message-snapping.html (rev 0)
+++ trunk/doc/help/frontend/message-snapping.html 2010-07-11 22:04:20 UTC (rev 832)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title>Message Snapping – SCStudio frontend</title>
+<link href="../help.css" rel="stylesheet" type="text/css">
+</head>
+<body>
+<h1>Message Snapping</h1>
+<p>When message is dropped onto drawing a user have to connect message to instances manually. If Message snapping is enabled, messages are automatically snapped to nearest instances when user release a mouse button.</p>
+
Modified: trunk/doc/help/frontend.html
===================================================================
--- trunk/doc/help/frontend.html 2010-07-09 11:20:45 UTC (rev 831)
+++ trunk/doc/help/frontend.html 2010-07-11 22:04:20 UTC (rev 832)
@@ -18,6 +18,7 @@
<li><a href="frontend/shape-selection.html">Shape selection</a></li>
<li><a href="frontend/automatic-drawing.html">Automatic drawing</a></li>
<li><a href="frontend/message-numbering.html">Message numbering</a></li>
+<li><a href="frontend/message-snapping.html">Message snapping</a></li>
</ul>
<p>Many SCStudio functions define their own keyboard accelerators.
Modified: trunk/doc/help/scstudio.hhc
===================================================================
--- trunk/doc/help/scstudio.hhc 2010-07-09 11:20:45 UTC (rev 831)
+++ trunk/doc/help/scstudio.hhc 2010-07-11 22:04:20 UTC (rev 832)
@@ -26,6 +26,10 @@
<param name="Local" value="frontend\message-numbering.html">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
+ <param name="Name" value="Message Snapping">
+ <param name="Local" value="frontend\message-snapping.html">
+ </OBJECT>
+ <LI> <OBJECT type="text/sitemap">
<param name="Name" value="Keyboard accelerators">
<param name="Local" value="frontend\shortcuts.html">
</OBJECT>
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2010-07-09 11:20:45 UTC (rev 831)
+++ trunk/src/view/visio/addon/addon.cpp 2010-07-11 22:04:20 UTC (rev 832)
@@ -498,7 +498,7 @@
break;
case visEvtApp+visEvtNonePending:
- TRACE("CStudioAddon::HandleVisioEvent() visEvtNonePending");
+ //TRACE("CStudioAddon::HandleVisioEvent() visEvtNonePending");
HandleNonePending(pSourceObj);
break;
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2010-07-09 11:20:45 UTC (rev 831)
+++ trunk/src/view/visio/addon/dllmodule.rc 2010-07-11 22:04:20 UTC (rev 832)
@@ -224,12 +224,21 @@
GROUPBOX "If no nearest (numbered) message found:",IDC_STATIC,7,65,261,54,WS_GROUP
END
-IDD_SNAP_GLOBAL DIALOGEX 0, 0, 200, 98
+IDD_SNAP_GLOBAL DIALOGEX 0, 0, 275, 118
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- CONTROL "Enable message snapping",IDC_SNAP_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,98,10
+ CONTROL "Enable snapping to instances for new messages",IDC_SNAP_ENABLED,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,169,10
+ GROUPBOX "General",IDC_STATIC,7,22,261,30
+ CONTROL "Adjust snapping only to instance's line",IDC_ONLY_ON_LINE,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,34,137,10
+ GROUPBOX "Message options",IDC_STATIC,7,58,261,34
+ COMBOBOX IDC_MSG_TYPE,13,71,94,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+ LTEXT "snap to ",IDC_STATIC,113,71,26,12,SS_CENTERIMAGE
+ CONTROL "left instace,",IDC_LEFT_INST_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,146,71,51,12
+ CONTROL "right instace",IDC_RIGHT_INST_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,205,71,54,12
END
@@ -301,9 +310,14 @@
IDD_SNAP_GLOBAL, DIALOG
BEGIN
LEFTMARGIN, 7
- RIGHTMARGIN, 193
+ RIGHTMARGIN, 268
+ VERTGUIDE, 13
TOPMARGIN, 7
- BOTTOMMARGIN, 91
+ BOTTOMMARGIN, 111
+ HORZGUIDE, 34
+ HORZGUIDE, 44
+ HORZGUIDE, 71
+ HORZGUIDE, 83
END
END
#endif // APSTUDIO_INVOKED
@@ -414,7 +428,20 @@
0
END
+IDD_SNAP_GLOBAL DLGINIT
+BEGIN
+ IDC_MSG_TYPE, 0x403, 13, 0
+0x654c, 0x7466, 0x4d20, 0x7365, 0x6173, 0x6567, "\000"
+ IDC_MSG_TYPE, 0x403, 14, 0
+0x6952, 0x6867, 0x2074, 0x654d, 0x7373, 0x6761, 0x0065,
+ IDC_MSG_TYPE, 0x403, 14, 0
+0x6f46, 0x6e75, 0x2064, 0x654d, 0x7373, 0x6761, 0x0065,
+ IDC_MSG_TYPE, 0x403, 13, 0
+0x6f4c, 0x7473, 0x4d20, 0x7365, 0x6173, 0x6567, "\000"
+ 0
+END
+
/////////////////////////////////////////////////////////////////////////////
//
// String Table
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-07-09 11:20:45 UTC (rev 831)
+++ trunk/src/view/visio/addon/document.cpp 2010-07-11 22:04:20 UTC (rev 832)
@@ -262,8 +262,8 @@
case ST_BMSC_MESSAGE_FOUND:
if(vsoShape->Text.length() == 0)
vsoShape->Text = _T("NAME");
+ autoSnapping(vsoShape);
autoEnumerate(vsoShape);
- autoSnapping(vsoShape);
break;
case ST_COMMENT:
@@ -499,7 +499,6 @@
itemCheckOptions->AddOnName = ADDON_NAME;
itemCheckOptions->AddOnArgs = stringize() << L"/event=" << MENU_CHECK_OPTIONS;
- //TODO: Dialog for message numbering global settings
Visio::IVMenuItemPtr globalSettings = itemDrawing->MenuItems->Add();
globalSettings->Caption = "&Settings...";
globalSettings->AddOnName = ADDON_NAME;
@@ -595,8 +594,8 @@
m_selAddMessagesToolbarItem->IconFileName(vslIconFile.c_str());
m_selAddMessagesToolbarItem->Visible = false;
-
Visio::IVToolbarItemPtr itemFindFlow = m_toolbar->ToolbarItems->Add();
+ itemFindFlow->BeginGroup = true;
itemFindFlow->Caption = "Find Flow";
itemFindFlow->AddOnName = ADDON_NAME;
itemFindFlow->AddOnArgs = stringize() << L"/event=" << MENU_FIND_FLOW;
@@ -625,6 +624,7 @@
m_simulationStopToolbarItem->IconFileName(vslIconFile.c_str());
m_enableMessageEnumerationToolbarItem = m_toolbar->ToolbarItems->Add();
+ m_enableMessageEnumerationToolbarItem->BeginGroup = true;
m_enableMessageEnumerationToolbarItem->Caption = "Message numbering";
m_enableMessageEnumerationToolbarItem->AddOnName = ADDON_NAME;
m_enableMessageEnumerationToolbarItem->AddOnArgs = stringize() << L"/event=" << MENU_ENABLE_MESSAGE_ENUMERATION;
@@ -2143,7 +2143,9 @@
//Step 3: Get the closest instance on the left and on the right
std::pair<Visio::IVShapePtr,Visio::IVShapePtr> closestInst = CMessageSnapping::getClosestInstancePair(msgShape, instShapes);
//Step 4:Glue to them
- CMessageSnapping::glueMsgToInstances(msgShape, closestInst.first, closestInst.second);
+ const TCHAR* regFolder = _T("Software\\Sequence Chart Studio\\MessageSnapping");
+ bool bOnlyOnLine = GetRegistry<bool>(regFolder, NULL, _T("OnlyOnLine"), false);
+ CMessageSnapping::glueMsgToInstancesPair(msgShape, closestInst.first, closestInst.second, bOnlyOnLine);
}
// $Id$
Modified: trunk/src/view/visio/addon/messageSnapping.cpp
===================================================================
--- trunk/src/view/visio/addon/messageSnapping.cpp 2010-07-09 11:20:45 UTC (rev 831)
+++ trunk/src/view/visio/addon/messageSnapping.cpp 2010-07-11 22:04:20 UTC (rev 832)
@@ -1,20 +1,20 @@
/*
- * scstudio - Sequence Chart Studio
- * http://scstudio.sourceforge.net
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * Copyright (c) 2010 Martin Bezdeka <mbe...@se...>
- *
- * $Id$
- */
+* scstudio - Sequence Chart Studio
+* http://scstudio.sourceforge.net
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License version 2.1, as published by the Free Software Foundation.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* Copyright (c) 2010 Martin Bezdeka <mbe...@se...>
+*
+* $Id$
+*/
#include "stdafx.h"
#include "dllmodule.h"
@@ -38,22 +38,22 @@
Visio::IVShapesPtr shapesOnPage = vsoApp->ActivePage->Shapes;
double InstBegY, InstEndY;
- double msgPinY = CShapeUtils::GetShapeCellProperty(msgShape, "PinY", "mm");
-
+ double msgPinY = CShapeUtils::GetShapeCellProperty(msgShape, "PinY", visPageUnits);
+
for(int i=1; i<=shapesOnPage->Count; i++)
{
Visio::IVShapePtr shape = shapesOnPage->Item[i];
if(get_shape_type(shape) == ST_BMSC_INSTANCE)
{
- InstBegY = CShapeUtils::GetShapeCellProperty(shape, "BeginY", "mm");
- InstEndY = CShapeUtils::GetShapeCellProperty(shape, "EndY", "mm");
+ InstBegY = CShapeUtils::GetShapeCellProperty(shape, "BeginY", visPageUnits);
+ InstEndY = CShapeUtils::GetShapeCellProperty(shape, "EndY", visPageUnits);
//If instance is upside down, swap coordinates
if((InstBegY - InstEndY) < 0)
std::swap(InstBegY, InstEndY);
//Check if the message intersect instance and put it into vector of instances matching the criteria
- if((InstBegY > msgPinY) && (InstEndY < msgPinY))
+ if((InstBegY >= msgPinY) && (InstEndY <= msgPinY))
instShapes.push_back(shape);
}
}
@@ -62,9 +62,10 @@
}
std::pair<Visio::IVShapePtr, Visio::IVShapePtr> CMessageSnapping::getClosestInstancePair(Visio::IVShapePtr msgShape,
- const std::vector<Visio::IVShapePtr>& instances)
+ const std::vector<Visio::IVShapePtr>& instances)
{
- double msgPinX = CShapeUtils::GetShapeCellProperty(msgShape, "PinX", "mm");
+ //TODO: try to find a way how to get closest instance better when it is in diagonal position
+ double msgPinX = CShapeUtils::GetShapeCellProperty(msgShape, "PinX", visPageUnits);
Visio::IVShapePtr leftClosestInstance = NULL;
Visio::IVShapePtr rightClosestInstance = NULL;
@@ -75,11 +76,11 @@
for(std::vector<Visio::IVShapePtr>::const_iterator it = instances.begin(); it != instances.end(); it++)
{
- instPinX = CShapeUtils::GetShapeCellProperty((*it),"PinX","mm");
+ instPinX = CShapeUtils::GetShapeCellProperty((*it),"PinX", visPageUnits);
distance = msgPinX - instPinX;
if(distance < 0)
{
- if(!rightClosestInstance || distance > rightClosestInstanceDist) //NOTE: Distance must be bigger, becaouse numbers are negative
+ if(!rightClosestInstance || distance > rightClosestInstanceDist) //NOTE: Distance must be bigger, because numbers are negative
{
rightClosestInstance = (*it);
rightClosestInstanceDist = distance;
@@ -98,12 +99,12 @@
return std::pair<Visio::IVShapePtr, Visio::IVShapePtr>(leftClosestInstance,rightClosestInstance);
}
-void CMessageSnapping::glueMsgToInstances(Visio::IVShapePtr msgShape, Visio::IVShapePtr leftInstance, Visio::IVShapePtr rightInstance)
+void CMessageSnapping::glueMsgToInstancesPair(Visio::IVShapePtr msgShape, Visio::IVShapePtr leftInstance, Visio::IVShapePtr rightInstance, bool onlyOnInstanceLine)
{
- double msgPinY = CShapeUtils::GetShapeCellProperty(msgShape, "PinY", "mm");
+ double msgPinY = CShapeUtils::GetShapeCellProperty(msgShape, "PinY", visPageUnits);
//reverse instances if message is left headed arrow
- if((CShapeUtils::GetShapeCellProperty(msgShape, "EndX", "mm") - CShapeUtils::GetShapeCellProperty(msgShape, "BeginX", "mm")) < 0)
+ if((CShapeUtils::GetShapeCellProperty(msgShape, "EndX", visPageUnits) - CShapeUtils::GetShapeCellProperty(msgShape, "BeginX", visPageUnits)) < 0)
{
Visio::IVShapePtr buffer = leftInstance;
leftInstance = rightInstance;
@@ -120,25 +121,40 @@
rightInstance = NULL;
break;
}
-
+
//Glue to left instance
if(leftInstance)
- {
- double InstBegY = CShapeUtils::GetShapeCellProperty(leftInstance, "BeginY", "mm");
- double InstEndY = CShapeUtils::GetShapeCellProperty(leftInstance, "EndY", "mm");
- double sizeOfInstance = InstBegY - InstEndY;
- double msgOffset = InstBegY - msgPinY;
- msgShape->Cells["BeginX"]->GlueToPos(leftInstance,msgOffset/sizeOfInstance,0.0);
- }
+ glueMsgToInstance(msgShape, leftInstance, "BeginX", msgPinY, onlyOnInstanceLine);
//Glue to right instance
if(rightInstance)
+ glueMsgToInstance(msgShape, rightInstance, "EndX", msgPinY, onlyOnInstanceLine);
+}
+
+void CMessageSnapping::glueMsgToInstance(Visio::IVShapePtr msgShape, Visio::IVShapePtr instanceShape,
+ const _bstr_t & msgCell, double yPos, bool onlyOnInstanceLine)
+{
+ //Get values from cells
+ double InstOffsetLeft = CShapeUtils::GetShapeCellProperty(instanceShape, "Controls.mscHeadWidth.X", visPageUnits); //NOTE: get width of instances rectangles
+ double InstBegY = CShapeUtils::GetShapeCellProperty(instanceShape, "BeginY", visPageUnits);
+ double InstEndY = CShapeUtils::GetShapeCellProperty(instanceShape, "EndY", visPageUnits);
+
+ double sizeOfInstance = fabs(InstBegY - InstEndY);
+ double msgOffset = fabs(InstBegY - yPos);
+
+ //avoid division by zero - when instances are in horizontal position
+ if(sizeOfInstance == 0)
+ return;
+
+ //Glue to position, if message is too close to "rectangles" on the instance it will be moved below them
+ if(onlyOnInstanceLine)
{
- double InstBegY = CShapeUtils::GetShapeCellProperty(rightInstance, "BeginY", "mm");
- double InstEndY = CShapeUtils::GetShapeCellProperty(rightInstance, "EndY", "mm");
- double sizeOfInstance = InstBegY - InstEndY;
- double msgOffset = InstBegY - msgPinY;
- msgShape->Cells["EndX"]->GlueToPos(rightInstance,msgOffset/sizeOfInstance,0.0);
+ if(msgOffset < InstOffsetLeft)
+ msgOffset = InstOffsetLeft;
+ else if(msgOffset > (sizeOfInstance - InstOffsetLeft))
+ msgOffset = sizeOfInstance - InstOffsetLeft;
}
+
+ msgShape->Cells[msgCell]->GlueToPos(instanceShape,msgOffset/sizeOfInstance,0.0);
}
// $Id$
\ No newline at end of file
Modified: trunk/src/view/visio/addon/messageSnapping.h
===================================================================
--- trunk/src/view/visio/addon/messageSnapping.h 2010-07-09 11:20:45 UTC (rev 831)
+++ trunk/src/view/visio/addon/messageSnapping.h 2010-07-11 22:04:20 UTC (rev 832)
@@ -28,6 +28,7 @@
/*
* Get All instances that intersect HORIZONTAL line of current msg
* returns vector of pointers to instances, if zero, there are no intersecting instances
+ * Intersect instances are meant without their rectangles on the top and on the bottom
*/
static std::vector<Visio::IVShapePtr> getIntersectInstances(Visio::IVShapePtr msgShape);
/*
@@ -35,10 +36,19 @@
*/
static std::pair<Visio::IVShapePtr, Visio::IVShapePtr> getClosestInstancePair(Visio::IVShapePtr msgShape, const std::vector<Visio::IVShapePtr>& instances);
/*
- * Glue given message on the given instances, message
+ * Glue given message on the given instances
+ * If leftInstance or rightInstance is NULL, message will be connected only to not null one
* designed only for horizontal messages (diagonal messages will be snapped according their PinX point and reformed to horizontal messages)
+ * @param onlyOnInstanceLine if true avoid connection message on instace's "rectangles" on the top and the bottom
*/
- static void glueMsgToInstances(Visio::IVShapePtr msgShape, Visio::IVShapePtr leftInstance, Visio::IVShapePtr rightInstance);
+ static void glueMsgToInstancesPair(Visio::IVShapePtr msgShape, Visio::IVShapePtr leftInstance, Visio::IVShapePtr rightInstance, bool onlyOnInstanceLine);
+ /*
+ * Glue given message to instance
+ * @param msgCell message cell which should be glued (e.g. BeginX, EndY)
+ * @param yPos vertical position where to glue message to instance (in page units - visPageUnits)
+ * @param onlyOnInstanceLine if true avoid connection message on instace's "rectangles" on the top and the bottom
+ */
+ static void glueMsgToInstance(Visio::IVShapePtr msgShape, Visio::IVShapePtr instanceShape, const _bstr_t & msgCell, double yPos, bool onlyOnInstanceLine);
};
Modified: trunk/src/view/visio/addon/resource.h
===================================================================
--- trunk/src/view/visio/addon/resource.h 2010-07-09 11:20:45 UTC (rev 831)
+++ trunk/src/view/visio/addon/resource.h 2010-07-11 22:04:20 UTC (rev 832)
@@ -97,6 +97,7 @@
#define IDC_MS_CONNECT_WITH_SIDE_SIDE 269
#define IDC_CHECK2 271
#define IDC_ENUM_CHECK 271
+#define IDC_ONLY_ON_LINE 271
#define IDC_RADIO4 273
#define IDC_USE_NUMBERING_STYLE 273
#define IDC_COMBO_NUMBERING_GLOBAL 276
@@ -104,14 +105,18 @@
#define IDC_STARTING_INDEX_GLOBAL 278
#define IDC_CHECK1 279
#define IDC_SNAP_ENABLED 279
+#define IDC_MSG_TYPE 282
+#define IDC_LEFT_INST_CHECK 285
+#define IDC_RIGHT_INST_CHECK 286
+#define IDC_CUSTOM1 287
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 228
+#define _APS_NEXT_RESOURCE_VALUE 229
#define _APS_NEXT_COMMAND_VALUE 32768
-#define _APS_NEXT_CONTROL_VALUE 280
+#define _APS_NEXT_CONTROL_VALUE 288
#define _APS_NEXT_SYMED_VALUE 105
#endif
#endif
Modified: trunk/src/view/visio/addon/shapeutils.h
===================================================================
--- trunk/src/view/visio/addon/shapeutils.h 2010-07-09 11:20:45 UTC (rev 831)
+++ trunk/src/view/visio/addon/shapeutils.h 2010-07-11 22:04:20 UTC (rev 832)
@@ -13,7 +13,7 @@
*
* Copyright (c) 2010 Ondrej Bouda <ond...@wh...>
*
- * $$
+ * $Id$
*/
#pragma once
@@ -35,7 +35,7 @@
static double GetShapeBeginY(Visio::IVShapePtr shape) { return shape->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginY]->Result[""]; }
static double GetShapeEndY(Visio::IVShapePtr shape) { return shape->CellsSRC[visSectionObject][visRowXForm1D][vis1DEndY]->Result[""]; }
- static double GetShapeCellProperty(Visio::IVShapePtr shape, const _bstr_t & propertyName, const _bstr_t & units)
+ static double GetShapeCellProperty(Visio::IVShapePtr shape, const _bstr_t & propertyName, VisUnitCodes units)
{ return shape->Cells[propertyName]->Result[units]; }
static void GlueBeginToPos(Visio::IVShapePtr what, Visio::IVShapePtr where, const MscPoint& pos);
Modified: trunk/src/view/visio/addon/snapGlobalDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/snapGlobalDlg.cpp 2010-07-09 11:20:45 UTC (rev 831)
+++ trunk/src/view/visio/addon/snapGlobalDlg.cpp 2010-07-11 22:04:20 UTC (rev 832)
@@ -23,10 +23,12 @@
BOOL CSnapGlobalDlg::OnInitDialog(HWND hWndFocus, LPARAM lParam)
{
LoadRegistryData();
-
//Move values in variables into controls
DoDataExchange(FALSE);
+ //Enable/disable controls on the dialog
+ EnableControls(m_bSnapEnabled);
+
return TRUE;
}
@@ -45,6 +47,7 @@
{
TRACE(_T("CSnapGlobalDlg::LoadRegistryData() - Loading options from registry"));
m_bSnapEnabled = GetRegistry<bool>(GetRegistryFolder(), NULL, _T("SnapEnabled"), false);
+ m_bOnlyOnLine = GetRegistry<bool>(GetRegistryFolder(), NULL, _T("OnlyOnLine"), false);
return 0;
}
@@ -52,8 +55,24 @@
{
TRACE(_T("CSnapGlobalDlg::LoadRegistryData() - Saving options to registry"));
SetRegistry<bool>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("SnapEnabled"), m_bSnapEnabled);
+ SetRegistry<bool>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("OnlyOnLine"), m_bOnlyOnLine);
return 0;
}
+void CSnapGlobalDlg::EnableControls(bool bEnable)
+{
+ GetDlgItem(IDC_ONLY_ON_LINE).EnableWindow(bEnable);
+ GetDlgItem(IDC_MSG_TYPE).EnableWindow(bEnable);
+ GetDlgItem(IDC_LEFT_INST_CHECK).EnableWindow(bEnable);
+ GetDlgItem(IDC_RIGHT_INST_CHECK).EnableWindow(bEnable);
+}
-// $Id$
\ No newline at end of file
+LRESULT CSnapGlobalDlg::OnBnClickedSnapEnabled(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
+{
+ DoDataExchange(TRUE);
+ EnableControls(m_bSnapEnabled);
+
+ return 0;
+}
+
+// $Id$
Modified: trunk/src/view/visio/addon/snapGlobalDlg.h
===================================================================
--- trunk/src/view/visio/addon/snapGlobalDlg.h 2010-07-09 11:20:45 UTC (rev 831)
+++ trunk/src/view/visio/addon/snapGlobalDlg.h 2010-07-11 22:04:20 UTC (rev 832)
@@ -37,12 +37,14 @@
protected:
BEGIN_MSG_MAP(CSnapGlobalDlg)
MSG_WM_INITDIALOG(OnInitDialog)
+ COMMAND_HANDLER(IDC_SNAP_ENABLED, BN_CLICKED, OnBnClickedSnapEnabled)
CHAIN_MSG_MAP(CPropertyPageImpl<CSnapGlobalDlg>)
END_MSG_MAP()
BEGIN_DDX_MAP(CSnapGlobalDlg)
DDX_CHECK(IDC_SNAP_ENABLED, m_bSnapEnabled);
+ DDX_CHECK(IDC_ONLY_ON_LINE, m_bOnlyOnLine);
END_DDX_MAP()
int LoadRegistryData();
@@ -50,7 +52,11 @@
//Member variables
bool m_bSnapEnabled;
+ bool m_bOnlyOnLine;
+ void EnableControls(bool bEnable = true);
+ LRESULT OnBnClickedSnapEnabled(WORD, WORD, HWND, BOOL&);
+
public:
//Message handlers
BOOL OnInitDialog(HWND hWndFocus, LPARAM lParam);
@@ -60,7 +66,6 @@
//Registry folder
const wchar_t* GetRegistryFolder() { return SCSTUDIO_REGISTRY_ROOT _T("\\MessageSnapping"); }
-
};
// $Id$
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mbe...@us...> - 2010-07-16 02:02:56
|
Revision: 833
http://scstudio.svn.sourceforge.net/scstudio/?rev=833&view=rev
Author: mbezdeka
Date: 2010-07-16 02:02:46 +0000 (Fri, 16 Jul 2010)
Log Message:
-----------
Message snapping:
- global dialog GUI changed
- funcionality improved (3 types of snapping)
- bugs fixed
Modified Paths:
--------------
trunk/doc/help/frontend/message-snapping.html
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/addon.h
trunk/src/view/visio/addon/dllmodule.rc
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/document.h
trunk/src/view/visio/addon/enums.h
trunk/src/view/visio/addon/messageSnapping.cpp
trunk/src/view/visio/addon/messageSnapping.h
trunk/src/view/visio/addon/pageutils.cpp
trunk/src/view/visio/addon/pageutils.h
trunk/src/view/visio/addon/resource.h
trunk/src/view/visio/addon/snapGlobalDlg.cpp
trunk/src/view/visio/addon/snapGlobalDlg.h
Modified: trunk/doc/help/frontend/message-snapping.html
===================================================================
--- trunk/doc/help/frontend/message-snapping.html 2010-07-11 22:04:20 UTC (rev 832)
+++ trunk/doc/help/frontend/message-snapping.html 2010-07-16 02:02:46 UTC (rev 833)
@@ -6,5 +6,6 @@
</head>
<body>
<h1>Message Snapping</h1>
-<p>When message is dropped onto drawing a user have to connect message to instances manually. If Message snapping is enabled, messages are automatically snapped to nearest instances when user release a mouse button.</p>
+<p>When a message is dropped onto the drawing a user has to connect this message to the instances manually. If Message snapping is enabled then all new messages are automatically snapped to the nearest instances as soon as the user releases the mouse button.</p>
+
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2010-07-11 22:04:20 UTC (rev 832)
+++ trunk/src/view/visio/addon/addon.cpp 2010-07-16 02:02:46 UTC (rev 833)
@@ -28,6 +28,7 @@
#include "errors.h"
#include "resource.h"
#include "pageutils.h"
+#include "messageSnapping.h"
// include command line parsing library SimpleOpt
// http://code.jellycan.com/simpleopt
@@ -61,6 +62,10 @@
m_mousePosX = m_mousePosY = 0.0;
m_bCellChanged = false;
m_bShapeDeleted = false;
+ m_bSnap = false;
+ m_bMoving = false;
+ m_bBeginChanged = false;
+ m_bEndChanged = false;
};
VAORC CStudioAddon::About(LPVAOV2LSTRUCT pV2L)
@@ -477,6 +482,11 @@
HandleMouseMove(pSubjectObj, pSourceObj);
break;
+ case Visio::visEvtCodeMouseUp:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeMouseUp");
+ HandleMouseUp(pSubjectObj, pSourceObj);
+ break;
+
case Visio::visEvtCodeWinSelChange:
TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeWinSelChange");
HandleWinSelChange(pSourceObj);
@@ -548,15 +558,28 @@
}
}
- //Message enumeration
if((_tcsicmp(vsoCell->Name,_T("PinX")) == 0 || _tcsicmp(vsoCell->Name,_T("PinY")) == 0) &&
- (GetDocumentMonitor(vsoCell->Application,vsoCell->Application->ActiveDocument)->isMessageShape(vsoCell->Shape)) &&
- (_tcsicmp(vsoCell->Shape->Data1,_T("1")) == 0))
+ (GetDocumentMonitor(vsoCell->Application,vsoCell->Application->ActiveDocument)->isMessageShape(vsoCell->Shape)))
{
- //add to set
- m_enumerationGroups.insert(vsoCell->Shape->Data3);
- m_bCellChanged = true;
+ //Message enumeration
+ if(_tcsicmp(vsoCell->Shape->Data1,_T("1")) == 0)
+ {
+ //add to set
+ m_enumerationGroups.insert(vsoCell->Shape->Data3);
+ m_bCellChanged = true;
+ }
+ //Message snapping
+ if(!m_bSnap)
+ m_bSnap = true;
}
+
+ //HACK: cell changed so update mouse position (because when changing end points, MouseMove event won't trigger)
+ if((_tcsicmp(vsoCell->Name,_T("BeginX")) == 0) || (_tcsicmp(vsoCell->Name,_T("BeginY")) == 0))
+ m_bBeginChanged = true;
+ if((_tcsicmp(vsoCell->Name,_T("EndX")) == 0) || (_tcsicmp(vsoCell->Name,_T("EndY")) == 0))
+ m_bEndChanged = true;
+ if(_tcsicmp(vsoCell->Name,_T("LocPinX")) == 0)
+ m_bMoving = true;
}
void CStudioAddon::HandleConnectionsAdded(Visio::IVConnectsPtr vsoConnects)
@@ -638,6 +661,10 @@
m_mousePosY = vsoMouseEvent->y;
}
+void CStudioAddon::HandleMouseUp(Visio::IVMouseEventPtr vsoMouseEvent, Visio::IVApplicationPtr vsoApp)
+{
+}
+
void CStudioAddon::HandleWinSelChange(Visio::IVApplicationPtr vsoApp)
{
m_oldSelections[vsoApp] = m_curSelections[vsoApp];
@@ -652,6 +679,47 @@
void CStudioAddon::HandleNonePending(Visio::IVApplicationPtr vsoApp)
{
+ //Message snapping
+ if(m_bSnap && vsoApp->ActiveWindow->Selection->Count)
+ {
+ Visio::IVSelectionPtr selection = vsoApp->ActiveWindow->Selection;
+
+ if(selection->Count == 1)
+ {
+ Visio::IVShapePtr msgShape = selection->Item[1];
+ if(msgShape && GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->isMessageShape(msgShape))
+ {
+ //Resize shape
+ if(m_bMoving && (m_bBeginChanged ^ m_bEndChanged))
+ {
+ m_mousePosX = m_bBeginChanged ? msgShape->Cells["BeginX"]->Result[""] : msgShape->Cells["EndX"]->Result[""];
+ m_mousePosY = m_bBeginChanged ? msgShape->Cells["BeginY"]->Result[""] : msgShape->Cells["EndY"]->Result[""];
+ }
+
+ GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->autoSnapping(msgShape,
+ CPageUtils::ConvertUnits(vsoApp->ActivePage, m_mousePosX, 0, visPageUnits),
+ CPageUtils::ConvertUnits(vsoApp->ActivePage, m_mousePosY, 0, visPageUnits));
+ }
+ }
+ else //NOTE: Multiple selection - preserve connecting to instances
+ {
+ MsgSnapType currentSnapType = CMessageSnapping::getSnapType();
+ CMessageSnapping::setSnapType(MSSNAP_PRESERVE_SLOPE);
+ for(int i=1; i<=selection->Count; i++)
+ {
+ Visio::IVShapePtr msgShape = selection->Item[i];
+ if(GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->isMessageShape(msgShape))
+ GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->autoSnapping(msgShape, msgShape->Cells["PinX"]->Result[visPageUnits],
+ msgShape->Cells["PinY"]->Result[visPageUnits]);
+ }
+ CMessageSnapping::setSnapType(currentSnapType);
+ }
+ }
+ //Set variables to false
+ m_bSnap = m_bMoving = m_bBeginChanged = m_bEndChanged = false;
+
+
+ //Message numbering
if(m_bShapeDeleted || m_bCellChanged)
{
Visio::IVShapesPtr shapesPtr = vsoApp->ActivePage->Shapes;
@@ -678,7 +746,6 @@
if(!bNumberedMsg)
CEnumerateUtils::eraseEnumInfo(vsoApp);
}
-
//Set variables to false to prevent this function from loop
m_bShapeDeleted = m_bCellChanged = false;
}
@@ -789,6 +856,7 @@
vsoApp->EventList->AddAdvise(Visio::visEvtCodeKeyDown, varSink, _T(""), _T("KeyDown"));
vsoApp->EventList->AddAdvise(Visio::visEvtCodeKeyUp, varSink, _T(""), _T("KeyUp"));
vsoApp->EventList->AddAdvise(Visio::visEvtCodeMouseMove, varSink, _T(""), _T("MouseMove"));
+ vsoApp->EventList->AddAdvise(Visio::visEvtCodeMouseUp, varSink, _T(""), _T("MouseUp"));
// Message enumeration events
vsoApp->EventList->AddAdvise(Visio::visEvtCodeShapeBeforeTextEdit, varSink, _T(""), _T("BeforeTextEdit"));
vsoApp->EventList->AddAdvise(Visio::visEvtCodeShapeExitTextEdit, varSink, _T(""), _T("AfterTextEdit"));
Modified: trunk/src/view/visio/addon/addon.h
===================================================================
--- trunk/src/view/visio/addon/addon.h 2010-07-11 22:04:20 UTC (rev 832)
+++ trunk/src/view/visio/addon/addon.h 2010-07-16 02:02:46 UTC (rev 833)
@@ -55,6 +55,7 @@
void HandleKeyDown(Visio::IVKeyboardEventPtr vsoKeyboardEvent, Visio::IVApplicationPtr vsoApp);
void HandleKeyUp(Visio::IVKeyboardEventPtr vsoKeyboardEvent, Visio::IVApplicationPtr vsoApp);
void HandleMouseMove(Visio::IVMouseEventPtr vsoMouseEvent, Visio::IVApplicationPtr vsoApp);
+ void HandleMouseUp(Visio::IVMouseEventPtr vsoMouseEvent, Visio::IVApplicationPtr vsoApp);
void HandleWinSelChange(Visio::IVApplicationPtr vsoApp);
void HandleBeforeTextEdit(Visio::IVShapePtr shapePtr, Visio::IVApplicationPtr vsoApp);
void HandleAfterTextEdit(Visio::IVShapePtr shapePtr, Visio::IVApplicationPtr vsoApp);
@@ -125,18 +126,25 @@
long m_keyButtonState;
double m_mousePosX;
double m_mousePosY;
+
std::map<long, TAddonState> m_states;
std::map<long, Visio::IVSelectionPtr> m_oldSelections;
std::map<long, Visio::IVSelectionPtr> m_curSelections;
std::map<long, double> m_prevMousePosX;
- //Message enumeration
+ std::map<long, double> m_prevMousePosY;
+
+ //Message numbering
bool m_bMessageTextEdited;
bool m_bCellChanged;
bool m_bShapeDeleted;
+ std::set<_bstr_t> m_enumerationGroups;
- std::set<_bstr_t> m_enumerationGroups;
- std::map<long, double> m_prevMousePosY;
+ //Message snapping
+ bool m_bSnap;
+ bool m_bBeginChanged;
+ bool m_bEndChanged;
+ bool m_bMoving;
};
// $Id$
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2010-07-11 22:04:20 UTC (rev 832)
+++ trunk/src/view/visio/addon/dllmodule.rc 2010-07-16 02:02:46 UTC (rev 833)
@@ -229,16 +229,12 @@
CAPTION "Dialog"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- CONTROL "Enable snapping to instances for new messages",IDC_SNAP_ENABLED,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,169,10
- GROUPBOX "General",IDC_STATIC,7,22,261,30
- CONTROL "Adjust snapping only to instance's line",IDC_ONLY_ON_LINE,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,34,137,10
- GROUPBOX "Message options",IDC_STATIC,7,58,261,34
- COMBOBOX IDC_MSG_TYPE,13,71,94,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
- LTEXT "snap to ",IDC_STATIC,113,71,26,12,SS_CENTERIMAGE
- CONTROL "left instace,",IDC_LEFT_INST_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,146,71,51,12
- CONTROL "right instace",IDC_RIGHT_INST_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,205,71,54,12
+ CONTROL "Enable message snapping",IDC_SNAP_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,98,10
+ GROUPBOX "Oblique message snapping options",IDC_STATIC,7,22,261,61
+ CONTROL "straighten",IDC_STRAIGHTEN,"Button",BS_AUTORADIOBUTTON | WS_GROUP,13,37,47,10
+ CONTROL "preserve vertical distance between send - receive",IDC_PRESERVE_VERTICAL,
+ "Button",BS_AUTORADIOBUTTON,13,51,176,10
+ CONTROL "preserve slope",IDC_PRESERVE_SLOPE,"Button",BS_AUTORADIOBUTTON,13,65,63,10
END
@@ -314,10 +310,6 @@
VERTGUIDE, 13
TOPMARGIN, 7
BOTTOMMARGIN, 111
- HORZGUIDE, 34
- HORZGUIDE, 44
- HORZGUIDE, 71
- HORZGUIDE, 83
END
END
#endif // APSTUDIO_INVOKED
@@ -428,20 +420,7 @@
0
END
-IDD_SNAP_GLOBAL DLGINIT
-BEGIN
- IDC_MSG_TYPE, 0x403, 13, 0
-0x654c, 0x7466, 0x4d20, 0x7365, 0x6173, 0x6567, "\000"
- IDC_MSG_TYPE, 0x403, 14, 0
-0x6952, 0x6867, 0x2074, 0x654d, 0x7373, 0x6761, 0x0065,
- IDC_MSG_TYPE, 0x403, 14, 0
-0x6f46, 0x6e75, 0x2064, 0x654d, 0x7373, 0x6761, 0x0065,
- IDC_MSG_TYPE, 0x403, 13, 0
-0x6f4c, 0x7473, 0x4d20, 0x7365, 0x6173, 0x6567, "\000"
- 0
-END
-
/////////////////////////////////////////////////////////////////////////////
//
// String Table
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-07-11 22:04:20 UTC (rev 832)
+++ trunk/src/view/visio/addon/document.cpp 2010-07-16 02:02:46 UTC (rev 833)
@@ -262,8 +262,11 @@
case ST_BMSC_MESSAGE_FOUND:
if(vsoShape->Text.length() == 0)
vsoShape->Text = _T("NAME");
- autoSnapping(vsoShape);
- autoEnumerate(vsoShape);
+ //Check whether snapping is enabled
+ if(CMessageSnapping::isEnabled())
+ autoSnapping(vsoShape,CPageUtils::ConvertUnits(m_vsoApp,m_addon->GetMousePosX(),0,visPageUnits),
+ CPageUtils::ConvertUnits(m_vsoApp,m_addon->GetMousePosY(),0,visPageUnits));
+ autoEnumerate(vsoShape);
break;
case ST_COMMENT:
@@ -929,13 +932,18 @@
VAORC CDocumentMonitor::OnMenuRepaint(Visio::IVApplicationPtr vsoApp)
{
- selectAll(vsoApp, false, SELECTION_REPLACE);
- OnMenuDisableMessageEnumeration(vsoApp);
// clear the verification report
m_reportView->Reset();
long scope_id = vsoApp->BeginUndoScope("Repaint");
+ //Disable message numbering, auto snapping
+ selectAll(vsoApp, false, SELECTION_REPLACE);
+ OnMenuDisableMessageEnumeration(vsoApp);
+ bool bSnappingEnabled = CMessageSnapping::isEnabled();
+ if(bSnappingEnabled)
+ CMessageSnapping::setEnabled(false);
+
CDrawingExtractor extractor(m_reportView);
// delete all MSC symbols, preserve ignored shapes
extractor.m_remove_extracted = true;
@@ -965,6 +973,9 @@
visualizer.m_ask_overwrite = false;
visualizer.visualize_msc(vsoApp->ActiveDocument, drawing);
+ //Enable auto snapping back (if was enabled)
+ CMessageSnapping::setEnabled(bSnappingEnabled);
+
vsoApp->EndUndoScope(scope_id, true);
m_reportView->Print(RS_NOTICE,
@@ -975,8 +986,6 @@
VAORC CDocumentMonitor::OnMenuTransform(Visio::IVApplicationPtr vsoApp, int index)
{
- selectAll(vsoApp, false, SELECTION_REPLACE);
- OnMenuDisableMessageEnumeration(vsoApp);
// clear the verification report
m_reportView->Reset();
@@ -986,6 +995,13 @@
long scope_id = vsoApp->BeginUndoScope(transformer->get_name().c_str());
+ //Disable message numbering, auto snapping
+ selectAll(vsoApp, false, SELECTION_REPLACE);
+ OnMenuDisableMessageEnumeration(vsoApp);
+ bool bSnappingEnabled = CMessageSnapping::isEnabled();
+ if(bSnappingEnabled)
+ CMessageSnapping::setEnabled(false);
+
Visio::IVPagePtr vsoPage = m_vsoApp->GetActivePage();
CDrawingExtractor extractor(m_reportView);
@@ -1022,6 +1038,9 @@
visualizer.m_ask_overwrite = false;
visualizer.visualize_msc(vsoApp->ActiveDocument, drawing);
+ //Enable auto snapping if it was enabled
+ CMessageSnapping::setEnabled(bSnappingEnabled);
+
vsoApp->EndUndoScope(scope_id, true);
m_reportView->Print(RS_NOTICE,
@@ -2133,19 +2152,55 @@
return 0;
}
-void CDocumentMonitor::autoSnapping(Visio::IVShapePtr msgShape)
+void CDocumentMonitor::autoSnapping(Visio::IVShapePtr msgShape, double posX, double posY)
{
- //Step 1: Check whether snapping is enabled
- if(!CMessageSnapping::isEnabled())
+ //Step 1: Get snap type
+ MsgSnapType snapType = CMessageSnapping::getSnapType();
+
+ if(snapType < 0 || snapType > 2)
+ {
+ MessageBox(GetActiveWindow(), _T("Error occurred: Unknown snap type"), _T("Error"), MB_OK | MB_ICONERROR);
return;
+ }
+
+ double msgBegY = CShapeUtils::GetShapeCellProperty(msgShape,"BeginY", visPageUnits);
+ double msgEndY = CShapeUtils::GetShapeCellProperty(msgShape,"EndY", visPageUnits);
+
+ //if message is only horizontal we can take as Y coord PinY and don't have to calculate oblique
+ if(msgShape->Cells["BeginY"]->Result[visPageUnits] == msgEndY) //DODELAT!
+ {
+ posY = CShapeUtils::GetShapeCellProperty(msgShape, "PinY", visPageUnits);
+ snapType = MSSNAP_STRAIGHTEN;
+ }
+
//Step 2: Get all instance matching criteria
- std::vector<Visio::IVShapePtr> instShapes = CMessageSnapping::getIntersectInstances(msgShape);
+ std::vector<Visio::IVShapePtr> instShapes = CMessageSnapping::getIntersectInstances(msgShape, posY, snapType);
+
//Step 3: Get the closest instance on the left and on the right
- std::pair<Visio::IVShapePtr,Visio::IVShapePtr> closestInst = CMessageSnapping::getClosestInstancePair(msgShape, instShapes);
+ std::pair<Visio::IVShapePtr,Visio::IVShapePtr> closestInst = CMessageSnapping::getClosestInstancePair(msgShape, posX, posY, instShapes, snapType);
+
//Step 4:Glue to them
- const TCHAR* regFolder = _T("Software\\Sequence Chart Studio\\MessageSnapping");
- bool bOnlyOnLine = GetRegistry<bool>(regFolder, NULL, _T("OnlyOnLine"), false);
- CMessageSnapping::glueMsgToInstancesPair(msgShape, closestInst.first, closestInst.second, bOnlyOnLine);
+ CMessageSnapping::glueMsgToInstancesPair(msgShape, closestInst.first, closestInst.second,posY, snapType);
+
+ //Step 5: Straighten messages when it's snapped only to one instance (must disable events, because CellChanged would be triggered)
+ if((closestInst.first ^ closestInst.second) && snapType == MSSNAP_STRAIGHTEN)
+ {
+ if((CShapeUtils::GetShapeCellProperty(msgShape, "EndX", visPageUnits) - CShapeUtils::GetShapeCellProperty(msgShape, "BeginX", visPageUnits)) < 0)
+ {
+ Visio::IVShapePtr buffer = closestInst.first;
+ closestInst.first = closestInst.second;
+ closestInst.second = buffer;
+ }
+
+ msgShape->Application->EventsEnabled = false;
+ if(!closestInst.second)
+ msgShape->Cells["EndY"]->FormulaU = stringize() << msgShape->Cells["BeginY"]->Result[""];
+ else if(!closestInst.first)
+ msgShape->Cells["BeginY"]->FormulaU = stringize() << msgShape->Cells["EndY"]->Result[""];
+ msgShape->Application->EventsEnabled = true;
+ }
+
+ //FIXME: preserve vertical distance can't sometimes find the closest instance
}
// $Id$
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-07-11 22:04:20 UTC (rev 832)
+++ trunk/src/view/visio/addon/document.h 2010-07-16 02:02:46 UTC (rev 833)
@@ -340,7 +340,14 @@
// Message snapping
- void autoSnapping(Visio::IVShapePtr msgShape);
+
+ /**
+ * automatically snaps current message to nearest instances
+ * @param msgShape a shape to snap
+ * @param posX MouseX position for closest instances computing
+ * @param posY MouseY position for closest instances computing
+ */
+ void autoSnapping(Visio::IVShapePtr msgShape, double posX, double posY);
};
// $Id$
Modified: trunk/src/view/visio/addon/enums.h
===================================================================
--- trunk/src/view/visio/addon/enums.h 2010-07-11 22:04:20 UTC (rev 832)
+++ trunk/src/view/visio/addon/enums.h 2010-07-16 02:02:46 UTC (rev 833)
@@ -45,4 +45,11 @@
SELECTION_REPLACE,
};
+enum MsgSnapType
+{
+ MSSNAP_STRAIGHTEN,
+ MSSNAP_PRESERVE_VERTICAL,
+ MSSNAP_PRESERVE_SLOPE,
+};
+
// $Id$
Modified: trunk/src/view/visio/addon/messageSnapping.cpp
===================================================================
--- trunk/src/view/visio/addon/messageSnapping.cpp 2010-07-11 22:04:20 UTC (rev 832)
+++ trunk/src/view/visio/addon/messageSnapping.cpp 2010-07-16 02:02:46 UTC (rev 833)
@@ -23,23 +23,39 @@
bool CMessageSnapping::isEnabled()
{
- const TCHAR* regFolder = _T("Software\\Sequence Chart Studio\\MessageSnapping");
-
- if(!GetRegistry<bool>(regFolder, NULL, _T("SnapEnabled"), 0))
+ if(!GetRegistry<bool>(_T("Software\\Sequence Chart Studio\\MessageSnapping"), NULL, _T("SnapEnabled"), 0))
return false;
return true;
}
-std::vector<Visio::IVShapePtr> CMessageSnapping::getIntersectInstances(Visio::IVShapePtr msgShape)
+MsgSnapType CMessageSnapping::getSnapType()
{
+ return (MsgSnapType)GetRegistry<int>(_T("Software\\Sequence Chart Studio\\MessageSnapping"), NULL, _T("SnapType"), -1);
+}
+
+void CMessageSnapping::setEnabled(bool bEnable)
+{
+ SetRegistry<bool>(HKEY_CURRENT_USER, _T("Software\\Sequence Chart Studio\\MessageSnapping"), _T("SnapEnabled"), bEnable);
+}
+
+void CMessageSnapping::setSnapType(MsgSnapType snapType)
+{
+ SetRegistry<int>(HKEY_CURRENT_USER, _T("Software\\Sequence Chart Studio\\MessageSnapping"), _T("snapType"), snapType);
+}
+
+std::vector<Visio::IVShapePtr> CMessageSnapping::getIntersectInstances(Visio::IVShapePtr msgShape, double msgPosY, MsgSnapType snapType)
+{
std::vector<Visio::IVShapePtr> instShapes;
Visio::IVApplicationPtr vsoApp = msgShape->Application;
Visio::IVShapesPtr shapesOnPage = vsoApp->ActivePage->Shapes;
double InstBegY, InstEndY;
- double msgPinY = CShapeUtils::GetShapeCellProperty(msgShape, "PinY", visPageUnits);
+ double msgBegY = CShapeUtils::GetShapeCellProperty(msgShape,"BeginY", visPageUnits);
+ double msgEndY = CShapeUtils::GetShapeCellProperty(msgShape,"EndY", visPageUnits);
+
+ //Searches for instances on the page and the ones matching the criteria puts into vector
for(int i=1; i<=shapesOnPage->Count; i++)
{
Visio::IVShapePtr shape = shapesOnPage->Item[i];
@@ -51,57 +67,86 @@
//If instance is upside down, swap coordinates
if((InstBegY - InstEndY) < 0)
std::swap(InstBegY, InstEndY);
-
- //Check if the message intersect instance and put it into vector of instances matching the criteria
- if((InstBegY >= msgPinY) && (InstEndY <= msgPinY))
- instShapes.push_back(shape);
+
+ if(snapType == MSSNAP_STRAIGHTEN)
+ {
+ //If actual mouse position intersect instance we add it to the vector
+ if((InstBegY > msgPosY) && (InstEndY < msgPosY))
+ instShapes.push_back(shape);
+ }
+ else if(snapType == MSSNAP_PRESERVE_VERTICAL)
+ {
+ //If at least one ending point intersect instance we add it to the vector
+ if(((InstBegY > msgBegY) && (InstEndY < msgBegY)) || ((InstBegY > msgEndY) && (InstEndY < msgEndY)))
+ instShapes.push_back(shape);
+ }
+ else if(snapType == MSSNAP_PRESERVE_SLOPE)
+ {
+ PVEC2 result = getIntersectionWithInstance(msgShape, shape);
+ if(result)
+ instShapes.push_back(shape);
+ delete result;
+ }
+ else
+ {
+ MessageBox(GetActiveWindow(),_T("getIntersectInstances(): Unknow snapType was selected"),_T("Error"),MB_OK | MB_ICONERROR);
+ break; // error occured, jump out from cyclus
+ }
}
}
return instShapes;
}
-std::pair<Visio::IVShapePtr, Visio::IVShapePtr> CMessageSnapping::getClosestInstancePair(Visio::IVShapePtr msgShape,
- const std::vector<Visio::IVShapePtr>& instances)
+std::pair<Visio::IVShapePtr, Visio::IVShapePtr> CMessageSnapping::getClosestInstancePair(Visio::IVShapePtr msgShape, double msgSnapPointX, double msgSnapPointY,
+ const std::vector<Visio::IVShapePtr>& instances, MsgSnapType snapType)
{
- //TODO: try to find a way how to get closest instance better when it is in diagonal position
- double msgPinX = CShapeUtils::GetShapeCellProperty(msgShape, "PinX", visPageUnits);
-
+ /*
+ TODO: try to find a way how to get closest instance better when instance is in diagonal position
+ For example, compute intersection as a intersection of two vectors
+ */
Visio::IVShapePtr leftClosestInstance = NULL;
Visio::IVShapePtr rightClosestInstance = NULL;
- double leftClosestInstanceDist = 0;
- double rightClosestInstanceDist = 0;
- double instPinX;
- double distance;
+ double leftClosestInstanceDist = 0, rightClosestInstanceDist = 0;
+ double instPinX, instPinY, distance, mouseDistX;
for(std::vector<Visio::IVShapePtr>::const_iterator it = instances.begin(); it != instances.end(); it++)
{
instPinX = CShapeUtils::GetShapeCellProperty((*it),"PinX", visPageUnits);
- distance = msgPinX - instPinX;
- if(distance < 0)
+ instPinY = CShapeUtils::GetShapeCellProperty((*it),"PinY", visPageUnits);
+
+ distance = sqrt(pow((msgSnapPointX - instPinX),2) + pow((msgSnapPointY - instPinY),2));
+ mouseDistX = msgSnapPointX - instPinX;
+
+ if(mouseDistX < 0)
{
- if(!rightClosestInstance || distance > rightClosestInstanceDist) //NOTE: Distance must be bigger, because numbers are negative
+ if(!rightClosestInstance || distance < rightClosestInstanceDist)
{
- rightClosestInstance = (*it);
- rightClosestInstanceDist = distance;
+ rightClosestInstance = (*it);
+ rightClosestInstanceDist = distance;
}
}
- else
+ else if(mouseDistX > 0)
{
if(!leftClosestInstance || distance < leftClosestInstanceDist)
{
leftClosestInstance = (*it);
leftClosestInstanceDist = distance;
}
- }
+ }
+ else
+ return std::pair<Visio::IVShapePtr, Visio::IVShapePtr>(NULL,NULL); //NOTE: Ordinary snap will handle position change
}
return std::pair<Visio::IVShapePtr, Visio::IVShapePtr>(leftClosestInstance,rightClosestInstance);
}
-void CMessageSnapping::glueMsgToInstancesPair(Visio::IVShapePtr msgShape, Visio::IVShapePtr leftInstance, Visio::IVShapePtr rightInstance, bool onlyOnInstanceLine)
+void CMessageSnapping::glueMsgToInstancesPair(Visio::IVShapePtr msgShape, Visio::IVShapePtr leftInstance, Visio::IVShapePtr rightInstance,
+ double yPos, MsgSnapType snapType)
{
- double msgPinY = CShapeUtils::GetShapeCellProperty(msgShape, "PinY", visPageUnits);
+ //if there are no instances, return
+ if(!leftInstance && !rightInstance)
+ return;
//reverse instances if message is left headed arrow
if((CShapeUtils::GetShapeCellProperty(msgShape, "EndX", visPageUnits) - CShapeUtils::GetShapeCellProperty(msgShape, "BeginX", visPageUnits)) < 0)
@@ -122,19 +167,59 @@
break;
}
+ double yLeftPos, yRightPos;
+ double msgBegY = CShapeUtils::GetShapeCellProperty(msgShape,"BeginY", visPageUnits);
+ double msgEndY = CShapeUtils::GetShapeCellProperty(msgShape,"EndY", visPageUnits);
+
+ //if message is only horizontal we can take as Y coord PinY and don't have to calculate oblique
+ if(msgBegY == msgEndY)
+ yLeftPos = yRightPos = CShapeUtils::GetShapeCellProperty(msgShape, "PinY", visPageUnits);
+ else
+ {
+ //Select where ends of message should be snapped
+ switch(snapType)
+ {
+ case MSSNAP_STRAIGHTEN:
+ yLeftPos = yRightPos = yPos;
+ break;
+ case MSSNAP_PRESERVE_VERTICAL:
+ yLeftPos = msgBegY;
+ yRightPos = msgEndY;
+ break;
+ case MSSNAP_PRESERVE_SLOPE:
+ PVEC2 p = NULL;
+ if(leftInstance)
+ {
+ p = getIntersectionWithInstance(msgShape, leftInstance);
+ if(p) yLeftPos = p->y;
+ delete p;
+ }
+ if(rightInstance)
+ {
+ p = getIntersectionWithInstance(msgShape, rightInstance);
+ if(p) yRightPos = p->y;
+ delete p;
+ }
+ break;
+ }
+ }
+
//Glue to left instance
if(leftInstance)
- glueMsgToInstance(msgShape, leftInstance, "BeginX", msgPinY, onlyOnInstanceLine);
+ glueMsgToInstance(msgShape, leftInstance, "BeginX", yLeftPos);
//Glue to right instance
if(rightInstance)
- glueMsgToInstance(msgShape, rightInstance, "EndX", msgPinY, onlyOnInstanceLine);
+ glueMsgToInstance(msgShape, rightInstance, "EndX", yRightPos);
}
void CMessageSnapping::glueMsgToInstance(Visio::IVShapePtr msgShape, Visio::IVShapePtr instanceShape,
- const _bstr_t & msgCell, double yPos, bool onlyOnInstanceLine)
+ const _bstr_t & msgCell, double yPos)
{
//Get values from cells
- double InstOffsetLeft = CShapeUtils::GetShapeCellProperty(instanceShape, "Controls.mscHeadWidth.X", visPageUnits); //NOTE: get width of instances rectangles
+ double InstOffsetLeft = 0;
+ if(instanceShape->CellExists["Controls.mscHeadWidth"][visExistsAnywhere]) //NOTE: Check if the instance is not headless
+ InstOffsetLeft = CShapeUtils::GetShapeCellProperty(instanceShape, "Controls.mscHeadWidth.X", visPageUnits); //NOTE: get width of instances rectangles
+
double InstBegY = CShapeUtils::GetShapeCellProperty(instanceShape, "BeginY", visPageUnits);
double InstEndY = CShapeUtils::GetShapeCellProperty(instanceShape, "EndY", visPageUnits);
@@ -145,16 +230,37 @@
if(sizeOfInstance == 0)
return;
- //Glue to position, if message is too close to "rectangles" on the instance it will be moved below them
- if(onlyOnInstanceLine)
- {
- if(msgOffset < InstOffsetLeft)
- msgOffset = InstOffsetLeft;
- else if(msgOffset > (sizeOfInstance - InstOffsetLeft))
- msgOffset = sizeOfInstance - InstOffsetLeft;
- }
+ //Glue to position, if message is on "rectangles" on the instance it won't be glued
+ if((msgOffset < InstOffsetLeft) || (msgOffset > (sizeOfInstance - InstOffsetLeft)))
+ return;
+ msgShape->Application->EventsEnabled = false;
msgShape->Cells[msgCell]->GlueToPos(instanceShape,msgOffset/sizeOfInstance,0.0);
+ msgShape->Application->EventsEnabled = true;
}
+PVEC2 CMessageSnapping::getIntersectionWithInstance(Visio::IVShapePtr msgShape, Visio::IVShapePtr instanceShape)
+{
+ VEC2 p1,p2,p3,p4;
+ p1.x = CShapeUtils::GetShapeCellProperty(msgShape,"EndX", visPageUnits);
+ p1.y = CShapeUtils::GetShapeCellProperty(msgShape,"EndY", visPageUnits);
+ p2.x = CShapeUtils::GetShapeCellProperty(msgShape,"BeginX", visPageUnits);
+ p2.y = CShapeUtils::GetShapeCellProperty(msgShape,"BeginY", visPageUnits);
+
+ p3.x = CShapeUtils::GetShapeCellProperty(instanceShape,"EndX", visPageUnits);
+ p3.y = CShapeUtils::GetShapeCellProperty(instanceShape,"EndY", visPageUnits);
+ p4.x = CShapeUtils::GetShapeCellProperty(instanceShape,"BeginX", visPageUnits);
+ p4.y = CShapeUtils::GetShapeCellProperty(instanceShape,"BeginY", visPageUnits);
+
+ PVEC2 result = CPageUtils::getIntersectionPoint(p1, p2, p3, p4);
+ if(!result)
+ return NULL;
+
+ //Check if it's outside of instance
+ if(result->y > p4.y || result->y < p3.y)
+ return NULL;
+
+ return result;
+}
+
// $Id$
\ No newline at end of file
Modified: trunk/src/view/visio/addon/messageSnapping.h
===================================================================
--- trunk/src/view/visio/addon/messageSnapping.h 2010-07-11 22:04:20 UTC (rev 832)
+++ trunk/src/view/visio/addon/messageSnapping.h 2010-07-16 02:02...
[truncated message content] |
|
From: <mbe...@us...> - 2010-07-23 00:03:53
|
Revision: 837
http://scstudio.svn.sourceforge.net/scstudio/?rev=837&view=rev
Author: mbezdeka
Date: 2010-07-23 00:03:47 +0000 (Fri, 23 Jul 2010)
Log Message:
-----------
Message snapping
- complete help added
- bugs fixed
Modified Paths:
--------------
trunk/doc/help/frontend/message-snapping.html
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/addon.h
trunk/src/view/visio/addon/dllmodule.rc
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/globalSettingsDlg.cpp
trunk/src/view/visio/addon/globalSettingsDlg.h
trunk/src/view/visio/addon/messageSnapping.cpp
trunk/src/view/visio/addon/numberingGlobalDlg.cpp
trunk/src/view/visio/addon/numberingGlobalDlg.h
trunk/src/view/visio/addon/pageutils.cpp
trunk/src/view/visio/addon/pageutils.h
Added Paths:
-----------
trunk/doc/help/frontend/pictures/message_snapping_options.png
Modified: trunk/doc/help/frontend/message-snapping.html
===================================================================
--- trunk/doc/help/frontend/message-snapping.html 2010-07-16 11:51:14 UTC (rev 836)
+++ trunk/doc/help/frontend/message-snapping.html 2010-07-23 00:03:47 UTC (rev 837)
@@ -6,6 +6,36 @@
</head>
<body>
<h1>Message Snapping</h1>
-<p>When a message is dropped onto the drawing a user has to connect this message to the instances manually. If Message snapping is enabled then all new messages are automatically snapped to the nearest instances as soon as the user releases the mouse button.</p>
+<p>When a message is dropped onto the drawing a user has to connect this message to the instances manually. If Message snapping is enabled then all new messages are automatically snapped to the nearest instances as soon as the user releases the mouse button. The nearest instances are taken from the mouse position.</p>
+<p>Snapping can be enabled via <code>Check -> Drawing -> Settings...</code>, tab Snap & Glue. Following dialog will be shown:</p>
+<p>
+<img src="pictures/message_snapping_options.png" alt="Message Snapping options dialog">
+</p>
+
+<p>
+Options are:<br>
+<code>Enable/disable message snapping</code><br>
+ - sets whether message snapping is enabled, otherwise all other options are disabled.
+</p>
+
+<p>
+When the message is already dropped on the page, user can still use snapping. As the message is moved, it automatically snaps to the nearest instance(s) (if exists). Since the message can be oblique, three types of snapping are provided:<br><br>
+<code>straighten</code><br>
+ - the message is straigten on the current location of the mouse cursor and snapped to instance(s).<br>
+<code>preserve vertical distance between send - receive</code><br>
+ - endpoint(s) of the message are horizontally stretched and snapped to the nearest instance(s).<br>
+<code>preserve slope</code><br>
+ - the message stays obliqued as it was. The endpoint(s) will be prolonged to the nearest instance(s).<br>
+</p>
+
+<h2>Multiple message snapping</h2>
+<i>Not implemented yet</i>
+
+<h2>Restrictions</h2>
+
+- Lost and Found messages are snapped only at one endpoint.<br>
+- Messages can be snapped only to the instances lines. Instance's head and end symbols are ignored.<br>
+
+
Added: trunk/doc/help/frontend/pictures/message_snapping_options.png
===================================================================
(Binary files differ)
Property changes on: trunk/doc/help/frontend/pictures/message_snapping_options.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2010-07-16 11:51:14 UTC (rev 836)
+++ trunk/src/view/visio/addon/addon.cpp 2010-07-23 00:03:47 UTC (rev 837)
@@ -59,13 +59,20 @@
{
m_pIAddonSink = NULL;
m_keyButtonState = 0;
+
m_mousePosX = m_mousePosY = 0.0;
+ m_mouseRelPosX = m_mouseRelPosY = 0.0;
+
m_bCellChanged = false;
m_bShapeDeleted = false;
+
m_bSnap = false;
m_bMoving = false;
m_bBeginChanged = false;
m_bEndChanged = false;
+ m_bCtrlDown = false;
+ m_bKeyDown = false;
+ m_bOnDropShape = false;
};
VAORC CStudioAddon::About(LPVAOV2LSTRUCT pV2L)
@@ -482,9 +489,9 @@
HandleMouseMove(pSubjectObj, pSourceObj);
break;
- case Visio::visEvtCodeMouseUp:
- TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeMouseUp");
- HandleMouseUp(pSubjectObj, pSourceObj);
+ case Visio::visEvtCodeMouseDown:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeMouseDown");
+ HandleMouseDown(pSubjectObj, pSourceObj);
break;
case Visio::visEvtCodeWinSelChange:
@@ -635,6 +642,12 @@
if (!(oldState & modifiers) && (m_keyButtonState & modifiers)) {
GetDocumentMonitor(vsoApp, vsoApp->ActiveDocument)->ToggleToolbarItems(true);
}
+
+ //Message snapping
+ if(m_keyButtonState & visKeyControl)
+ m_bCtrlDown = true;
+
+ m_bKeyDown = true;
}
void CStudioAddon::HandleKeyUp(Visio::IVKeyboardEventPtr vsoKeyboardEvent, Visio::IVApplicationPtr vsoApp)
@@ -653,6 +666,9 @@
if ((oldState & modifiers) && !(m_keyButtonState & modifiers)) {
GetDocumentMonitor(vsoApp, vsoApp->ActiveDocument)->ToggleToolbarItems(false);
}
+
+ //Message snapping
+ m_bCtrlDown = false;
}
void CStudioAddon::HandleMouseMove(Visio::IVMouseEventPtr vsoMouseEvent, Visio::IVApplicationPtr vsoApp)
@@ -661,12 +677,27 @@
m_mousePosY = vsoMouseEvent->y;
}
-void CStudioAddon::HandleMouseUp(Visio::IVMouseEventPtr vsoMouseEvent, Visio::IVApplicationPtr vsoApp)
+void CStudioAddon::HandleMouseDown(Visio::IVMouseEventPtr vsoMouseEvent, Visio::IVApplicationPtr vsoApp)
{
+ //Message snapping
+ if(vsoApp->ActiveWindow->Selection->Count == 1)
+ {
+ Visio::IVShapePtr shape = vsoApp->ActiveWindow->Selection->Item[1];
+ m_mouseRelPosX = m_mousePosX - shape->Cells["PinX"]->Result[""];
+ m_mouseRelPosY = m_mousePosY - shape->Cells["PinY"]->Result[""];
+ }
}
void CStudioAddon::HandleWinSelChange(Visio::IVApplicationPtr vsoApp)
{
+ //Message snapping
+ if(vsoApp->ActiveWindow->Selection->Count == 1)
+ {
+ Visio::IVShapePtr shape = vsoApp->ActiveWindow->Selection->Item[1];
+ m_mouseRelPosX = m_mousePosX - shape->Cells["PinX"]->Result[""];
+ m_mouseRelPosY = m_mousePosY - shape->Cells["PinY"]->Result[""];
+ }
+
m_oldSelections[vsoApp] = m_curSelections[vsoApp];
m_curSelections[vsoApp] = vsoApp->ActiveWindow->Selection;
@@ -679,46 +710,43 @@
void CStudioAddon::HandleNonePending(Visio::IVApplicationPtr vsoApp)
{
+ ////////////////////////////////////////////////////
//Message snapping
- if(m_bSnap && vsoApp->ActiveWindow->Selection->Count)
+#define _u(x) CPageUtils::ConvertUnits(vsoApp, x, 0, visPageUnits)
+ if(!m_bOnDropShape && m_bSnap && vsoApp->ActiveWindow->Selection->Count && CMessageSnapping::isEnabled())
{
Visio::IVSelectionPtr selection = vsoApp->ActiveWindow->Selection;
+ CDocumentMonitor* docMon = GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument);
if(selection->Count == 1)
{
Visio::IVShapePtr msgShape = selection->Item[1];
- if(msgShape && GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->isMessageShape(msgShape))
+ if(msgShape && m_bBeginChanged && m_bEndChanged && docMon->isMessageShape(msgShape))
{
- //Resize shape
- if(m_bMoving && (m_bBeginChanged ^ m_bEndChanged))
- {
- m_mousePosX = m_bBeginChanged ? msgShape->Cells["BeginX"]->Result[""] : msgShape->Cells["EndX"]->Result[""];
- m_mousePosY = m_bBeginChanged ? msgShape->Cells["BeginY"]->Result[""] : msgShape->Cells["EndY"]->Result[""];
- }
+ //If endpoints movement would be enabled, here would be condition (m_bMoving && (m_bBeginChanged ^ m_bEndChanged))
- GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->autoSnapping(msgShape,
- CPageUtils::ConvertUnits(vsoApp->ActivePage, m_mousePosX, 0, visPageUnits),
- CPageUtils::ConvertUnits(vsoApp->ActivePage, m_mousePosY, 0, visPageUnits));
+ //Get relative position of the mouse from the shape Begin
+ double newPosX = CShapeUtils::GetShapeCellProperty(msgShape,"PinX", visPageUnits);
+ double newPosY = CShapeUtils::GetShapeCellProperty(msgShape,"PinY", visPageUnits);
+
+ newPosX += CPageUtils::ConvertUnits(vsoApp, m_mouseRelPosX, 0, visPageUnits);
+ newPosY += CPageUtils::ConvertUnits(vsoApp, m_mouseRelPosY, 0, visPageUnits);
+
+
+ //Do snapping
+ docMon->autoSnapping(msgShape, newPosX, newPosY);
}
}
else //NOTE: Multiple selection - preserve connecting to instances
{
- MsgSnapType currentSnapType = CMessageSnapping::getSnapType();
- CMessageSnapping::setSnapType(MSSNAP_PRESERVE_SLOPE);
- for(int i=1; i<=selection->Count; i++)
- {
- Visio::IVShapePtr msgShape = selection->Item[i];
- if(GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->isMessageShape(msgShape))
- GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument)->autoSnapping(msgShape, msgShape->Cells["PinX"]->Result[visPageUnits],
- msgShape->Cells["PinY"]->Result[visPageUnits]);
- }
- CMessageSnapping::setSnapType(currentSnapType);
+ //Not implemented yet
}
}
//Set variables to false
- m_bSnap = m_bMoving = m_bBeginChanged = m_bEndChanged = false;
+ m_bSnap = m_bMoving = m_bBeginChanged = m_bEndChanged = m_bKeyDown = false;
+#undef _u
-
+ ////////////////////////////////////////////////////
//Message numbering
if(m_bShapeDeleted || m_bCellChanged)
{
@@ -749,6 +777,9 @@
//Set variables to false to prevent this function from loop
m_bShapeDeleted = m_bCellChanged = false;
}
+
+ //Reset OnDropShape state
+ m_bOnDropShape = false;
}
void CStudioAddon::HandleBeforeTextEdit(Visio::IVShapePtr shapePtr, Visio::IVApplicationPtr vsoApp)
@@ -856,7 +887,7 @@
vsoApp->EventList->AddAdvise(Visio::visEvtCodeKeyDown, varSink, _T(""), _T("KeyDown"));
vsoApp->EventList->AddAdvise(Visio::visEvtCodeKeyUp, varSink, _T(""), _T("KeyUp"));
vsoApp->EventList->AddAdvise(Visio::visEvtCodeMouseMove, varSink, _T(""), _T("MouseMove"));
- vsoApp->EventList->AddAdvise(Visio::visEvtCodeMouseUp, varSink, _T(""), _T("MouseUp"));
+ vsoApp->EventList->AddAdvise(Visio::visEvtCodeMouseDown, varSink, _T(""), _T("MouseDown"));
// Message enumeration events
vsoApp->EventList->AddAdvise(Visio::visEvtCodeShapeBeforeTextEdit, varSink, _T(""), _T("BeforeTextEdit"));
vsoApp->EventList->AddAdvise(Visio::visEvtCodeShapeExitTextEdit, varSink, _T(""), _T("AfterTextEdit"));
Modified: trunk/src/view/visio/addon/addon.h
===================================================================
--- trunk/src/view/visio/addon/addon.h 2010-07-16 11:51:14 UTC (rev 836)
+++ trunk/src/view/visio/addon/addon.h 2010-07-23 00:03:47 UTC (rev 837)
@@ -55,7 +55,7 @@
void HandleKeyDown(Visio::IVKeyboardEventPtr vsoKeyboardEvent, Visio::IVApplicationPtr vsoApp);
void HandleKeyUp(Visio::IVKeyboardEventPtr vsoKeyboardEvent, Visio::IVApplicationPtr vsoApp);
void HandleMouseMove(Visio::IVMouseEventPtr vsoMouseEvent, Visio::IVApplicationPtr vsoApp);
- void HandleMouseUp(Visio::IVMouseEventPtr vsoMouseEvent, Visio::IVApplicationPtr vsoApp);
+ void HandleMouseDown(Visio::IVMouseEventPtr vsoMouseEvent, Visio::IVApplicationPtr vsoApp);
void HandleWinSelChange(Visio::IVApplicationPtr vsoApp);
void HandleBeforeTextEdit(Visio::IVShapePtr shapePtr, Visio::IVApplicationPtr vsoApp);
void HandleAfterTextEdit(Visio::IVShapePtr shapePtr, Visio::IVApplicationPtr vsoApp);
@@ -116,6 +116,14 @@
*/
double GetPrevMousePosY(Visio::IVApplicationPtr vsoApp) { return m_prevMousePosY[vsoApp]; }
+ double GetRelMousePosX() { return m_mouseRelPosX; }
+ double GetRelMousePosY() { return m_mouseRelPosY; }
+
+ void SetOnDropShapeState(bool state) { m_bOnDropShape = state; m_bSnap = state; }
+ bool GetOnDropShapeState() { return m_bOnDropShape; }
+
+ bool GetCtrlKeyDown() { return m_bCtrlDown; }
+
private:
IUnknown *m_pIAddonSink;
Visio::IVEventPtr m_vsoMarkerEvent;
@@ -145,6 +153,11 @@
bool m_bBeginChanged;
bool m_bEndChanged;
bool m_bMoving;
+ bool m_bCtrlDown;
+ bool m_bKeyDown;
+ bool m_bOnDropShape;
+ double m_mouseRelPosX;
+ double m_mouseRelPosY;
};
// $Id$
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2010-07-16 11:51:14 UTC (rev 836)
+++ trunk/src/view/visio/addon/dllmodule.rc 2010-07-23 00:03:47 UTC (rev 837)
@@ -229,8 +229,8 @@
CAPTION "Dialog"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- CONTROL "Enable message snapping",IDC_SNAP_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,98,10
- GROUPBOX "Oblique message snapping options",IDC_STATIC,7,22,261,61
+ CONTROL "Message snapping enabled",IDC_SNAP_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,102,10
+ GROUPBOX "Oblique message options:",IDC_STATIC,7,22,261,61
CONTROL "straighten",IDC_STRAIGHTEN,"Button",BS_AUTORADIOBUTTON | WS_GROUP,13,37,47,10
CONTROL "preserve vertical distance between send - receive",IDC_PRESERVE_VERTICAL,
"Button",BS_AUTORADIOBUTTON,13,51,176,10
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-07-16 11:51:14 UTC (rev 836)
+++ trunk/src/view/visio/addon/document.cpp 2010-07-23 00:03:47 UTC (rev 837)
@@ -243,6 +243,7 @@
VAORC CDocumentMonitor::OnDropShape(int iDocumentIndex, int iPageIndex, _bstr_t sShapeU)
{
+ m_addon->SetOnDropShapeState(true);
// ignore events when undoing or redoing
if(m_vsoApp->IsUndoingOrRedoing == VARIANT_TRUE)
return VAORC_SUCCESS;
@@ -262,10 +263,19 @@
case ST_BMSC_MESSAGE_FOUND:
if(vsoShape->Text.length() == 0)
vsoShape->Text = _T("NAME");
- //Check whether snapping is enabled
- if(CMessageSnapping::isEnabled())
- autoSnapping(vsoShape,CPageUtils::ConvertUnits(m_vsoApp,m_addon->GetMousePosX(),0,visPageUnits),
- CPageUtils::ConvertUnits(m_vsoApp,m_addon->GetMousePosY(),0,visPageUnits));
+
+ if(CMessageSnapping::isEnabled()) //Check whether snapping is enabled
+ {
+ double posX = CShapeUtils::GetShapeCellProperty(vsoShape,"PinX",visPageUnits), posY = CShapeUtils::GetShapeCellProperty(vsoShape,"PinY",visPageUnits);
+ if(m_addon->GetCtrlKeyDown())
+ {
+ posX += CPageUtils::ConvertUnits(m_vsoApp, m_addon->GetRelMousePosX(), 0, visPageUnits);
+ posY += CPageUtils::ConvertUnits(m_vsoApp, m_addon->GetRelMousePosY(), 0, visPageUnits);
+ }
+ m_vsoApp->EventsEnabled = false;
+ autoSnapping(vsoShape,posX, posY);
+ m_vsoApp->EventsEnabled = true;
+ }
autoEnumerate(vsoShape);
break;
@@ -1691,7 +1701,7 @@
VAORC CDocumentMonitor::OnMenuGlobalSettings(Visio::IVApplicationPtr vsoApp)
{
- CGlobalSettingsDlg sheet(_T("Settings"));
+ CGlobalSettingsDlg sheet(vsoApp, _T("Settings"));
sheet.DoModal();
//Message Numbering processing
@@ -2154,6 +2164,9 @@
void CDocumentMonitor::autoSnapping(Visio::IVShapePtr msgShape, double posX, double posY)
{
+ long scopeID = msgShape->Application->BeginUndoScope(_T("AutoSnapping"));
+#define _sp(x) CShapeUtils::GetShapeCellProperty(msgShape, x, visPageUnits)
+
//Step 1: Get snap type
MsgSnapType snapType = CMessageSnapping::getSnapType();
@@ -2163,44 +2176,79 @@
return;
}
- double msgBegY = CShapeUtils::GetShapeCellProperty(msgShape,"BeginY", visPageUnits);
- double msgEndY = CShapeUtils::GetShapeCellProperty(msgShape,"EndY", visPageUnits);
+ double msgBegY = _sp("BeginY"), msgEndY = _sp("EndY");
+ VEC2 msgVec(msgShape->Cells["EndX"]->Result[""] - msgShape->Cells["BeginX"]->Result[""], //NOTE: vector for preservind message length
+ msgShape->Cells["EndY"]->Result[""]- msgShape->Cells["BeginY"]->Result[""]);
- //if message is only horizontal we can take as Y coord PinY and don't have to calculate oblique
- if(msgShape->Cells["BeginY"]->Result[visPageUnits] == msgEndY) //DODELAT!
+ //Step 2: If message is only horizontal we can take as Y coord PinY and don't have to calculate oblique
+ if(msgBegY == msgEndY)
{
- posY = CShapeUtils::GetShapeCellProperty(msgShape, "PinY", visPageUnits);
+ posY = _sp("PinY");
snapType = MSSNAP_STRAIGHTEN;
}
-
- //Step 2: Get all instance matching criteria
+
+ //Step 3: Get all instance matching criteria
std::vector<Visio::IVShapePtr> instShapes = CMessageSnapping::getIntersectInstances(msgShape, posY, snapType);
- //Step 3: Get the closest instance on the left and on the right
- std::pair<Visio::IVShapePtr,Visio::IVShapePtr> closestInst = CMessageSnapping::getClosestInstancePair(msgShape, posX, posY, instShapes, snapType);
-
- //Step 4:Glue to them
+ //Step 4: Get the closest instance on the left and on the right
+ std::pair<Visio::IVShapePtr,Visio::IVShapePtr> closestInst;
+ if(snapType == MSSNAP_PRESERVE_VERTICAL)
+ {
+ //left closest instance
+ std::pair<Visio::IVShapePtr,Visio::IVShapePtr> closestInstLeft = CMessageSnapping::getClosestInstancePair(msgShape, posX, _sp("BeginY"), instShapes, MSSNAP_STRAIGHTEN);
+ std::pair<Visio::IVShapePtr,Visio::IVShapePtr> closestInstRight = CMessageSnapping::getClosestInstancePair(msgShape, posX, _sp("EndY"), instShapes, MSSNAP_STRAIGHTEN);
+ closestInst.first = ((_sp("BeginX") - _sp("EndX")) < 0) ? closestInstLeft.first : closestInstRight.first;
+ closestInst.second =((_sp("BeginX") - _sp("EndX")) < 0) ? closestInstRight.second : closestInstLeft.second;
+ }
+ else
+ closestInst = CMessageSnapping::getClosestInstancePair(msgShape, posX, posY, instShapes, snapType);
+
+ //Step 5:Glue to them
CMessageSnapping::glueMsgToInstancesPair(msgShape, closestInst.first, closestInst.second,posY, snapType);
-
- //Step 5: Straighten messages when it's snapped only to one instance (must disable events, because CellChanged would be triggered)
- if((closestInst.first ^ closestInst.second) && snapType == MSSNAP_STRAIGHTEN)
+
+ //Step 6: Do some corrections
+ if(closestInst.first ^ closestInst.second)
{
- if((CShapeUtils::GetShapeCellProperty(msgShape, "EndX", visPageUnits) - CShapeUtils::GetShapeCellProperty(msgShape, "BeginX", visPageUnits)) < 0)
+ //Step 6.1: If message is left-oriented switch pointers
+ if((_sp("EndX") - _sp("BeginX")) < 0)
{
Visio::IVShapePtr buffer = closestInst.first;
closestInst.first = closestInst.second;
closestInst.second = buffer;
}
+
+ //Step 6.2: Straighten messages when it's snapped only to one instance (must disable events, because CellChanged would be triggered)
+ if(snapType == MSSNAP_STRAIGHTEN)
+ {
+ msgShape->Application->EventsEnabled = false;
+ if(!closestInst.second)
+ msgShape->Cells["EndY"]->FormulaU = stringize() << msgShape->Cells["BeginY"]->Result[""];
+ else if(!closestInst.first)
+ msgShape->Cells["BeginY"]->FormulaU = stringize() << msgShape->Cells["EndY"]->Result[""];
+ msgShape->Application->EventsEnabled = true;
+ }
+ //Step 6.3: If message is snapped only to one instance, preserve its length
msgShape->Application->EventsEnabled = false;
- if(!closestInst.second)
- msgShape->Cells["EndY"]->FormulaU = stringize() << msgShape->Cells["BeginY"]->Result[""];
- else if(!closestInst.first)
- msgShape->Cells["BeginY"]->FormulaU = stringize() << msgShape->Cells["EndY"]->Result[""];
+ if(closestInst.first) //LEFT point is snapped, adjust right point
+ {
+ msgShape->Cells["EndX"]->FormulaU = stringize() << msgShape->Cells["BeginX"]->Result[""] + msgVec.x;
+ if(snapType != MSSNAP_STRAIGHTEN) msgShape->Cells["EndY"]->FormulaU = stringize() << msgShape->Cells["BeginY"]->Result[""] + msgVec.y;
+ }
+
+ if(closestInst.second) //RIGHT point is snapped, adjust left point
+ {
+ msgShape->Cells["BeginX"]->FormulaU = stringize() << msgShape->Cells["EndX"]->Result[""] - msgVec.x;
+ if(snapType != MSSNAP_STRAIGHTEN) msgShape->Cells["BeginY"]->FormulaU = stringize() << msgShape->Cells["EndY"]->Result[""] - msgVec.y;
+ }
msgShape->Application->EventsEnabled = true;
}
- //FIXME: preserve vertical distance can't sometimes find the closest instance
+#undef _sp
+ msgShape->Application->EndUndoScope(scopeID,true);
+
+ //FIXME: When MSSNAP_STRAIGHTEN is in use then copying msgs using ctrl doesn't work correctly
+ //FIXME: When user add a new shape and hold ctrl key, snapping doesn't work correctly
}
// $Id$
Modified: trunk/src/view/visio/addon/globalSettingsDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/globalSettingsDlg.cpp 2010-07-16 11:51:14 UTC (rev 836)
+++ trunk/src/view/visio/addon/globalSettingsDlg.cpp 2010-07-23 00:03:47 UTC (rev 837)
@@ -20,13 +20,13 @@
#include "dllmodule.h"
#include "GlobalSettingsDlg.h"
-CGlobalSettingsDlg::CGlobalSettingsDlg(ATL::_U_STRINGorID title,UINT uStartPage, HWND hWndParent):
+CGlobalSettingsDlg::CGlobalSettingsDlg(Visio::IVApplicationPtr vsoApp, ATL::_U_STRINGorID title,UINT uStartPage, HWND hWndParent):
CPropertySheetImpl<CGlobalSettingsDlg>(title,uStartPage,hWndParent)
{
m_bCentered = false;
//Disable APPLY button and CONTEXT HELP button
- m_psh.dwFlags |= PSH_NOAPPLYNOW | PSH_NOCONTEXTHELP;
+ m_psh.dwFlags |= PSH_NOAPPLYNOW | PSH_NOCONTEXTHELP | PSH_HASHELP;
//Adding pages
page1.SetTitle(_T("Numbering")); AddPage(page1);
Modified: trunk/src/view/visio/addon/globalSettingsDlg.h
===================================================================
--- trunk/src/view/visio/addon/globalSettingsDlg.h 2010-07-16 11:51:14 UTC (rev 836)
+++ trunk/src/view/visio/addon/globalSettingsDlg.h 2010-07-23 00:03:47 UTC (rev 837)
@@ -29,7 +29,7 @@
class CGlobalSettingsDlg : public CPropertySheetImpl<CGlobalSettingsDlg>
{
public:
- CGlobalSettingsDlg(ATL::_U_STRINGorID title = (LPCTSTR) NULL,
+ CGlobalSettingsDlg(Visio::IVApplicationPtr vsoApp, ATL::_U_STRINGorID title = (LPCTSTR) NULL,
UINT uStartPage = 0, HWND hWndParent = NULL);
BEGIN_MSG_MAP(CGlobalSettingsDlg)
@@ -46,6 +46,8 @@
//Pages of property sheet
CNumberingGlobalDlg page1;
CSnapGlobalDlg page2;
+
+ Visio::IVApplicationPtr m_vsoApp;
};
// $Id$
\ No newline at end of file
Modified: trunk/src/view/visio/addon/messageSnapping.cpp
===================================================================
--- trunk/src/view/visio/addon/messageSnapping.cpp 2010-07-16 11:51:14 UTC (rev 836)
+++ trunk/src/view/visio/addon/messageSnapping.cpp 2010-07-23 00:03:47 UTC (rev 837)
@@ -23,10 +23,7 @@
bool CMessageSnapping::isEnabled()
{
- if(!GetRegistry<bool>(_T("Software\\Sequence Chart Studio\\MessageSnapping"), NULL, _T("SnapEnabled"), 0))
- return false;
-
- return true;
+ return GetRegistry<bool>(_T("Software\\Sequence Chart Studio\\MessageSnapping"), NULL, _T("SnapEnabled"), 0);
}
MsgSnapType CMessageSnapping::getSnapType()
@@ -85,6 +82,7 @@
PVEC2 result = getIntersectionWithInstance(msgShape, shape);
if(result)
instShapes.push_back(shape);
+
delete result;
}
else
@@ -101,23 +99,40 @@
std::pair<Visio::IVShapePtr, Visio::IVShapePtr> CMessageSnapping::getClosestInstancePair(Visio::IVShapePtr msgShape, double msgSnapPointX, double msgSnapPointY,
const std::vector<Visio::IVShapePtr>& instances, MsgSnapType snapType)
{
- /*
- TODO: try to find a way how to get closest instance better when instance is in diagonal position
- For example, compute intersection as a intersection of two vectors
- */
Visio::IVShapePtr leftClosestInstance = NULL;
Visio::IVShapePtr rightClosestInstance = NULL;
double leftClosestInstanceDist = 0, rightClosestInstanceDist = 0;
- double instPinX, instPinY, distance, mouseDistX;
+ double instBeginX, instBeginY, instEndX, instEndY, distance, mouseDistX;
+ double msgBeginY = msgShape->Cells["BeginY"]->Result[visPageUnits];
+ double msgEndY = msgShape->Cells["EndY"]->Result[visPageUnits];
+
+#define _ip(x) CShapeUtils::GetShapeCellProperty((*it),x, visPageUnits);
+
for(std::vector<Visio::IVShapePtr>::const_iterator it = instances.begin(); it != instances.end(); it++)
{
- instPinX = CShapeUtils::GetShapeCellProperty((*it),"PinX", visPageUnits);
- instPinY = CShapeUtils::GetShapeCellProperty((*it),"PinY", visPageUnits);
+ instBeginX = _ip("BeginX"); instBeginY = _ip("BeginY"); instEndX = _ip("EndX"); instEndY = _ip("EndY");
- distance = sqrt(pow((msgSnapPointX - instPinX),2) + pow((msgSnapPointY - instPinY),2));
- mouseDistX = msgSnapPointX - instPinX;
+ //Get intersection point with instance
+ PVEC2 intPoint = NULL;
+ switch(snapType)
+ {
+ case MSSNAP_STRAIGHTEN:
+ intPoint = CPageUtils::getIntersectionPoint(VEC2(msgSnapPointX, msgSnapPointY), VEC2(msgSnapPointX - 1, msgSnapPointY), VEC2(instEndX, instEndY), VEC2(instBeginX, instBeginY));
+ break;
+ case MSSNAP_PRESERVE_SLOPE:
+ intPoint = CMessageSnapping::getIntersectionWithInstance(msgShape, (*it));
+ break;
+ }
+
+ if(!intPoint || intPoint->y > instBeginY || intPoint->y < instEndY)
+ continue;
+ mouseDistX = msgSnapPointX - intPoint->x;
+ distance = sqrt(pow((msgSnapPointX - intPoint->x),2) + pow((msgSnapPointY - intPoint->y),2));
+
+ delete intPoint;
+
if(mouseDistX < 0)
{
if(!rightClosestInstance || distance < rightClosestInstanceDist)
@@ -138,6 +153,22 @@
return std::pair<Visio::IVShapePtr, Visio::IVShapePtr>(NULL,NULL); //NOTE: Ordinary snap will handle position change
}
+#undef _ip
+
+ //restrict snapping for FOUND and LOST messages
+ double shapeLeft = msgShape->Cells["BeginX"]->Result[""];
+ double shapeRight = msgShape->Cells["EndX"]->Result[""];
+
+ switch(get_shape_type(msgShape))
+ {
+ case ST_BMSC_MESSAGE_FOUND:
+ (shapeLeft <= shapeRight) ? leftClosestInstance = NULL : rightClosestInstance = NULL;
+ break;
+ case ST_BMSC_MESSAGE_LOST:
+ (shapeLeft <= shapeRight) ? rightClosestInstance = NULL : leftClosestInstance = NULL;
+ break;
+ }
+
return std::pair<Visio::IVShapePtr, Visio::IVShapePtr>(leftClosestInstance,rightClosestInstance);
}
@@ -156,17 +187,6 @@
rightInstance = buffer;
}
- //restrict snapping for FOUND and LOST messages
- switch(get_shape_type(msgShape))
- {
- case ST_BMSC_MESSAGE_FOUND:
- leftInstance = NULL;
- break;
- case ST_BMSC_MESSAGE_LOST:
- rightInstance = NULL;
- break;
- }
-
double yLeftPos, yRightPos;
double msgBegY = CShapeUtils::GetShapeCellProperty(msgShape,"BeginY", visPageUnits);
double msgEndY = CShapeUtils::GetShapeCellProperty(msgShape,"EndY", visPageUnits);
@@ -241,17 +261,19 @@
PVEC2 CMessageSnapping::getIntersectionWithInstance(Visio::IVShapePtr msgShape, Visio::IVShapePtr instanceShape)
{
+#define _s(x) CShapeUtils::GetShapeCellProperty(msgShape, x, visPageUnits)
+#define _i(x) CShapeUtils::GetShapeCellProperty(instanceShape, x, visPageUnits)
+
VEC2 p1,p2,p3,p4;
- p1.x = CShapeUtils::GetShapeCellProperty(msgShape,"EndX", visPageUnits);
- p1.y = CShapeUtils::GetShapeCellProperty(msgShape,"EndY", visPageUnits);
- p2.x = CShapeUtils::GetShapeCellProperty(msgShape,"BeginX", visPageUnits);
- p2.y = CShapeUtils::GetShapeCellProperty(msgShape,"BeginY", visPageUnits);
+ p1.x = _s("EndX"); p1.y = _s("EndY");
+ p2.x = _s("BeginX"); p2.y = _s("BeginY");
- p3.x = CShapeUtils::GetShapeCellProperty(instanceShape,"EndX", visPageUnits);
- p3.y = CShapeUtils::GetShapeCellProperty(instanceShape,"EndY", visPageUnits);
- p4.x = CShapeUtils::GetShapeCellProperty(instanceShape,"BeginX", visPageUnits);
- p4.y = CShapeUtils::GetShapeCellProperty(instanceShape,"BeginY", visPageUnits);
+ p3.x = _i("EndX"); p3.y = _i("EndY");
+ p4.x = _i("BeginX"); p4.y = _i("BeginY");
+#undef _s
+#undef _i
+
PVEC2 result = CPageUtils::getIntersectionPoint(p1, p2, p3, p4);
if(!result)
return NULL;
Modified: trunk/src/view/visio/addon/numberingGlobalDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/numberingGlobalDlg.cpp 2010-07-16 11:51:14 UTC (rev 836)
+++ trunk/src/view/visio/addon/numberingGlobalDlg.cpp 2010-07-23 00:03:47 UTC (rev 837)
@@ -20,9 +20,11 @@
#include "dllmodule.h"
#include "numberingGlobalDlg.h"
#include "enumerateUtils.h"
+#include "document.h"
BOOL CNumberingGlobalDlg::OnInitDialog(HWND hWndFocus, LPARAM lParam)
{
+ //Loading registry data
m_bAutoEnum = GetRegistry<bool>(GetRegistryFolder(), NULL, _T("AutoEnum"), 0);
DoDataExchange(FALSE); //update data from variables to fields
@@ -130,6 +132,7 @@
return PSNRET_INVALID;
}
+
void CNumberingGlobalDlg::EnableAllControls(bool bEnable)
{
m_nearestMsg.EnableWindow(bEnable);
Modified: trunk/src/view/visio/addon/numberingGlobalDlg.h
===================================================================
--- trunk/src/view/visio/addon/numberingGlobalDlg.h 2010-07-16 11:51:14 UTC (rev 836)
+++ trunk/src/view/visio/addon/numberingGlobalDlg.h 2010-07-23 00:03:47 UTC (rev 837)
@@ -34,6 +34,10 @@
public:
enum { IDD = IDD_NUMBERING_GLOBAL };
+ CNumberingGlobalDlg() { //set dialog properties
+ m_psp.dwFlags |= PSP_HASHELP;
+ };
+
BEGIN_MSG_MAP(CNumberingGlobalDlg)
MSG_WM_INITDIALOG(OnInitDialog)
CHAIN_MSG_MAP(CPropertyPageIm...
[truncated message content] |
|
From: <ma...@us...> - 2010-08-20 13:49:33
|
Revision: 846
http://scstudio.svn.sourceforge.net/scstudio/?rev=846&view=rev
Author: madzin
Date: 2010-08-20 13:49:27 +0000 (Fri, 20 Aug 2010)
Log Message:
-----------
repair bug ID: 3003860
Modified Paths:
--------------
trunk/src/data/Z120/Context.cpp
trunk/tests/z120_test/CMakeLists.txt
Added Paths:
-----------
trunk/tests/z120_test/z120_test88.mpr
trunk/tests/z120_test/z120_test88.mpr.result
Modified: trunk/src/data/Z120/Context.cpp
===================================================================
--- trunk/src/data/Z120/Context.cpp 2010-08-13 22:23:37 UTC (rev 845)
+++ trunk/src/data/Z120/Context.cpp 2010-08-20 13:49:27 UTC (rev 846)
@@ -816,43 +816,49 @@
std::set<std::string>::iterator it;
std::map<std::string, EventPtr>::iterator named_event_it;
CoregionEventPtr event = boost::dynamic_pointer_cast<CoregionEvent>(context->current_event);
+
if(event == NULL){
- context->z->print_report(RS_WARNING, stringize() << L"Warning 13: Event of " << context->current_event->get_message()->get_label() << " message is not in coregion");
-
+ std::wstring warning = L"Warning 13: Event of " + context->current_event->get_message()->get_label();
+ warning = warning + L" message is not in coregion";
+ context->z->print_report(RS_WARNING, stringize() << warning);
return;
}
- for(it = context->order_events.begin(); it != context->order_events.end(); ++it){
- if((named_event_it = context->named_events.find(*it)) != context->named_events.end()){
-
- CoregionEventPtr event1 = boost::dynamic_pointer_cast<CoregionEvent>(named_event_it->second);
-
- if(event1 != NULL)
+
+ for(it = context->order_events.begin(); it != context->order_events.end(); ++it)
+ {
+ CoregionEventPtr event1;
+
+ if((named_event_it = context->named_events.find(*it)) != context->named_events.end())
+ {
+ event1 = boost::dynamic_pointer_cast<CoregionEvent>(named_event_it->second);
+ }
+ else
+ {
+ std::map<std::string, EventPtr>::iterator future_it = context->future_events.find(*it);
+
+ if(future_it != context->future_events.end())
{
- if(kind == before)
- {
- event->add_successor(event1.get());
- }
- else
- {
- event1->add_successor(event.get());
- }
+ event1 = boost::dynamic_pointer_cast<CoregionEvent>(future_it->second);
}
- }
- else{
- InstancePtr instance = context->instances.find(context->element_name)->second;
+ else
+ {
+ InstancePtr instance = context->instances.find(context->element_name)->second;
+ EventPtr e = instance->get_last()->add_event();
+ event1 = boost::dynamic_pointer_cast<CoregionEvent>(e);
- EventPtr event1 = instance->get_last()->add_event();
- CoregionEventPtr event2 = boost::dynamic_pointer_cast<CoregionEvent>(event1);
- context->future_events.insert(std::make_pair(*it, event2));
-
- if(kind == before){
- event->add_successor(event2.get());
+ context->future_events.insert(std::make_pair(*it, event1));
}
- else{
- event2->add_successor(event.get());
- }
}
+
+ if(event1 != NULL)
+ {
+ if(kind == before)
+ event->add_successor(event1.get());
+ else
+ event1->add_successor(event.get());
+ }
}
+
context->order_events.clear();
}
Modified: trunk/tests/z120_test/CMakeLists.txt
===================================================================
--- trunk/tests/z120_test/CMakeLists.txt 2010-08-13 22:23:37 UTC (rev 845)
+++ trunk/tests/z120_test/CMakeLists.txt 2010-08-20 13:49:27 UTC (rev 846)
@@ -95,6 +95,7 @@
ADD_Z120_TEST(z120_test85.mpr 1)
ADD_Z120_TEST(z120_test86.mpr 1)
ADD_Z120_TEST(z120_test87.mpr 1)
+ADD_Z120_TEST(z120_test88.mpr 1)
ADD_Z120_TEST(z120_time01.mpr 1)
ADD_Z120_TEST(z120_time02.mpr 1)
Added: trunk/tests/z120_test/z120_test88.mpr
===================================================================
--- trunk/tests/z120_test/z120_test88.mpr (rev 0)
+++ trunk/tests/z120_test/z120_test88.mpr 2010-08-20 13:49:27 UTC (rev 846)
@@ -0,0 +1,30 @@
+mscdocument Pada.vsd;
+msc Pada_export_import;
+inst A;
+inst I;
+inst S;
+inst H;
+A: instance;
+in SIP,0 from I;
+endinstance;
+I: instance;
+concurrent;
+out SIP,0 to A before e0, e1, e1;
+in Trying,1 from S before e2;
+label e0;
+out INV,2 to S before e1;
+label e1;
+in Resp,3 from H;
+label e2;
+out Query,4 to H;
+endconcurrent;
+endinstance;
+S: instance;
+in INV,2 from I;
+out Trying,1 to I;
+endinstance;
+H: instance;
+in Query,4 from I;
+out Resp,3 to I;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_test88.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test88.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_test88.mpr.result 2010-08-20 13:49:27 UTC (rev 846)
@@ -0,0 +1,32 @@
+OK: z120_test88 is correct, should be correct
+
+mscdocument z120_test88;
+msc Pada_export_import;
+inst A;
+inst I;
+inst S;
+inst H;
+A: instance;
+in SIP,0 from I;
+endinstance;
+I: instance;
+concurrent;
+out SIP,0 to A before e0, e1;
+in Trying,1 from S before e2;
+label e0;
+out INV,2 to S before e1;
+label e1;
+in Resp,3 from H;
+label e2;
+out Query,4 to H;
+endconcurrent;
+endinstance;
+S: instance;
+in INV,2 from I;
+out Trying,1 to I;
+endinstance;
+H: instance;
+in Query,4 from I;
+out Resp,3 to I;
+endinstance;
+endmsc;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-08-22 11:57:42
|
Revision: 849
http://scstudio.svn.sourceforge.net/scstudio/?rev=849&view=rev
Author: madzin
Date: 2010-08-22 11:57:36 +0000 (Sun, 22 Aug 2010)
Log Message:
-----------
repair bug ID: 2963655
Modified Paths:
--------------
trunk/src/data/Z120/Context.cpp
trunk/src/data/msc.cpp
trunk/tests/z120_test/z120_test69.mpr.result
trunk/tests/z120_test/z120_test86.mpr.result
Modified: trunk/src/data/Z120/Context.cpp
===================================================================
--- trunk/src/data/Z120/Context.cpp 2010-08-21 20:23:17 UTC (rev 848)
+++ trunk/src/data/Z120/Context.cpp 2010-08-22 11:57:36 UTC (rev 849)
@@ -278,6 +278,27 @@
}
if(!context->future_events.empty()){
+ std::map<std::string, EventPtr>::iterator future_it;
+ CoregEventRelPtrVector predecessors_rel;
+ CoregionEvent* predecessor;
+ CoregionEventPtr future_e;
+
+ for(future_it = context->future_events.begin(); future_it != context->future_events.end(); future_it++)
+ {
+ future_e = boost::dynamic_pointer_cast<CoregionEvent>(future_it->second);
+
+ if(future_e != NULL)
+ {
+ predecessors_rel = future_e->get_predecessors();
+
+ for(unsigned int i = 0; i < predecessors_rel.size(); i++)
+ {
+ predecessor = predecessors_rel[i]->get_predecessor();
+ predecessor->remove_successor(predecessors_rel[i]);
+ }
+ }
+ }
+ context->future_events.clear();
context->z->print_report(RS_WARNING, L"Warning 06: Dependency on nonexisting event\n");
}
Modified: trunk/src/data/msc.cpp
===================================================================
--- trunk/src/data/msc.cpp 2010-08-21 20:23:17 UTC (rev 848)
+++ trunk/src/data/msc.cpp 2010-08-22 11:57:36 UTC (rev 849)
@@ -338,10 +338,21 @@
void CoregionEvent::remove_successor(const CoregEventRelPtr& e)
{
+CoregEventRelPtrVector::iterator it;
+
+for(it = m_successors.begin(); it != m_successors.end(); it++)
+{
+ if(*it == e)
+ break;
+}
+m_successors.erase(it);
+
// m_successors.erase(e)
// note: vector does not support the erase() function
+/*
std::remove_if(m_successors.begin(), m_successors.end(),
- std::bind2nd(std::equal_to<CoregEventRelPtr>(), e));
+ std::bind2nd(std::equal_to<CoregEventRelPtr>(), e));
+*/
if(!has_successors())
get_coregion_area()->add_maximal_event(this);
Modified: trunk/tests/z120_test/z120_test69.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test69.mpr.result 2010-08-21 20:23:17 UTC (rev 848)
+++ trunk/tests/z120_test/z120_test69.mpr.result 2010-08-22 11:57:36 UTC (rev 849)
@@ -19,12 +19,10 @@
out SYNACK,1 to PC;
in ACK,2 from PC;
concurrent;
-in request_a,3 from PC before e0, e1;
+in request_a,3 from PC before e0;
in request_b,4 from PC;
label e0;
out result,5 to PC;
-label e1;
-;
endconcurrent;
endinstance;
endmsc;
Modified: trunk/tests/z120_test/z120_test86.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test86.mpr.result 2010-08-21 20:23:17 UTC (rev 848)
+++ trunk/tests/z120_test/z120_test86.mpr.result 2010-08-22 11:57:36 UTC (rev 849)
@@ -14,9 +14,7 @@
in a,0 from NAME2;
in a,1 from found before e0;
label e0;
-out b,2 to NAME2 before e1;
-label e1;
-;
+out b,2 to NAME2;
endconcurrent;
endinstance;
NAME2: instance;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-08-30 16:42:23
|
Revision: 865
http://scstudio.svn.sourceforge.net/scstudio/?rev=865&view=rev
Author: madzin
Date: 2010-08-30 16:42:17 +0000 (Mon, 30 Aug 2010)
Log Message:
-----------
Repair relationships in remove_event method of aoregion area and add test
Modified Paths:
--------------
trunk/src/data/msc.cpp
trunk/tests/z120_test/CMakeLists.txt
Added Paths:
-----------
trunk/tests/z120_test/z120_test89.mpr
Modified: trunk/src/data/msc.cpp
===================================================================
--- trunk/src/data/msc.cpp 2010-08-29 21:22:38 UTC (rev 864)
+++ trunk/src/data/msc.cpp 2010-08-30 16:42:17 UTC (rev 865)
@@ -321,13 +321,21 @@
void CoregionArea::remove_event(CoregionEventPtr e)
{
- //remove connections between event's predecessors
+ CoregEventRelPtrVector successors_rel = e->get_successors();
CoregEventRelPtrVector predecessors_rel = e->get_predecessors();
CoregionEvent* predecessor;
for(unsigned int i = 0; i < predecessors_rel.size(); i++)
{
predecessor = predecessors_rel[i]->get_predecessor();
+
+ //set relations among event's successors and predecessors
+ for(unsigned j = 0; j < successors_rel.size(); j++)
+ {
+ predecessor->add_successor(successors_rel[j]);
+ }
+
+ //remove connection between event's predecessor and event
predecessor->remove_successor(predecessors_rel[i]);
}
Modified: trunk/tests/z120_test/CMakeLists.txt
===================================================================
--- trunk/tests/z120_test/CMakeLists.txt 2010-08-29 21:22:38 UTC (rev 864)
+++ trunk/tests/z120_test/CMakeLists.txt 2010-08-30 16:42:17 UTC (rev 865)
@@ -96,6 +96,7 @@
ADD_Z120_TEST(z120_test86.mpr 1)
ADD_Z120_TEST(z120_test87.mpr 1)
ADD_Z120_TEST(z120_test88.mpr 1)
+ADD_Z120_TEST(z120_test89.mpr 1)
ADD_Z120_TEST(z120_time01.mpr 1)
ADD_Z120_TEST(z120_time02.mpr 1)
Added: trunk/tests/z120_test/z120_test89.mpr
===================================================================
--- trunk/tests/z120_test/z120_test89.mpr (rev 0)
+++ trunk/tests/z120_test/z120_test89.mpr 2010-08-30 16:42:17 UTC (rev 865)
@@ -0,0 +1,25 @@
+mscdocument z120_test89;
+msc Strnka1;
+inst PC;
+inst Server;
+PC: instance;
+out SYN,0 to Server;
+in SYNACK,1 from Server;
+out ACK,2 to Server;
+out request_a,3 to Server;
+out request_b,4 to Server;
+in result,5 from Server;
+endinstance;
+Server: instance;
+in SYN,0 from PC;
+out SYNACK,1 to PC;
+in ACK,2 from PC;
+concurrent;
+in request_a,3 from PC before e2;
+label e0;
+out result,5 to PC after e2;
+label e1;
+in request_b,4 from PC before e2 after e2;
+endconcurrent;
+endinstance;
+endmsc;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lko...@us...> - 2010-09-03 14:13:06
|
Revision: 870
http://scstudio.svn.sourceforge.net/scstudio/?rev=870&view=rev
Author: lkorenciak
Date: 2010-09-03 14:12:59 +0000 (Fri, 03 Sep 2010)
Log Message:
-----------
fixed few bugs
Modified Paths:
--------------
trunk/src/check/time/tightening.h
trunk/src/check/time/time_pseudocode.h
trunk/src/check/time/time_trace_race.h
trunk/src/data/msc.h
Added Paths:
-----------
trunk/tests/time/CMakeFiles/
Modified: trunk/src/check/time/tightening.h
===================================================================
--- trunk/src/check/time/tightening.h 2010-09-03 13:37:25 UTC (rev 869)
+++ trunk/src/check/time/tightening.h 2010-09-03 14:12:59 UTC (rev 870)
@@ -267,11 +267,13 @@
for(TimeRelationRefNodePtrSet::const_iterator it=top->begin();it!=top->end();it++)
{
if(open_rel.find(it->get()) != open_rel.end())
- {
+ {//time relation is open -> close it
const TimeRelationRefNodePtrSet* other;
+ //find the correct time relation (for getting previously created
+ // node to which the processed time relation (it*) should be connected)
if(ref==(*it)->get_ref_node_a()&&(*it)->is_top_node_a())
{
- if((*it)->is_top_node_b())
+ if((*it)->is_top_node_b())
other = &((*it)->get_ref_node_b()->get_time_relations_top());
else
other = &((*it)->get_ref_node_b()->get_time_relations_bottom());
@@ -283,10 +285,11 @@
else
other = &((*it)->get_ref_node_a()->get_time_relations_bottom());
}
- b_matrix.fill(a,rel_to_event[other],(*it)->get_interval_set());
- b_matrix.tied_rel_to_cell(*it,a, rel_to_event[other]);
+ //fill the time relation to the matrix (node a was found later)
+ b_matrix.fill(rel_to_event[other],a,(*it)->get_interval_set());
+ b_matrix.tied_rel_to_cell(*it,rel_to_event[other],a);
}
- else
+ else //time relation has not been opened yet -> open it
open_rel.insert((*it).get());
}
@@ -301,7 +304,7 @@
std::vector<std::pair<EventP,EventP> > floor(max.size());
for(MaximalEventPList::iterator m=max.begin();m!=max.end();m++)
{
- Event* copy = dynamic_cast<Event*>(duplicator.get_copy_with_occurence(*m,bmsc_to_count[in.get()]));
+ Event* copy = dynamic_cast<Event*>(duplicator.get_copy_with_occurence(*m,bmsc_to_count[in.get()]));
b_matrix.fill(copy,a,MscTimeIntervalD(0,D::infinity()));
floor.push_back(std::make_pair<EventP,EventP>(copy,a));
}
@@ -312,8 +315,10 @@
for(TimeRelationRefNodePtrSet::iterator it=bottom->begin();it!=bottom->end();it++)
{
if(open_rel.find(it->get()) != open_rel.end())
- {
+ { //time relation is open -> close it
const TimeRelationRefNodePtrSet* other;
+ //find the correct time relation (for getting previously created
+ // node to which the processed time relation (it*) should be connected)
if(ref==(*it)->get_ref_node_a()&&(*it)->is_bottom_node_a())
{
if((*it)->is_top_node_b())
@@ -328,10 +333,11 @@
else
other = &((*it)->get_ref_node_a()->get_time_relations_bottom());
}
+ //fill the time relation to the matrix (node a was found later)
b_matrix.fill(rel_to_event[other],a,(*it)->get_interval_set());
b_matrix.tied_rel_to_cell(*it,rel_to_event[other],a);
}
- else
+ else //time relation has not been opened yet -> open it
open_rel.insert((*it).get());
}
}
Modified: trunk/src/check/time/time_pseudocode.h
===================================================================
--- trunk/src/check/time/time_pseudocode.h 2010-09-03 13:37:25 UTC (rev 869)
+++ trunk/src/check/time/time_pseudocode.h 2010-09-03 14:12:59 UTC (rev 870)
@@ -225,7 +225,7 @@
using IntervalSetMatrix::operator();
- //! return number of event in matrix
+ //! return position of the event in the matrix
const unsigned get_number(EventP e)
{
return m_event_to_number[e];
Modified: trunk/src/check/time/time_trace_race.h
===================================================================
--- trunk/src/check/time/time_trace_race.h 2010-09-03 13:37:25 UTC (rev 869)
+++ trunk/src/check/time/time_trace_race.h 2010-09-03 14:12:59 UTC (rev 870)
@@ -23,6 +23,7 @@
#include "data/dfs_hmsc_traverser.h"
#include "data/dfs_hmsc_flat_traverser.h"
#include "data/dfs_events_traverser.h"
+#include "data/Z120/z120.h"
#include "check/pseudocode/utils.h"
#include "check/time/export.h"
@@ -74,7 +75,6 @@
public:
void on_path_found(MscElementPList& path){
-
//code for testing:
// std::cout << "new path:" << std::endl;
//
@@ -93,7 +93,16 @@
HMscTighter tighter; //TODO ONDRA?? preco causal nemozem nastavit rovno???
(tighter).set_causal();
std::pair<BMscIntervalSetMatrix,IntervalSetMatrix> pair = (tighter).tighten_BMscGraph_path(path);
+
+//code for testing:
+/* Z120 z120;
+ BMscPtr bmsc_copy_2;
+ HMscFlatPathToBMscDuplicator duplicator2;
+ bmsc_copy_2 = duplicator2.duplicate_path(path);
+ z120.save_msc(std::cout,L"duplicated_path",bmsc_copy_2);*/
+
+
//check time race
// get matrix after tightening
BMscIntervalSetMatrix causal_matrix = pair.first;
@@ -107,26 +116,28 @@
EventTopologyHandler handler(causal_matrix.get_original_bmsc());
// EventTopologyHandler handler = *causal_matrix.get_m_event_topology_handler(); //TODO why this is not possible? ask Ondra!!!
-
for (e_before=events.begin();e_before!=events.end();e_before++)
{
for (e_after=events.begin();e_after!=events.end();e_after++)
{
if (handler.visual_is_leq(*e_before,*e_after))
{
-
//check whether intersection (-infty,0) and constraint corresponding to e_before and e_after is empty
if(!MscTimeIntervalSetD::set_intersection(MscTimeIntervalD(0,-D::infinity(),0,0),
matrix_result.operator()(causal_matrix.get_number(*e_before),
- causal_matrix.get_number(*e_after))).is_empty()
- && ((*e_before)->get_instance() == (*e_after)->get_instance())
+ causal_matrix.get_number(*e_after))).is_empty()){
+ Instance* instance1 = (*e_before)->get_instance();
+ Instance* instance2 = (*e_after)->get_instance();
+ if(instance1 && instance2
+ && instance1 == instance2
) //races are only on the same instance
{
+
//time race found
//duplicate hmsc
Event* event_original1 = *e_before;
Event* event_original2 = *e_after;
-
+
while(event_original1->get_original()!=NULL)
{
event_original1 = event_original1->get_original();
@@ -162,7 +173,7 @@
//throw exception with counterexample HMSC
throw TimeRaceInHMscException(hmsc);
- }
+ }}
}
}
}
Modified: trunk/src/data/msc.h
===================================================================
--- trunk/src/data/msc.h 2010-09-03 13:37:25 UTC (rev 869)
+++ trunk/src/data/msc.h 2010-09-03 14:12:59 UTC (rev 870)
@@ -1825,6 +1825,7 @@
EventTmpl(Event* original=NULL)
:Event(original)
{
+ m_area = NULL;
}
public:
@@ -1844,7 +1845,8 @@
Instance* get_instance() const
{
- return m_area->get_instance();
+ if(m_area) return m_area->get_instance();
+ else return NULL;
}
EventArea* get_general_area() const
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-09-03 14:15:27
|
Revision: 871
http://scstudio.svn.sourceforge.net/scstudio/?rev=871&view=rev
Author: madzin
Date: 2010-09-03 14:15:21 +0000 (Fri, 03 Sep 2010)
Log Message:
-----------
new time membership algorithm
Modified Paths:
--------------
trunk/src/membership/CMakeLists.txt
trunk/src/membership/membership_alg.cpp
trunk/tests/membership/CMakeLists.txt
Modified: trunk/src/membership/CMakeLists.txt
===================================================================
--- trunk/src/membership/CMakeLists.txt 2010-09-03 14:12:59 UTC (rev 870)
+++ trunk/src/membership/CMakeLists.txt 2010-09-03 14:15:21 UTC (rev 871)
@@ -8,6 +8,7 @@
TARGET_LINK_LIBRARIES(scmembership
scmsc
scpseudocode
+ sctime
)
INSTALL(TARGETS scmembership
Modified: trunk/src/membership/membership_alg.cpp
===================================================================
--- trunk/src/membership/membership_alg.cpp 2010-09-03 14:12:59 UTC (rev 870)
+++ trunk/src/membership/membership_alg.cpp 2010-09-03 14:15:21 UTC (rev 871)
@@ -24,6 +24,8 @@
*/
#include "membership/membership_alg.h"
+#include "check/time/time_pseudocode.h"
+#include "check/time/tightening.h"
#include <limits>
#include <map>
@@ -44,7 +46,9 @@
//identification for receive events
int max_id;
+
BMscPtr global_bmsc;
+BMscIntervalSetMatrix* time_matrix;
InstancePtr find_instance(InstancePtrList instances, std::wstring name);
@@ -219,6 +223,11 @@
void remove_events_attributes(std::vector<Event*> vec);
/*
+ * return matrix of time intervals among each nodes
+ */
+BMscIntervalSetMatrix get_bmsc_matrix(BMscPtr bmsc_f);
+
+/*
* Returns precondition list of the membership algorithm
*/
Checker::PreconditionList MembershipAlg::get_preconditions(MscPtr msc) const
@@ -294,6 +303,10 @@
*/
+ //get time matrix
+ BMscIntervalSetMatrix time_matrix2 = get_bmsc_matrix(bmsc_f);
+ time_matrix = &time_matrix2;
+
//creates configuration of defined bMSC
ConfigurationPtr searched_conf = new Configuration(bmsc_f->get_instances());
@@ -1040,77 +1053,48 @@
return compare_events_time_relations(a,b);
}
-//parameters node_e, b_e
-bool compare_events_time_relations(Event* a, Event* b)
+bool compare_events_time_relations(Event* node_a, Event* bmsc_a)
{
- TimeRelationEventPtrList node_intervals = a->get_time_relations();
+ TimeRelationEventPtrList node_intervals = node_a->get_time_relations();
TimeRelationEventPtrList::iterator it;
- int time_b_id;
+ int time_node_b_id;
for(it = node_intervals.begin(); it != node_intervals.end(); it++)
{
- if((*it)->get_event_a() == a)
+ if((*it)->get_event_a() == node_a)
{
- bool time_b_id_set = true;
+ bool time_node_b_id_set = true;
- time_b_id = (*it)->get_event_b()->get_attribute("identification", -1, time_b_id_set);
+ time_node_b_id = (*it)->get_event_b()->get_attribute("identification", -1, time_node_b_id_set);
- if(time_b_id_set)
+ if(time_node_b_id_set)
{
std::cerr << "Error: Unexpected behaviour 3" << std::endl;
return false;
}
- Event* bmsc_b_event = find_event_on_instance_by_id((*it)->get_event_b()->get_instance()->get_label(), time_b_id);
+ Event* bmsc_b = find_event_on_instance_by_id((*it)->get_event_b()->get_instance()->get_label(), time_node_b_id);
- if(bmsc_b_event == NULL)
+ if(bmsc_b == NULL)
return false;
- TimeRelationEventPtrList time_a_intervals = b->get_time_relations();
- TimeRelationEventPtrList time_b_intervals = bmsc_b_event->get_time_relations();
-
- if(time_a_intervals.size() == 0 || time_b_intervals.size() == 0)
- {
- std::cerr << "Error: Events in bmsc has to have time relation." << std::endl;
- return false;
- }
+ MscTimeIntervalSetD result, hmsc_inter, bmsc_inter;
- MscTimeIntervalSetD time_a_set = time_a_intervals.front()->get_interval_set();
- MscTimeIntervalSetD time_b_set = time_b_intervals.front()->get_interval_set();
-
- if(time_a_set.is_empty() || time_b_set.is_empty())
- {
- std::cerr << "Error: Time interval is corrupted" << std::endl;
- return false;
- }
-
- MscTimeInterval<double> a_interval = time_a_set.get_set().front();
- MscTimeInterval<double> b_interval = time_b_set.get_set().front();
+ hmsc_inter = (*it)->get_interval_set();
+ bmsc_inter = time_matrix->operator()(bmsc_a, bmsc_b);
+ result = MscTimeIntervalSetD::set_intersection(hmsc_inter, bmsc_inter);
- double a_time = a_interval.get_begin_value();
- double b_time = b_interval.get_begin_value();
-
-//TODO skontrolovat, nepaci sa mi ze by sa na evente z HMSC nastavovala nula
- if(time_a_intervals.size() > 1)
- a_time = 0;
-
- if(time_b_intervals.size() > 1)
- b_time = 0;
-
- double bmsc_inter = b_time - a_time;
-
- MscTimeIntervalSetD hmsc_inter = (*it)->get_interval_set();
- MscTimeIntervalSetD result, bmsc_inter_set;
-
- //adds MscTimeInterval of bmsc_inter to bmsc_inter_set without memory leak (throught shared pointer)
- bmsc_inter_set.insert(*(boost::shared_ptr<MscTimeInterval<double> >(new MscTimeInterval<double> (bmsc_inter))));
- result = MscTimeIntervalSetD::set_intersection(hmsc_inter, bmsc_inter_set);
-
if(result.is_empty())
return false;
+ else
+ if(result != bmsc_inter)
+ {
+std::cerr << "Warning: the HMSC interval do not cover whole bMSC interval" << std::endl;
+ return false;
+ }
}
}
-
+
return true;
}
@@ -2084,6 +2068,20 @@
for(it = vec.begin(); it != vec.end(); it++)
(*it)->remove_attribute<int>("identification");
+}
- //vec.clear();
+BMscIntervalSetMatrix get_bmsc_matrix(BMscPtr bmsc_f)
+{
+ //matrix context inicialization
+ BMscIntervalSetMatrix matrix(bmsc_f);
+ //create matrix
+ matrix.build_up();
+
+ MscSolveTCSP solve;
+ //tight the matrix
+ MscSolveTCSPReport report = solve.solveTCSP(matrix);
+ //get the result of the tightening
+ matrix = report.m_matrix_result;
+
+ return matrix;
}
Modified: trunk/tests/membership/CMakeLists.txt
===================================================================
--- trunk/tests/membership/CMakeLists.txt 2010-09-03 14:12:59 UTC (rev 870)
+++ trunk/tests/membership/CMakeLists.txt 2010-09-03 14:15:21 UTC (rev 871)
@@ -185,13 +185,13 @@
ADD_TEST(membership_test-78 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/time_cycleWithEmpty_neg_hmsc.mpr ${CMAKE_CURRENT_SOURCE_DIR}/time_cycleWithEmpty_neg_pat.mpr 0)
-ADD_TEST(membership_test-65 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28_1.mpr 1)
+ADD_TEST(membership_test-79 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28_1.mpr 1)
-ADD_TEST(membership_test-65 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28_2.mpr 1)
+ADD_TEST(membership_test-80 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28_2.mpr 1)
-ADD_TEST(membership_test-65 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28_3.mpr 0)
+ADD_TEST(membership_test-81 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28_3.mpr 0)
-ADD_TEST(membership_test-65 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28_4.mpr 0)
+ADD_TEST(membership_test-82 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28_4.mpr 0)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-09-07 21:31:17
|
Revision: 883
http://scstudio.svn.sourceforge.net/scstudio/?rev=883&view=rev
Author: madzin
Date: 2010-09-07 21:31:10 +0000 (Tue, 07 Sep 2010)
Log Message:
-----------
add absolut time to msc structure and modify z120 parser and z120 save
Modified Paths:
--------------
trunk/src/data/Z120/Context.cpp
trunk/src/data/Z120/Context.h
trunk/src/data/Z120/Context_Impl.h
trunk/src/data/Z120/Z120.g
trunk/src/data/Z120/z120_save.cpp
trunk/src/data/msc.h
trunk/src/data/time.h
Added Paths:
-----------
trunk/tests/z120_test/z120_time11.mpr.result1
Modified: trunk/src/data/Z120/Context.cpp
===================================================================
--- trunk/src/data/Z120/Context.cpp 2010-09-07 16:00:50 UTC (rev 882)
+++ trunk/src/data/Z120/Context.cpp 2010-09-07 21:31:10 UTC (rev 883)
@@ -92,6 +92,7 @@
context->time_first = unknown;
context->time_second = unknown;
context->time_event = false;
+ context->absolut_time = false;
}
/*
@@ -491,11 +492,50 @@
context->z->print_report(RS_ERROR, TOWSTRING(report));
}
-void add_time_fun(struct Context* context, char* time)
+void clear_time(struct Context* context)
{
+ context->time = "";
+}
+
+void add_time_fun(struct Context* context, char* time_part)
+{
+ context->time += time_part;
+}
+
+void duplicate_time_point(struct Context* context)
+{
+ if(context->absolut_first_set)
+ context->absolut_second_border = context->absolut_first_border;
+}
+
+void set_time_fun(struct Context* context, char* time)
+{
context->time = time;
}
+void set_absolut_time_false_fun(struct Context* context)
+{
+ context->absolut_time = false;
+}
+
+void set_absolut_time_true_fun(struct Context* context)
+{
+ context->absolut_time = true;
+}
+
+void set_absolut_first_or_second_true_fun(struct Context* context)
+{
+ context->absolut_time = true;
+
+ if(!context->absolut_first_set)
+ {
+ context->absolut_first_set = true;
+ context->absolut_first_border = true;
+ }
+ else
+ context->absolut_second_border = true;
+}
+
void set_origin_fun(struct Context* context)
{
context->origin = true;
@@ -932,6 +972,12 @@
void add_time_relation_event_fun(struct Context* context)
{
+ if(context->absolut_time)
+ {
+ add_event_absolut_time_fun(context);
+ return ;
+ }
+
TimeRelationEventPtr relation;
try
{
@@ -970,6 +1016,22 @@
}
}
+void add_event_absolut_time_fun(struct Context* context)
+{
+ //checking the corectness of syntax of the absolut time
+ if(!(context->absolut_first_border == context->absolut_second_border))
+ {
+ context->z->print_report(RS_ERROR, stringize() << L"Warning: wrong definition of absolut time");
+ }
+
+ context->current_event->add_absolut_time(*(new MscTimeIntervalSet<double>(context->time)));
+
+ context->absolut_first_border = false;
+ context->absolut_second_border = false;
+ context->absolut_first_set = false;
+ context->absolut_time = false;
+}
+
/*
* Set name of event which is in time relation with the event
*/
Modified: trunk/src/data/Z120/Context.h
===================================================================
--- trunk/src/data/Z120/Context.h 2010-09-07 16:00:50 UTC (rev 882)
+++ trunk/src/data/Z120/Context.h 2010-09-07 21:31:10 UTC (rev 883)
@@ -58,8 +58,20 @@
void bug_report_fun(struct Context* context, char* report);
-void add_time_fun(struct Context* context, char* time);
+void clear_time(struct Context* context);
+void add_time_fun(struct Context* context, char* time_part);
+
+void duplicate_time_point(struct Context* context);
+
+void set_time_fun(struct Context* context, char* time);
+
+void set_absolut_time_false_fun(struct Context* context);
+
+void set_absolut_time_true_fun(struct Context* context);
+
+void set_absolut_first_or_second_true_fun(struct Context* context);
+
void set_origin_fun(struct Context* context);
void set_time_dest_fun(struct Context* context);
@@ -99,6 +111,8 @@
void add_time_relation_event_fun(struct Context* context);
+void add_event_absolut_time_fun(struct Context* context);
+
void set_time_reference_event_fun(struct Context* context, char* name);
void create_future_time_relations(struct Context* context);
Modified: trunk/src/data/Z120/Context_Impl.h
===================================================================
--- trunk/src/data/Z120/Context_Impl.h 2010-09-07 16:00:50 UTC (rev 882)
+++ trunk/src/data/Z120/Context_Impl.h 2010-09-07 21:31:10 UTC (rev 883)
@@ -69,6 +69,10 @@
std::string time;
bool origin;
bool time_dest;
+ bool absolut_time;
+ bool absolut_first_border;
+ bool absolut_first_set;
+ bool absolut_second_border;
/*
* Error handling
Modified: trunk/src/data/Z120/Z120.g
===================================================================
--- trunk/src/data/Z120/Z120.g 2010-09-07 16:00:50 UTC (rev 882)
+++ trunk/src/data/Z120/Z120.g 2010-09-07 21:31:10 UTC (rev 883)
@@ -1089,7 +1089,10 @@
* Extend the Z120 standart with negative time interval
*/
time_point:
- ('@')? ('-')? (expression | 'inf') //inf has been added for accept inf in time definition but it should be in expression to
+ ('@' { set_absolut_first_or_second_true_fun(context); } )?
+ ('-' { add_time_fun(context, "-"); } )?
+ (expression { add_time_fun(context, (char*) $expression.text->chars); }
+ | 'inf' { add_time_fun(context, "inf"); } ) //inf has been added for accept inf in time definition but it should be in expression to
;
@@ -1112,15 +1115,14 @@
// ----- Time Interval
time_interval:
+ {
+ clear_time(context);
+ set_absolut_time_false_fun(context);
+ }
(interval_label)?
( (('@')? ('(' | '[') (time_point)? ',')=> bounded_time
- {
- add_time_fun(context, (char*) $bounded_time.text->chars);
- } (measurement)?
- | singular_time
- {
- add_time_fun(context, (char*) $singular_time.text->chars);
- })
+ (measurement)?
+ | singular_time )
;
/*
@@ -1144,24 +1146,42 @@
;
singular_time:
- (
-'[' time_point ']' addition_time?)
+ ('[' { add_time_fun(context, "["); }
+ time_point { duplicate_time_point(context); }
+ ']' { add_time_fun(context, "]"); }
+ addition_time? )
| measurement
;
bounded_time:
- ('@')? ('(' | '[')
- (time_point)? ',' (time_point)?
- (')' | ']') addition_time?
+ ('@' { set_absolut_time_true_fun(context); })?
+ left_bracket { add_time_fun(context, (char*) $left_bracket.text->chars); }
+ time_borders
+ right_bracket { add_time_fun(context, (char*) $right_bracket.text->chars); }
+ (addition_time)?
;
+left_bracket:
+ ('(' | '[')
+;
+
+time_borders:
+ (time_point)?
+ ',' { add_time_fun(context, ","); }
+ (time_point)?
+;
+
+right_bracket:
+ (')' | ']')
+;
/*
* Extend the Z120 standart with new definition of time interval.
*
* It supports definition as a chain of intervals connected with +
*/
addition_time:
- '+' ( (('@')? ('(' | '[') (time_point)? ',')=> bounded_time | singular_time)
+ '+' { add_time_fun(context, "+"); }
+ ( (('@')? ('(' | '[') (time_point)? ',')=> bounded_time | singular_time)
;
Modified: trunk/src/data/Z120/z120_save.cpp
===================================================================
--- trunk/src/data/Z120/z120_save.cpp 2010-09-07 16:00:50 UTC (rev 882)
+++ trunk/src/data/Z120/z120_save.cpp 2010-09-07 21:31:10 UTC (rev 883)
@@ -363,12 +363,52 @@
}
}
+void print_absolut_time(std::ostream& stream, const MscTimeIntervalSetD& interval)
+{
+ const std::list< MscTimeInterval<double> > constraints = interval.get_set();
+
+ for(std::list< MscTimeInterval<double> >::const_iterator it = constraints.begin();
+ it != constraints.end(); it++)
+ {
+ if(it->get_begin_value() != it->get_end_value())
+ {
+ if (it->get_begin_closed())
+ stream << "@[";
+ else
+ stream << "(";
+
+ stream << it->get_begin() << "," << it->get_end();
+
+ if (it->get_end_closed())
+ stream << "]";
+ else
+ stream << ")";
+ }
+ else
+ stream << "[@" << it->get_begin() << "]";
+ }
+}
+
void Z120::print_time_relations(std::ostream& stream, PtrIDMap<EventPtr>& event_id_map,
const EventPtr& event)
{
size_t printed = 0;
const TimeRelationEventPtrList& relations = event->get_time_relations();
+ const MscTimeIntervalSetDList& absolut_times = event->get_absolut_times();
+ // process all absolut time constraints
+ for(MscTimeIntervalSetDList::const_iterator apos = absolut_times.begin();
+ apos != absolut_times.end(); apos++)
+ {
+ if(!printed++)
+ stream << "time ";
+ else
+ stream << ", ";
+
+ //do not used the print function of MscTimeInterval due to [@3]
+ print_absolut_time(stream, *apos);
+ }
+
// process all time relations
for(TimeRelationEventPtrList::const_iterator rpos = relations.begin();
rpos != relations.end(); rpos++)
Modified: trunk/src/data/msc.h
===================================================================
--- trunk/src/data/msc.h 2010-09-07 16:00:50 UTC (rev 882)
+++ trunk/src/data/msc.h 2010-09-07 21:31:10 UTC (rev 883)
@@ -139,6 +139,7 @@
typedef boost::intrusive_ptr<TimeRelationRefNode> TimeRelationRefNodePtr;
typedef std::set<TimeRelationRefNodePtr> TimeRelationRefNodePtrSet;
typedef MscTimeIntervalSet<double> MscTimeIntervalSetD;
+typedef std::list<MscTimeIntervalSetD> MscTimeIntervalSetDList;
#endif
@@ -1601,6 +1602,7 @@
#ifdef _TIME_H_
TimeRelationEventPtrList m_time_relations;
+ MscTimeIntervalSetDList m_absolut_time;
#endif
/**
@@ -1674,7 +1676,34 @@
m_time_relations.clear();
}
+ void add_absolut_time(const MscTimeIntervalSetD& absolut_time)
+ {
+ m_absolut_time.push_back(absolut_time);
+ }
+ void remove_absolut_time(const MscTimeIntervalSetD& absolut_time)
+ {
+ MscTimeIntervalSetDList::iterator pos =
+ std::find(m_absolut_time.begin(), m_absolut_time.end(), absolut_time);
+
+ if(pos != m_absolut_time.end())
+ m_absolut_time.erase(pos);
+ }
+
+ void set_absolut_time(const MscTimeIntervalSetDList& list)
+ {
+ m_absolut_time = list;
+ }
+
+ const MscTimeIntervalSetDList& get_absolut_times() const
+ {
+ return m_absolut_time;
+ }
+
+ void clear_absolut_times()
+ {
+ m_absolut_time.clear();
+ }
#endif
/**
Modified: trunk/src/data/time.h
===================================================================
--- trunk/src/data/time.h 2010-09-07 16:00:50 UTC (rev 882)
+++ trunk/src/data/time.h 2010-09-07 21:31:10 UTC (rev 883)
@@ -1266,7 +1266,7 @@
m_set.clear();
}
- IntervalList& get_set()
+ const IntervalList& get_set() const
{
return m_set;
}
Added: trunk/tests/z120_test/z120_time11.mpr.result1
===================================================================
--- trunk/tests/z120_test/z120_time11.mpr.result1 (rev 0)
+++ trunk/tests/z120_test/z120_time11.mpr.result1 2010-09-07 21:31:10 UTC (rev 883)
@@ -0,0 +1,39 @@
+Warning 09: Reference to nonexisting MSC: Fish
+OK: z120_time11 is correct, should be correct
+
+mscdocument z120_time11;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3, L4;
+L2: reference Subprocess time [1,2);
+ top top L3 [2,4], bottom L1 (1,10);
+ connect L1;
+L3: reference Fish connect L4;
+L4: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
+msc Fish;
+endmsc;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-09-08 07:48:41
|
Revision: 886
http://scstudio.svn.sourceforge.net/scstudio/?rev=886&view=rev
Author: madzin
Date: 2010-09-08 07:48:34 +0000 (Wed, 08 Sep 2010)
Log Message:
-----------
add z120 tests and repair small bug in z120 save
Modified Paths:
--------------
trunk/src/data/Z120/z120_save.cpp
trunk/tests/z120_test/CMakeLists.txt
Added Paths:
-----------
trunk/tests/z120_test/z120_time32.mpr
trunk/tests/z120_test/z120_time32.mpr.result
trunk/tests/z120_test/z120_time33.mpr
trunk/tests/z120_test/z120_time33.mpr.result
trunk/tests/z120_test/z120_time34.mpr
trunk/tests/z120_test/z120_time34.mpr.result
trunk/tests/z120_test/z120_time35.mpr
trunk/tests/z120_test/z120_time35.mpr.result
trunk/tests/z120_test/z120_time36.mpr
trunk/tests/z120_test/z120_time36.mpr.result
trunk/tests/z120_test/z120_time37.mpr
trunk/tests/z120_test/z120_time37.mpr.result
trunk/tests/z120_test/z120_time38.mpr
trunk/tests/z120_test/z120_time38.mpr.result
trunk/tests/z120_test/z120_time39.mpr
trunk/tests/z120_test/z120_time39.mpr.result
trunk/tests/z120_test/z120_time40.mpr
trunk/tests/z120_test/z120_time40.mpr.result
trunk/tests/z120_test/z120_time41.mpr
trunk/tests/z120_test/z120_time41.mpr.result
trunk/tests/z120_test/z120_time42.mpr
trunk/tests/z120_test/z120_time42.mpr.result
trunk/tests/z120_test/z120_time43.mpr
trunk/tests/z120_test/z120_time43.mpr.result
trunk/tests/z120_test/z120_time44.mpr
trunk/tests/z120_test/z120_time44.mpr.result
trunk/tests/z120_test/z120_time45.mpr
trunk/tests/z120_test/z120_time45.mpr.result
trunk/tests/z120_test/z120_time46.mpr
trunk/tests/z120_test/z120_time46.mpr.result
trunk/tests/z120_test/z120_time47.mpr
trunk/tests/z120_test/z120_time47.mpr.result
trunk/tests/z120_test/z120_time48.mpr
trunk/tests/z120_test/z120_time48.mpr.result
trunk/tests/z120_test/z120_time49.mpr
trunk/tests/z120_test/z120_time49.mpr.result
Modified: trunk/src/data/Z120/z120_save.cpp
===================================================================
--- trunk/src/data/Z120/z120_save.cpp 2010-09-08 07:30:40 UTC (rev 885)
+++ trunk/src/data/Z120/z120_save.cpp 2010-09-08 07:48:34 UTC (rev 886)
@@ -375,7 +375,7 @@
if (it->get_begin_closed())
stream << "@[";
else
- stream << "(";
+ stream << "@(";
stream << it->get_begin() << "," << it->get_end();
Modified: trunk/tests/z120_test/CMakeLists.txt
===================================================================
--- trunk/tests/z120_test/CMakeLists.txt 2010-09-08 07:30:40 UTC (rev 885)
+++ trunk/tests/z120_test/CMakeLists.txt 2010-09-08 07:48:34 UTC (rev 886)
@@ -129,6 +129,24 @@
ADD_Z120_TEST(z120_time29.mpr 1)
ADD_Z120_TEST(z120_time30.mpr 1)
ADD_Z120_TEST(z120_time31.mpr 1)
+ADD_Z120_TEST(z120_time32.mpr 1)
+ADD_Z120_TEST(z120_time33.mpr 1)
+ADD_Z120_TEST(z120_time34.mpr 1)
+ADD_Z120_TEST(z120_time35.mpr 1)
+ADD_Z120_TEST(z120_time36.mpr 1)
+ADD_Z120_TEST(z120_time37.mpr 1)
+ADD_Z120_TEST(z120_time38.mpr 1)
+ADD_Z120_TEST(z120_time39.mpr 1)
+ADD_Z120_TEST(z120_time40.mpr 1)
+ADD_Z120_TEST(z120_time41.mpr 1)
+ADD_Z120_TEST(z120_time42.mpr 1)
+ADD_Z120_TEST(z120_time43.mpr 1)
+ADD_Z120_TEST(z120_time44.mpr 1)
+ADD_Z120_TEST(z120_time45.mpr 1)
+ADD_Z120_TEST(z120_time46.mpr 1)
+ADD_Z120_TEST(z120_time47.mpr 1)
+ADD_Z120_TEST(z120_time48.mpr 1)
+ADD_Z120_TEST(z120_time49.mpr 1)
# $Id$
Added: trunk/tests/z120_test/z120_time32.mpr
===================================================================
--- trunk/tests/z120_test/z120_time32.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time32.mpr 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,36 @@
+/* Basic time constraints in both MSC and HMSC
+ */
+mscdocument z120_time01;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+top bottom L1 (1,10);
+connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time [@3];
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time32.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time32.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time32.mpr.result 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,36 @@
+OK: z120_time32 is correct, should be correct
+
+mscdocument z120_time32;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+ top bottom L1 (1,10);
+ connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time [@3];
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time33.mpr
===================================================================
--- trunk/tests/z120_test/z120_time33.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time33.mpr 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,36 @@
+/* Basic time constraints in both MSC and HMSC
+ */
+mscdocument z120_time01;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+top bottom L1 (1,10);
+connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time [@3, @4];
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time33.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time33.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time33.mpr.result 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,36 @@
+OK: z120_time33 is correct, should be correct
+
+mscdocument z120_time33;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+ top bottom L1 (1,10);
+ connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time @[3,4];
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time34.mpr
===================================================================
--- trunk/tests/z120_test/z120_time34.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time34.mpr 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,36 @@
+/* Basic time constraints in both MSC and HMSC
+ */
+mscdocument z120_time01;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+top bottom L1 (1,10);
+connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time @[3,5];
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time34.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time34.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time34.mpr.result 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,36 @@
+OK: z120_time34 is correct, should be correct
+
+mscdocument z120_time34;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+ top bottom L1 (1,10);
+ connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time @[3,5];
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time35.mpr
===================================================================
--- trunk/tests/z120_test/z120_time35.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time35.mpr 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,36 @@
+/* Basic time constraints in both MSC and HMSC
+ */
+mscdocument z120_time01;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+top bottom L1 (1,10);
+connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time @[3];
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time35.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time35.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time35.mpr.result 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,37 @@
+z120_time35.mpr[18,6] Cannot match to any predicted input.
+Warning: String conversion: empty time interval
+z120_time35.mpr[19,6] Cannot match to any predicted input.
+z120_time35.mpr[22,6] Cannot match to any predicted input.
+Warning 05: Complete message (NAME,1) with only one event
+Warning 05: Complete message (NAME,2) with only one event
+Warning 20: MSC (Subprocess) has unterminated 1 instance
+OK: z120_time35 is correct, should be correct
+
+mscdocument z120_time35;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+ top bottom L1 (1,10);
+ connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+endinstance;
+P2: instance;
+concurrent;
+label e0;
+in NAME,0 from P1 before e1;
+time e2 [12];
+label e1;
+in NAME,1 from found;
+endconcurrent;
+label e2;
+out NAME,2 to lost;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time36.mpr
===================================================================
--- trunk/tests/z120_test/z120_time36.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time36.mpr 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,36 @@
+/* Basic time constraints in both MSC and HMSC
+ */
+mscdocument z120_time01;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+top bottom L1 (1,10);
+connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time [@3);
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time36.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time36.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time36.mpr.result 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,37 @@
+z120_time36.mpr[18,8] Missing ']'.
+OK: z120_time36 is correct, should be correct
+
+mscdocument z120_time36;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+ top bottom L1 (1,10);
+ connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time [@3];
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time37.mpr
===================================================================
--- trunk/tests/z120_test/z120_time37.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time37.mpr 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,36 @@
+/* Basic time constraints in both MSC and HMSC
+ */
+mscdocument z120_time01;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+top bottom L1 (1,10);
+connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time [@3, @4);
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time37.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time37.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time37.mpr.result 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,36 @@
+OK: z120_time37 is correct, should be correct
+
+mscdocument z120_time37;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+ top bottom L1 (1,10);
+ connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time @[3,4);
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time38.mpr
===================================================================
--- trunk/tests/z120_test/z120_time38.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time38.mpr 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,36 @@
+/* Basic time constraints in both MSC and HMSC
+ */
+mscdocument z120_time01;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+top bottom L1 (1,10);
+connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time (@3, @4];
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time38.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time38.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time38.mpr.result 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,36 @@
+OK: z120_time38 is correct, should be correct
+
+mscdocument z120_time38;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+ top bottom L1 (1,10);
+ connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time @(3,4];
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time39.mpr
===================================================================
--- trunk/tests/z120_test/z120_time39.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time39.mpr 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,36 @@
+/* Basic time constraints in both MSC and HMSC
+ */
+mscdocument z120_time01;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+top bottom L1 (1,10);
+connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time (@3, @4);
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time39.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time39.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time39.mpr.result 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,36 @@
+OK: z120_time39 is correct, should be correct
+
+mscdocument z120_time39;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+ top bottom L1 (1,10);
+ connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time @(3,4);
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time40.mpr
===================================================================
--- trunk/tests/z120_test/z120_time40.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time40.mpr 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,36 @@
+/* Basic time constraints in both MSC and HMSC
+ */
+mscdocument z120_time01;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+top bottom L1 (1,10);
+connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time [@3, 4);
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time40.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time40.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time40.mpr.result 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,37 @@
+Warning: wrong definition of absolut time
+OK: z120_time40 is correct, should be correct
+
+mscdocument z120_time40;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+ top bottom L1 (1,10);
+ connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time @[3,4);
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time41.mpr
===================================================================
--- trunk/tests/z120_test/z120_time41.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time41.mpr 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,36 @@
+/* Basic time constraints in both MSC and HMSC
+ */
+mscdocument z120_time01;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+top bottom L1 (1,10);
+connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time [@3, 4];
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time41.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time41.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time41.mpr.result 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,37 @@
+Warning: wrong definition of absolut time
+OK: z120_time41 is correct, should be correct
+
+mscdocument z120_time41;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+ top bottom L1 (1,10);
+ connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time @[3,4];
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time42.mpr
===================================================================
--- trunk/tests/z120_test/z120_time42.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time42.mpr 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,36 @@
+/* Basic time constraints in both MSC and HMSC
+ */
+mscdocument z120_time01;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+top bottom L1 (1,10);
+connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time [3, @4);
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time42.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time42.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time42.mpr.result 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,37 @@
+Warning: wrong definition of absolut time
+OK: z120_time42 is correct, should be correct
+
+mscdocument z120_time42;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+ top bottom L1 (1,10);
+ connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time @[3,4);
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time43.mpr
===================================================================
--- trunk/tests/z120_test/z120_time43.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time43.mpr 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,36 @@
+/* Basic time constraints in both MSC and HMSC
+ */
+mscdocument z120_time01;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+top bottom L1 (1,10);
+connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time (3, @4);
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time43.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time43.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time43.mpr.result 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,37 @@
+Warning: wrong definition of absolut time
+OK: z120_time43 is correct, should be correct
+
+mscdocument z120_time43;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+ top bottom L1 (1,10);
+ connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time @(3,4);
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time44.mpr
===================================================================
--- trunk/tests/z120_test/z120_time44.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time44.mpr 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,36 @@
+/* Basic time constraints in both MSC and HMSC
+ */
+mscdocument z120_time01;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+top bottom L1 (1,10);
+connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time @(3, 4);
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time44.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time44.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time44.mpr.result 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,36 @@
+OK: z120_time44 is correct, should be correct
+
+mscdocument z120_time44;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+ top bottom L1 (1,10);
+ connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time @(3,4);
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time45.mpr
===================================================================
--- trunk/tests/z120_test/z120_time45.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time45.mpr 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,36 @@
+/* Basic time constraints in both MSC and HMSC
+ */
+mscdocument z120_time01;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+top bottom L1 (1,10);
+connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time @[3,4);
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time45.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_time45.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_time45.mpr.result 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,36 @@
+OK: z120_time45 is correct, should be correct
+
+mscdocument z120_time45;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+ top bottom L1 (1,10);
+ connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time @[3,4);
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,0 from P1 before e3;
+time e4 [12];
+label e3;
+in NAME,1 from P1;
+endconcurrent;
+label e4;
+out NAME,2 to P1;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_time46.mpr
===================================================================
--- trunk/tests/z120_test/z120_time46.mpr (rev 0)
+++ trunk/tests/z120_test/z120_time46.mpr 2010-09-08 07:48:34 UTC (rev 886)
@@ -0,0 +1,36 @@
+/* Basic time constraints in both MSC and HMSC
+ */
+mscdocument z120_time01;
+msc Main;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference Subprocess connect L3;
+L2: reference Subprocess time [1,2);
+top bottom L1 (1,10);
+connect L1;
+L3: final;
+endmsc;
+msc Subprocess;
+inst P1;
+inst P2;
+P1: instance;
+out NAME,0 to P2;
+time @(3,4];
+label e0;
+out NAME,1 to P2;
+time e1 [7];
+label e1;
+in NAME,2 from P2;
+endinstance;
+P2: instance;
+concurrent;
+label e2;
+in NAME,...
[truncated message content] |
|
From: <lko...@us...> - 2010-09-08 10:46:35
|
Revision: 889
http://scstudio.svn.sourceforge.net/scstudio/?rev=889&view=rev
Author: lkorenciak
Date: 2010-09-08 10:46:28 +0000 (Wed, 08 Sep 2010)
Log Message:
-----------
fixed two bugs
Modified Paths:
--------------
trunk/src/check/time/hmsc_all_paths.cpp
trunk/src/check/time/tightening.h
trunk/tests/time/time_race/CMakeLists.txt
Modified: trunk/src/check/time/hmsc_all_paths.cpp
===================================================================
--- trunk/src/check/time/hmsc_all_paths.cpp 2010-09-08 09:13:49 UTC (rev 888)
+++ trunk/src/check/time/hmsc_all_paths.cpp 2010-09-08 10:46:28 UTC (rev 889)
@@ -38,10 +38,10 @@
}
path_prefix2.pop_back();
//keep poping until hmsc node is reached
- std::cout << "b\n";
+// std::cout << "b\n";
while(!((HMscNode*)(path_prefix2.back())))
path_prefix2.pop_back();
- std::cout << "c\n";
+// std::cout << "c\n";
return; //TODO check- I think it should be here
}
}
Modified: trunk/src/check/time/tightening.h
===================================================================
--- trunk/src/check/time/tightening.h 2010-09-08 09:13:49 UTC (rev 888)
+++ trunk/src/check/time/tightening.h 2010-09-08 10:46:28 UTC (rev 889)
@@ -51,7 +51,6 @@
{
for(size_t i= 0; i<= to;i++)
{
- std::cerr << i << std::endl;
at(i)=((*v_lists)[i])[(*iterators)[i]];
}
@@ -98,7 +97,7 @@
void init()
{
if(lists.size() == 0)
- throw std::runtime_error("Lists size is zero.");
+ return ;
if(ini)
throw std::runtime_error("Already allocated!");
else
@@ -245,6 +244,7 @@
TimeRelationRefNodePtrSet* top = &(ref->get_time_relations_top());
TimeRelationRefNodePtrSet* bottom = &(ref->get_time_relations_bottom());
+
if(top->size()>0)
{
a = new StrictEvent();
@@ -253,7 +253,7 @@
rel_to_event[top] = a;
MinimalEventPList min(in);
- std::vector<std::pair<EventP,EventP> > floor(min.size());
+ std::vector<std::pair<EventP,EventP> > floor;
for(MinimalEventPList::iterator m=min.begin();m!=min.end();m++)
{
Event* copy = dynamic_cast<Event*>(duplicator.get_copy_with_occurence(*m,bmsc_to_count[in.get()]));
@@ -301,7 +301,7 @@
events_to_delete.push_back(a);
rel_to_event[bottom] = a;
MaximalEventPList max(in);
- std::vector<std::pair<EventP,EventP> > floor(max.size());
+ std::vector<std::pair<EventP,EventP> > floor;
for(MaximalEventPList::iterator m=max.begin();m!=max.end();m++)
{
Event* copy = dynamic_cast<Event*>(duplicator.get_copy_with_occurence(*m,bmsc_to_count[in.get()]));
@@ -342,10 +342,12 @@
}
}
b_matrix.build_up();
-
+
+
IntervalSetMatrix result;
result.resize(b_matrix.size1());
-
+
+ combination.init();
if(combination.size()==0){
//tighten the matrix
MscSolveTCSP solve;
@@ -360,12 +362,11 @@
}
} myex;
throw myex;//TODO do something when inconsistent (e.g.exception). For consistency check this should return something reasonable
-
}
return std::make_pair<BMscIntervalSetMatrix,IntervalSetMatrix>(b_matrix,report.m_matrix_result);
}
- combination.init();
+
do
{
// push there [0,0] interval
@@ -376,18 +377,17 @@
MscSolveTCSP solve;
if(b_matrix.get_rel_empty_set().size()!=0) // inconsistent
continue;
-
MscSolveTCSPReport report = solve.solveTCSP(b_matrix);
if(report.csp_mtxs.size()==0) // inconsistent
continue;
IntervalSetMatrix new_result = report.m_matrix_result;
-
for(unsigned i=0;i<new_result.size1();i++)
for(unsigned j=0;j<new_result.size1();j++)
result(i,j) = MscTimeIntervalSetD::set_union(result(i,j),new_result(i,j));
+
//return back previous value
for(size_t i=0;i<combination.size();i++)
{
Modified: trunk/tests/time/time_race/CMakeLists.txt
===================================================================
--- trunk/tests/time/time_race/CMakeLists.txt 2010-09-08 09:13:49 UTC (rev 888)
+++ trunk/tests/time/time_race/CMakeLists.txt 2010-09-08 10:46:28 UTC (rev 889)
@@ -10,6 +10,9 @@
ADD_CHECKER_TEST(sctime "Time Race" race_neg12.mpr 0)
ADD_CHECKER_TEST(sctime "Time Race" race_neg13.mpr 0)
ADD_CHECKER_TEST(sctime "Time Race" race_neg14.mpr 0)
+ADD_CHECKER_TEST(sctime "Time Race" race_neg15.mpr 0)
+ADD_CHECKER_TEST(sctime "Time Race" race_neg16.mpr 0)
+ADD_CHECKER_TEST(sctime "Time Race" race_neg17.mpr 0)
ADD_CHECKER_TEST(sctime "Time Race" race_pos1.mpr 1)
ADD_CHECKER_TEST(sctime "Time Race" race_pos2.mpr 1)
@@ -28,4 +31,8 @@
ADD_CHECKER_TEST(sctime "Time Race" race_pos20.mpr 1)
ADD_CHECKER_TEST(sctime "Time Race" race_pos21.mpr 1)
ADD_CHECKER_TEST(sctime "Time Race" race_pos22.mpr 1)
+ADD_CHECKER_TEST(sctime "Time Race" race_pos23.mpr 1)
+ADD_CHECKER_TEST(sctime "Time Race" race_pos24.mpr 1)
+ADD_CHECKER_TEST(sctime "Time Race" race_pos25.mpr 1)
+ADD_CHECKER_TEST(sctime "Time Race" race_pos26.mpr 1)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-09-08 23:01:57
|
Revision: 897
http://scstudio.svn.sourceforge.net/scstudio/?rev=897&view=rev
Author: madzin
Date: 2010-09-08 23:01:50 +0000 (Wed, 08 Sep 2010)
Log Message:
-----------
revert to non-refactoring version, repair bugs in time membership, add partial membership algorithm (not tested), add test for time membership
Modified Paths:
--------------
trunk/src/membership/CMakeLists.txt
trunk/src/membership/membership_alg.cpp
trunk/src/membership/membership_alg.h
trunk/tests/membership/CMakeLists.txt
trunk/tests/membership/membership_test.cpp
Added Paths:
-----------
trunk/tests/membership/test_bmsc29_1.mpr
trunk/tests/membership/test_bmsc29_2.mpr
trunk/tests/membership/test_bmsc30_1.mpr
trunk/tests/membership/test_bmsc30_2.mpr
trunk/tests/membership/test_bmsc31_1.mpr
trunk/tests/membership/test_hmsc29.mpr
trunk/tests/membership/test_hmsc30.mpr
trunk/tests/membership/test_hmsc31.mpr
Modified: trunk/src/membership/CMakeLists.txt
===================================================================
--- trunk/src/membership/CMakeLists.txt 2010-09-08 22:49:10 UTC (rev 896)
+++ trunk/src/membership/CMakeLists.txt 2010-09-08 23:01:50 UTC (rev 897)
@@ -3,10 +3,6 @@
module.cpp
membership_alg.cpp
membership_alg.h
- membership_time.cpp
- membership_time.h
- membership_additional.cpp
- membership_additional.h
)
TARGET_LINK_LIBRARIES(scmembership
Modified: trunk/src/membership/membership_alg.cpp
===================================================================
--- trunk/src/membership/membership_alg.cpp 2010-09-08 22:49:10 UTC (rev 896)
+++ trunk/src/membership/membership_alg.cpp 2010-09-08 23:01:50 UTC (rev 897)
@@ -2,10 +2,10 @@
//Attributy sa nemaju porovnavat jednoducho mame prefrcat celym koregionom a taktiez tym bmsc diagramom
+//TODO throw exception instead of Error: unexpected behaviour
-
/*
* scstudio - Sequence Chart Studio
* http://scstudio.sourceforge.net
@@ -23,13 +23,20 @@
*
*/
-//#include "membership/membership_alg.h"
-#include "membership/membership_time.h"
+#include "membership/membership_alg.h"
#include "check/time/time_pseudocode.h"
#include "check/time/tightening.h"
#include <limits>
#include <map>
+// map of bmsc names and configurations which were checked
+std::map<std::wstring, std::set<ConfigurationPtr> > checked;
+
+std::map<TimeRelationRefNodePtr, ConfigurationPtr> top_time_references;
+std::map<TimeRelationRefNodePtr, ConfigurationPtr> bottom_time_references;
+
+std::vector<Event*> attributed_events;
+
//save ordering of coregion events in appropriate coregion
std::map<CoregionAreaPtr, CoregionOrderingPtr> coregion_ordering;
//snapshots of context for each coregion
@@ -37,17 +44,52 @@
//checked possibilities of coregion ordering
std::map<CoregionAreaPtr, std::vector<CoregionOrderingPtr> > checked_orderings;
+//name of instances on which a user is focused on
+std::vector<std::wstring> focused_instances;
+
+//identification for receive events
+int max_id;
+
+BMscPtr global_bmsc;
+BMscIntervalSetMatrix* time_matrix;
+
InstancePtr find_instance(InstancePtrList instances, std::wstring name);
HMscPtr search_bmsc(BMscPtr bmsc, BMscPtr bmsc_f);
HMscPtr search_hmsc(HMscPtr hmsc, BMscPtr bmsc_f);
/*
+ * find name of the instance among fosuces instances
+ */
+bool contain_focused_instances(std::wstring instance)
+{
+ for(unsigned int i = 0; i < focused_instances.size(); i++)
+ {
+ if(focused_instances[i] == instance)
+ return true;
+ }
+
+ return false;
+}
+
+/*
* checks whole branch from defined node in HMSC
*/
bool check_branch(HMscNodePtr node, ConfigurationPtr b);
/*
+ * adds searched configuration to map of checked configurations
+ *
+ * configuration - state of node in searched HMSC and state of bMSC which is looked for
+ */
+void add_checked_branch(ReferenceNodePtr ref_node, ConfigurationPtr searched_conf);
+
+/*
+ * checks if instance contains any event
+ */
+bool is_empty_instance(InstancePtrList node_instances, InstancePtrList b_instances);
+
+/*
* compares strict order area from HMSC node with matching strict order area from bMSC which is looked for
*
* parameters: node_events - events of HMSC node cut
@@ -84,6 +126,21 @@
CoregionAreaPtr b_coregion, std::vector<Event*>& b_events);
/*
+ * compares two events
+ */
+bool compare_events(Event* a, Event* b);
+
+/*
+ * compares events attributes
+ */
+bool compare_events_attribute(Event* a, Event* b);
+
+/*
+ * tries to find configuration into map of seared configuration
+ */
+bool look_at_checked_conf(ReferenceNodePtr node, ConfigurationPtr b);
+
+/*
* compares one instance from HMSC node with matching instance from bMSC which is looked for
*
* parameters: node_instance - instance from HMSC node
@@ -103,6 +160,101 @@
bool check_node(ReferenceNodePtr node, enum check_type type, ConfigurationPtr old_conf);
/*
+ * in case events are send events, adds attribute to both events and to both receive event in case messages are complete
+ *
+ * parameters: node_e - event from HMSC node
+ * b_e - event from bMSC
+ */
+void set_identification(Event* node_e, Event* b_e);
+
+/*
+ * checks whether node has null pointer to reference bMSC
+ */
+bool is_node_null(ReferenceNodePtr node);
+
+/*
+ * checks whether instance contains any event
+ */
+bool is_instance_null(InstancePtr instance);
+
+/*
+ * checks whether coregion area contains any event
+ */
+bool is_cor_area_null(CoregionAreaPtr cor);
+
+/*
+ * checks whether strict order area contains any event
+ */
+bool is_strict_area_null(StrictOrderAreaPtr strict);
+
+/*
+ * checks time constraints in HMSC node
+ */
+//TODO skontrolovat co to vlastne robi, a kde kontrolujem casove obmedzenia v ramci bMSC z dajakeho HMSC nodu
+bool check_node_time(ReferenceNodePtr node, ConfigurationPtr conf);
+
+/*
+ * finds the maximum event of HMSC node and returns time interval value of matching event in bMSC
+ */
+Event* get_max_event(ReferenceNodePtr node, ConfigurationPtr conf);
+
+/*
+ * returns map where the key is instance name and the value is vector of the event identifications
+ * (in case of coregion area)
+ */
+std::map<std::wstring, std::vector<int> > get_node_last_events(ReferenceNodePtr node);
+
+/*
+ * finds the minimum event of HMSC node and returns time interval value of matching event in bMSC
+ */
+Event* get_min_event(ConfigurationPtr conf);
+
+/*
+ * compare absolut position, is the fist parameter before (more minimal) than the second
+ *
+ * return: 0 - it is not decideable
+ * 1 - the fist is before the second
+ * 2 - the second is before the first
+ */
+int compare_absolut_position(Event* first, Event* second);
+
+/*
+ * returns the last event on instance
+ */
+std::vector<Event*> get_last_instance_event(Event* start);
+
+/*
+ * returns maximal events of coregion area
+ */
+std::vector<Event*> get_last_coregion_events(CoregionArea* cor);
+
+/*
+ * compares events time relations
+ *
+ * paramterers: a - HMSC node
+ * b - bMSC node
+ */
+bool compare_events_time_relations(Event* a, Event* b);
+
+/*
+ * finds event in bMSC on instance by id
+ *
+ * parameters: label - label of instance where the event should be
+ * id - id of event which is looked for
+ */
+Event* find_event_on_instance_by_id(std::wstring label, int id, StrictEventPtr start_event = NULL);
+
+/*
+ * removes event attribute "indentification"
+ */
+void remove_events_attributes(std::vector<Event*> vec);
+
+/*
+ * return matrix of time intervals among each nodes
+ */
+BMscIntervalSetMatrix get_bmsc_matrix(BMscPtr bmsc_f);
+
+/*
* Returns precondition list of the membership algorithm
*/
Checker::PreconditionList MembershipAlg::get_preconditions(MscPtr msc) const
@@ -126,7 +278,7 @@
return NULL;
}
- set_global_bmsc(bmsc_f);
+ global_bmsc = bmsc_f;
if (hmsc != NULL)
return search_hmsc(hmsc, bmsc_f);
@@ -143,12 +295,19 @@
}
}
+MscPtr MembershipAlg::find(MscPtr msc, MscPtr bmsc, std::vector<std::wstring> instances)
+{
+ focused_instances.insert(focused_instances.begin(), instances.begin(), instances.end());
+
+ return this->find(msc, bmsc);
+}
+
/*
* Tries to find bMSC in HMSC
*/
HMscPtr search_hmsc(HMscPtr hmsc, BMscPtr bmsc_f)
{
- set_max_id(0);
+ max_id = 0;
BMscGraphDuplicator duplicator;
HMscPtr dup_hmsc;
@@ -180,7 +339,7 @@
//get time matrix
BMscIntervalSetMatrix time_matrix2 = get_bmsc_matrix(bmsc_f);
- set_time_matrix(&time_matrix2);
+ time_matrix = &time_matrix2;
//creates configuration of defined bMSC
ConfigurationPtr searched_conf = new Configuration(bmsc_f->get_instances());
@@ -209,8 +368,9 @@
bool check_branch(HMscNodePtr hmsc_node, ConfigurationPtr b)
{
//remove attributes from previous computation
- if(!get_attributed_events().empty()){
- remove_events_attributes();
+ if(!attributed_events.empty()){
+ remove_events_attributes(attributed_events);
+ attributed_events.clear();
}
//checks end node
@@ -218,7 +378,7 @@
if (end != NULL)
{
- if (b->is_null())
+ if (b->is_null(focused_instances))
return true;
else
return false;
@@ -252,7 +412,11 @@
else
{
//when deosn't exist empty path to EndNode
- if (b->is_null() && !is_node_null(node))
+// if (b->is_null() && !is_node_null(node))
+// return false;
+
+ //when deosn't exist empty path to EndNode
+ if (b->is_null(focused_instances) && !is_node_null(node))
return false;
//checks if this node with this configuration was checked
@@ -267,21 +431,24 @@
//tries to matching events between searched MSC and bMSC which is looked for
if (!check_node(node, membership, b))
{
- remove_events_attributes();
+ remove_events_attributes(attributed_events);
+ attributed_events.clear();
return false;
}
//checks time constraints for this node
if(!check_node_time(node, old_config_II))
{
- remove_events_attributes();
+ remove_events_attributes(attributed_events);
+ attributed_events.clear();
return false;
}
//checks the ordering of events (by attribute which was set at check_node(node, membership,b))
if (!check_node(node, receive_ordering, old_config_I))
{
- remove_events_attributes();
+ remove_events_attributes(attributed_events);
+ attributed_events.clear();
return false;
}
@@ -294,7 +461,8 @@
if(!b->compare(old_config_I))
return false;
- remove_events_attributes();
+ remove_events_attributes(attributed_events);
+ attributed_events.clear();
NodeRelationPtrVector successors = node->get_successors();
NodeRelationPtrVector::iterator it;
@@ -445,7 +613,6 @@
if(!node_events.empty())
node_e_a = node_events[0]->get_general_area();
else
- //may be there should be return true
return false;
CoregionAreaPtr cor = boost::dynamic_pointer_cast<CoregionArea> (node_e_a);
@@ -673,7 +840,9 @@
}
}
-//TODO it can cause segmentation fault .get()
+ if(b_e->get_successor() == NULL)
+ std::cerr << "Error: unexpected behaviour" << std::endl;
+
b_e = b_e->get_successor().get();
CoregEventRelPtrVector succ = node_e->get_successors();
@@ -823,6 +992,240 @@
}
/*
+ * Add checked branch to map of checked branches
+ */
+void add_checked_branch(ReferenceNodePtr ref_node, ConfigurationPtr conf)
+{
+ BMscPtr bmsc = ref_node->get_bmsc();
+
+ if(bmsc == NULL)
+ {
+ std::cerr << "Internal error: checked_branch" << std::endl;
+ return;
+ }
+
+ std::wstring bmsc_name = bmsc->get_label();
+ std::set<ConfigurationPtr> conf_set;
+ conf_set.insert(conf);
+
+ if(checked.find(bmsc_name) == checked.end())
+ checked.insert(std::make_pair(bmsc_name, conf_set));
+ else
+ checked.find(bmsc_name)->second.insert(conf);
+}
+
+/*
+ * Compare values in two events
+ */
+bool compare_events(Event* a, Event* b)
+{
+ if (b == NULL || a == NULL)
+ return false;
+
+ if (a->get_instance()->get_label() != b->get_instance()->get_label())
+ return false;
+
+ if (a->is_send() != b->is_send())
+ return false;
+
+ if ((a->get_complete_message() == NULL) != (b->get_complete_message() == NULL))
+ return false;
+
+ if (a->get_message()->get_label() != b->get_message()->get_label())
+ return false;
+
+ if (a->is_matched() != b->is_matched())
+ return false;
+
+ if (a->is_matched())
+ {
+ if (a->is_send())
+ {
+ if (a->get_receiver_label() != b->get_receiver_label())
+ return false;
+ }
+ else
+ {
+ if (a->get_sender_label() != b->get_sender_label())
+ return false;
+ }
+ }
+
+ return true;
+}
+
+//parameters node_e, b_e
+bool compare_events_attribute(Event* a, Event* b)
+{
+ IncompleteMessagePtr incom_a = boost::dynamic_pointer_cast<IncompleteMessage > (a->get_message());
+ IncompleteMessagePtr incom_b = boost::dynamic_pointer_cast<IncompleteMessage > (b->get_message());
+
+ switch ((incom_a != NULL) + (incom_b != NULL))
+ {
+ case 2:
+ return true;
+ break;
+
+ case 1:
+ return false;
+ break;
+
+ case 0:
+ break;
+
+ default:
+ return false;
+ }
+
+ int a_id, b_id;
+ bool a_set = true;
+
+ a_id = a->get_attribute("identification", -1, a_set);
+
+ bool b_set = true;
+
+ b_id = b->get_attribute("identification", -2, b_set);
+
+ if(focused_instances.empty() || contain_focused_instances(a->get_matching_event()->get_instance()->get_label()))
+ {
+ if (a_set || b_set || a_id != b_id)
+ return false;
+
+ return compare_events_time_relations(a,b);
+ }
+ else
+ return true;
+}
+
+bool compare_events_time_relations(Event* node_a, Event* bmsc_a)
+{
+ TimeRelationEventPtrList node_intervals = node_a->get_time_relations();
+ TimeRelationEventPtrList::iterator it;
+ int time_node_b_id;
+
+ for(it = node_intervals.begin(); it != node_intervals.end(); it++)
+ {
+ if((*it)->get_event_a() == node_a)
+ {
+ bool time_node_b_id_set = true;
+
+ time_node_b_id = (*it)->get_event_b()->get_attribute("identification", -1, time_node_b_id_set);
+
+ if(time_node_b_id_set)
+ {
+ std::cerr << "Error: Unexpected behaviour 3" << std::endl;
+ return false;
+ }
+
+ Event* bmsc_b = find_event_on_instance_by_id((*it)->get_event_b()->get_instance()->get_label(), time_node_b_id);
+
+ if(bmsc_b == NULL)
+ return false;
+
+ MscTimeIntervalSetD result, hmsc_inter, bmsc_inter;
+
+ hmsc_inter = (*it)->get_interval_set();
+ bmsc_inter = time_matrix->operator()(bmsc_a, bmsc_b);
+ result = MscTimeIntervalSetD::set_intersection(hmsc_inter, bmsc_inter);
+
+ if(result.is_empty())
+ return false;
+ else
+ if(result != bmsc_inter)
+ {
+std::cerr << "Warning: the HMSC interval do not cover whole bMSC interval" << std::endl;
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+Event* find_event_on_instance_by_id(std::wstring label, int id, StrictEventPtr start_event)
+{
+ EventAreaPtr first;
+
+ if(start_event == NULL)
+ {
+ InstancePtrList instances = global_bmsc->get_instances();
+ InstancePtrList::iterator it;
+ InstancePtr instance;
+
+ for(it = instances.begin(); it != instances.end(); it++)
+ {
+ if((*it)->get_label() == label)
+ {
+ instance = *it;
+ break;
+ }
+ }
+
+ first = instance->get_first();
+ }
+ else
+ {
+ first = start_event->get_general_area();
+ }
+
+ StrictOrderAreaPtr strict = boost::dynamic_pointer_cast<StrictOrderArea>(first);
+
+ StrictEventPtr str = strict->get_first();
+
+ //function finds event only in bMSC which is looked for, so coregion area is not allowed
+ if(str == NULL)
+ {
+ std::cerr << "Error: bMSC which is looked for contains coregion area" << std::endl;
+ return NULL;
+ }
+
+ int event_id;
+ bool event_set = true;
+
+ event_id = str->get_attribute("identification", -1, event_set);
+
+ if(event_set)
+ attributed_events.push_back(str.get());
+
+ StrictEventPtr old;
+
+ while(event_id != id)
+ {
+ old = str;
+ str = str->get_successor();
+
+ if(str == NULL)
+ {
+ EventAreaPtr area = old->get_general_area();
+ area = area->get_next();
+
+ strict = boost::dynamic_pointer_cast<StrictOrderArea>(area);
+
+ if(strict == NULL)
+ {
+ std::cerr << "Error: Node was not found" << std::endl;
+ return NULL;
+ }
+
+ str = strict->get_first();
+
+ if(str == NULL)
+ {
+ std::cerr << "Error: Node was not found" << std::endl;
+ return NULL;
+ }
+ }
+
+ event_id = str->get_attribute("identification", -1, event_set);
+
+ if(event_set)
+ attributed_events.push_back(str.get());
+ }
+
+ return str.get();
+}
+
+/*
* Tries finding bMSC in bMSC
*
* bmsc - where the bmsc_f is looking for
@@ -850,7 +1253,7 @@
else
{
std::cout << "Error: Unexpected behaviour 43" << std::endl;
- return false;
+ return NULL;
}
//creates end node
@@ -865,17 +1268,114 @@
else
{
std::cout << "Error: Unexpected behaviour 23" << std::endl;
- return false;
+ return NULL;
}
return search_hmsc(hmsc, bmsc_f);
}
/*
+ * Checks if the instance is empty
+ */
+bool is_empty_instance(InstancePtrList node_instances, InstancePtrList b_instances)
+{
+ InstancePtrList::iterator node_instence_it, b_instance_it;
+
+ bool in_bmsc_f;
+ EventAreaPtr event_area;
+
+ for (node_instence_it = node_instances.begin(); node_instence_it != node_instances.end(); node_instence_it++)
+ {
+ //in case the user is not focused on this instance the algorithm skip the checking of them
+ bool skip = false;
+
+ if(!focused_instances.empty())
+ {
+ skip = true;
+
+ for(unsigned int i = 0; i < focused_instances.size(); i++)
+ {
+ if(focused_instances[i] == (*node_instence_it)->get_label())
+ skip = false;
+ }
+ }
+
+ if(skip)
+ continue;
+
+ in_bmsc_f = false;
+
+ for (b_instance_it = b_instances.begin(); b_instance_it != b_instances.end(); b_instance_it++)
+ {
+ if ((*node_instence_it)->get_label() == (*b_instance_it)->get_label())
+ {
+ in_bmsc_f = true;
+ break;
+ }
+ }
+
+ if (!in_bmsc_f)
+ {
+ event_area = (*node_instence_it)->get_first();
+
+ if (event_area != NULL)
+ {
+ StrictOrderAreaPtr strict = boost::dynamic_pointer_cast<StrictOrderArea > (event_area);
+
+ if (strict == NULL)
+ {
+ CoregionAreaPtr coregion = boost::dynamic_pointer_cast<CoregionArea > (event_area);
+ if (coregion != NULL)
+ {
+ if (coregion->get_minimal_events().size() != 0)
+ return false;
+ }
+ }
+ else
+ {
+ if (strict->get_first() != NULL)
+ return false;
+ }
+ }
+ }
+ }
+
+ return true;
+}
+
+/*
+ * Checks if the node was checked with this configuration
+ */
+bool look_at_checked_conf(ReferenceNodePtr node, ConfigurationPtr b)
+{
+ std::map<std::wstring, std::set<ConfigurationPtr> >::iterator it_checked;
+ it_checked = checked.find(node->get_msc()->get_label());
+
+ if (it_checked != checked.end())
+ {
+ std::set<ConfigurationPtr>::iterator conf_it;
+
+ for (conf_it = it_checked->second.begin(); conf_it != it_checked->second.end();
+ conf_it++)
+ {
+ if (b->compare(*conf_it))
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+/*
* Checks instance
*/
bool check_instance(InstancePtr node_instance, enum check_type type, PositionPtr old_position)
{
+ if(!focused_instances.empty() && !contain_focused_instances(node_instance->get_label()))
+ return true;
+
std::vector<Event*> node_events, b_events;
EventAreaPtr node_area, b_area;
std::wstring name;
@@ -1058,7 +1558,7 @@
std::set<PositionPtr> positions = conf->get_positions();
std::set<PositionPtr>::iterator position_it;
- if (node_instances.size() > b_instances.size())
+ if (focused_instances.empty() && node_instances.size() > b_instances.size())
{
if (!is_empty_instance(node_instances, b_instances))
return false;
@@ -1098,3 +1598,635 @@
return true;
}
+void set_identification(Event* node_e, Event* b_e)
+{
+ if (node_e->is_send())
+ {
+ node_e->set_attribute("identification", max_id);
+ attributed_events.push_back(node_e);
+ b_e->set_attribute("identification", max_id++);
+ attributed_events.push_back(b_e);
+
+ CompleteMessagePtr node_message = node_e->get_complete_message();
+
+ if (node_message != NULL)
+ {
+ Event* event = node_message->get_receive_event();
+ event->set_attribute("identification", max_id);
+ attributed_events.push_back(event);
+ }
+
+ CompleteMessagePtr b_message = b_e->get_complete_message();
+
+ if (b_message != NULL)
+ {
+ Event* event = b_message->get_receive_event();
+ event->set_attribute("identification", max_id++);
+ attributed_events.push_back(event);
+ }
+
+ }
+}
+
+bool is_node_null(ReferenceNodePtr node)
+{
+ MscPtr msc = node->get_msc();
+
+ BMscPtr bmsc = boost::dynamic_pointer_cast<BMsc> (msc);
+
+ if(bmsc == NULL)
+ {
+ std::cerr << "Internal Error: typecast failed" << std::endl;
+ return false;
+ }
+
+ InstancePtrList instances = bmsc->get_instances();
+ InstancePtrList::iterator it;
+
+ for(it = instances.begin(); it != instances.end(); it++)
+ {
+ if(focused_instances.empty() || contain_focused_instances((*it)->get_label()))
+ {
+ if(!is_instance_null(*it))
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool is_instance_null(InstancePtr instance)
+{
+ EventAreaPtr area;
+ StrictOrderAreaPtr strict;
+ CoregionAreaPtr cor;
+
+ if(instance == NULL)
+ return true;
+
+ area = instance->get_first();
+
+ while(area != NULL)
+ {
+ strict = boost::dynamic_pointer_cast<StrictOrderArea>(area);
+
+ if(strict == NULL)
+ {
+ cor = boost::dynamic_pointer_cast<CoregionArea>(area);
+
+ if(cor != NULL)
+ if(!is_cor_area_null(cor))
+ return false;
+ }
+ else
+ if(!is_strict_area_null(strict))
+ return false;
+
+ area = area->get_next();
+ }
+
+ return true;
+}
+
+bool is_cor_area_null(CoregionAreaPtr cor)
+{
+ if(cor == NULL)
+ return true;
+
+ if(!cor->get_minimal_events().empty())
+ return false;
+
+ return true;
+}
+
+bool is_strict_area_null(StrictOrderAreaPtr strict)
+{
+ if(strict == NULL)
+ return true;
+
+ if(strict->get_first() != NULL)
+ return false;
+
+ return true;
+}
+
+bool check_node_time(ReferenceNodePtr node, ConfigurationPtr conf)
+{
+ TimeRelationRefNodePtrSet top = node->get_time_relations_top();
+ TimeRelationRefNodePtrSet bottom = node->get_time_relations_bottom();
+ TimeRelationRefNodePtrSet::iterator it;
+
+ std::vector<TimeRelationRefNodePtr> top_vec, bottom_vec, themself_vec;
+
+//top_time_references, bottom_time_references su tam ulozene uzly kde sa zacina casovy interval, a su usporiadane podla top/bottom. To znamena casovy interval na node_a je pripojeny na top/bottom.
+
+//top_vec, bottom_vec su tam ulozene intervaly kde je aktualny node pripojeny ako koniec intervalu, su usporiadane podla top/bottom.
+
+ for(it = top.begin(); it!=top.end(); it++)
+ {
+ if((*it)->get_ref_node_b() == node.get())
+ {
+ if((*it)->get_ref_node_b() == (*it)->get_ref_node_a())
+ themself_vec.push_back(*it);
+ else
+ top_vec.push_back(*it);
+ }
+ else
+ top_time_references.insert(std::make_pair(*it, conf));
+ }
+
+ for(it = bottom.begin(); it!=bottom.end(); it++)
+ {
+ if((*it)->get_ref_node_b() == node.get())
+ {
+ if((*it)->get_ref_node_b() != (*it)->get_ref_node_a())
+ bottom_vec.push_back(*it);
+ }
+ else
+ bottom_time_references.insert(std::make_pair(*it, conf));
+ }
+
+ //relation between the first and the second hmsc node
+ //min_a - top of the first hmsc node
+ //min_b - top of the second hmsc node
+ //max_a - bottom of the first hmsc node
+ //max_b - bottom of the second hmsc node
+ Event* max_a = NULL;
+ Event* max_b = NULL;
+ Event* min_a = NULL;
+ Event* min_b = NULL;
+
+ if(!themself_vec.empty())
+ {
+ if(themself_vec.size() > 1)
+ {
+ std::cerr << "Error: more time intervals between top and bottom of one reference node" << std::endl;
+ return false;
+ }
+
+ min_a = get_min_event(conf);
+ max_b = get_max_event(node, conf);
+
+ if(min_a == NULL || max_b == NULL)
+ {
+ std::cerr << "Error: unexpected behaviour" << std::endl;
+ return false;
+ }
+
+ TimeRelationRefNodePtr relation = themself_vec.front();
+
+ if(relation == NULL)
+ {
+ std::cout<<"Error: Unexpected program's behaviour"<<std::endl;
+ return false;
+ }
+
+ MscTimeIntervalSetD result, hmsc_inter, bmsc_inter;
+
+ hmsc_inter = relation->get_interval_set();
+ bmsc_inter = time_matrix->operator()(min_a, max_b);
+
+ result = MscTimeIntervalSetD::set_intersection(hmsc_inter, bmsc_inter);
+
+ if(result.is_empty())
+ return false;
+ else
+ if(result != bmsc_inter)
+ {
+std::cerr << "Warning: the HMSC interval do not cover whole bMSC interval" << std::endl;
+ return false;
+ }
+ }
+
+ if(!top_vec.empty())
+ min_b = get_min_event(conf);
+
+ if(!bottom_vec.empty())
+ max_b = get_max_event(node, conf);
+
+ std::vector<TimeRelationRefNodePtr>::iterator it_vec;
+ std::map<TimeRelationRefNodePtr, ConfigurationPtr>::iterator it_map;
+
+ if(max_b != NULL)
+ {
+ for(it_vec = bottom_vec.begin(); it_vec != bottom_vec.end(); it_vec++)
+ {
+ it_map = top_time_references.find(*it_vec);
+
+ if(it_map == top_time_references.end())
+ continue;
+
+ min_a = get_min_event(it_map->second);
+
+ MscTimeIntervalSetD result, hmsc_inter, bmsc_inter;
+
+ hmsc_inter = (*it_vec)->get_interval_set();
+ bmsc_inter = time_matrix->operator()(min_a, max_b);
+ result = MscTimeIntervalSetD::set_intersection(hmsc_inter, bmsc_inter);
+
+ if(result.is_empty())
+ return false;
+ else
+ if(result != bmsc_inter)
+ {
+std::cerr << "Warning: the HMSC interval do not cover whole bMSC interval" << std::endl;
+ return false;
+ }
+
+ }
+
+ for(it_vec = bottom_vec.begin(); it_vec != bottom_vec.end(); it_vec++)
+ {
+ it_map = bottom_time_references.find(*it_vec);
+
+ if(it_map == bottom_time_references.end())
+ continue;
+
+ max_a = get_max_event(it_map->first->get_ref_node_a(), it_map->second);
+
+ MscTimeIntervalSetD hmsc_inter = (*it_vec)->get_interval_set();
+ MscTimeIntervalSetD result, bmsc_inter_set;
+
+ bmsc_inter_set = time_matrix->operator()(max_a, max_b);
+ result = MscTimeIntervalSetD::set_intersection(hmsc_inter, bmsc_inter_set);
+
+ if(result.is_empty())
+ return false;
+ else
+ if(result != bmsc_inter_set)
+ {
+std::cerr << "Warning: the HMSC interval do not cover whole bMSC interval" << std::endl;
+ return false;
+ }
+ }
+
+ }
+
+ if(min_b != NULL)
+ {
+ for(it_vec = top_vec.begin(); it_vec != top_vec.end(); it_vec++)
+ {
+ it_map = bottom_time_references.find(*it_vec);
+
+ if(it_map == bottom_time_references.end())
+ continue;
+
+ max_a = get_max_event(it_map->first->get_ref_node_a(), it_map->second);
+
+ MscTimeIntervalSetD hmsc_inter = (*it_vec)->get_interval_set();
+ MscTimeIntervalSetD result, bmsc_inter_set;
+
+ bmsc_inter_set = time_matrix->operator()(max_a, min_b);
+ result = MscTimeIntervalSetD::set_intersection(hmsc_inter, bmsc_inter_set);
+
+ if(result.is_empty())
+ return false;
+ else
+ if(result != bmsc_inter_set)
+ {
+std::cerr << "Warning: the HMSC interval do not cover whole bMSC interval" << std::endl;
+ return false;
+ }
+ }
+
+ for(it_vec = top_vec.begin(); it_vec != top_vec.end(); it_vec++)
+ {
+ it_map = top_time_references.find(*it_vec);
+
+ if(it_map == top_time_references.end())
+ continue;
+
+ min_a = get_min_event(it_map->second);
+
+ MscTimeIntervalSetD hmsc_inter = (*it_vec)->get_interval_set();
+ MscTimeIntervalSetD result, bmsc_inter_set;
+
+ bmsc_inter_set = time_matrix->operator()(min_a, min_b);
+ result = MscTimeIntervalSetD::set_intersection(hmsc_inter, bmsc_inter_set);
+
+ if(result.is_empty())
+ return false;
+ else
+ if(result != bmsc_inter_set)
+ {
+std::cerr << "Warning: the HMSC interval do not cover whole bMSC interval" << std::endl;
+ return false;
+ }
+ }
+ }
+
+ return true;
+
+}
+
+Event* get_min_event(ConfigurationPtr conf)
+{
+ std::set<PositionPtr> positions = conf->get_positions();
+ std::set<PositionPtr>::iterator it;
+ //vector of events which could be minimal event of matching HMSC node
+ std::vector<Event*> pos_min;
+
+ for(it = positions.begin(); it != positions.end(); it++)
+ {
+ std::vector<Event*> events = (*it)->get_events();
+
+ if(events.size() == 0)
+ continue;
+
+ std::map<CoregionAreaPtr, CoregionOrderingPtr>::iterator cor_ordering_it;
+
+ if(events.size() > 1)
+ {
+ CoregionAreaPtr cor = dynamic_cast<CoregionArea*> (events.front()->get_general_area());
+
+ if(cor == NULL)
+ {
+ std::cerr << "Error: unexpected behaviour" << std::endl;
+ return NULL;
+ }
+
+ cor_ordering_it = coregion_ordering.find(cor);
+
+ if(cor_ordering_it != coregion_ordering.end())
+ {
+ pos_min.push_back(cor_ordering_it->second->getOrdering().front().get());
+ }
+ }
+ else
+ pos_min.push_back(events.front());
+ }
+
+ //set of the minimal events (in case more events, the algorithm is not able to decide the minimum one)
+ std::set<Event*> min;
+ min.insert(pos_min[0]);
+
+ //try to eliminate pos_min to one event
+ ...
[truncated message content] |
|
From: <ma...@us...> - 2010-09-14 23:32:09
|
Revision: 926
http://scstudio.svn.sourceforge.net/scstudio/?rev=926&view=rev
Author: madzin
Date: 2010-09-14 23:32:02 +0000 (Tue, 14 Sep 2010)
Log Message:
-----------
repair membership time algorithm
Modified Paths:
--------------
trunk/src/membership/membership_alg.cpp
trunk/tests/membership/CMakeLists.txt
trunk/tests/membership/coregion_minimal_pat2.mpr
trunk/tests/membership/coregion_minimal_pat3.mpr
trunk/tests/membership/membership_test.cpp
Modified: trunk/src/membership/membership_alg.cpp
===================================================================
--- trunk/src/membership/membership_alg.cpp 2010-09-14 21:03:53 UTC (rev 925)
+++ trunk/src/membership/membership_alg.cpp 2010-09-14 23:32:02 UTC (rev 926)
@@ -29,6 +29,9 @@
#include <limits>
#include <map>
+//MembershipAlg object to be albe to use print_report
+MembershipAlg* mem;
+
// map of bmsc names and configurations which were checked
std::map<std::wstring, std::set<ConfigurationPtr> > checked;
@@ -193,6 +196,8 @@
//TODO skontrolovat co to vlastne robi, a kde kontrolujem casove obmedzenia v ramci bMSC z dajakeho HMSC nodu
bool check_node_time(ReferenceNodePtr node, ConfigurationPtr conf);
+bool check_node_time_themself(const std::vector<TimeRelationRefNodePtr>& themself_vec, ReferenceNodePtr node, ConfigurationPtr conf);
+
/*
* finds the maximum event of HMSC node and returns time interval value of matching event in bMSC
*/
@@ -212,7 +217,7 @@
/*
* compare absolut position, is the fist parameter before (more minimal) than the second
*
- * return: 0 - it is not decideable
+ * return: 0 - it is not decidable
* 1 - the fist is before the second
* 2 - the second is before the first
*/
@@ -221,14 +226,9 @@
/*
* returns the last event on instance
*/
-std::vector<Event*> get_last_instance_event(Event* start);
+Event* get_last_instance_event(Event* start);
/*
- * returns maximal events of coregion area
- */
-std::vector<Event*> get_last_coregion_events(CoregionArea* cor);
-
-/*
* compares events time relations
*
* paramterers: a - HMSC node
@@ -255,6 +255,13 @@
BMscIntervalSetMatrix get_bmsc_matrix(BMscPtr bmsc_f);
/*
+ *
+ */
+void update_maximum_set(std::set<Event*>& max, Event* new_element);
+
+void update_minimum_set(std::set<Event*>& min, Event* new_element);
+
+/*
* Returns precondition list of the membership algorithm
*/
Checker::PreconditionList MembershipAlg::get_preconditions(MscPtr msc) const
@@ -268,6 +275,8 @@
*/
MscPtr MembershipAlg::find(MscPtr msc, MscPtr bmsc)
{
+ mem = this;
+
HMscPtr hmsc = boost::dynamic_pointer_cast<HMsc > (msc);
BMscPtr bmsc_f = boost::dynamic_pointer_cast<BMsc > (bmsc);
@@ -542,7 +551,7 @@
bool strict_coregion(StrictOrderAreaPtr node_strict, std::vector<Event*>& node_events,
CoregionAreaPtr b_coregion, std::vector<Event*>& b_events)
{
- std::cerr << "unsuported function: finded bMSC cannot contain coregion" << std::endl;
+ mem->print_report(RS_ERROR, L"unsuported function: finded bMSC cannot contain coregion");
return false;
/* if(b_events.size() > 1)
@@ -619,7 +628,7 @@
if(cor == NULL)
{
- std::cerr << "Error: Unexpected behaviour 98" << std::endl;
+ mem->print_report(RS_ERROR, L"Error: Unexpected behaviour 98");
return false;
}
@@ -840,8 +849,12 @@
}
}
+ //when the coregion area describes more that the appropriate strict area
if(b_e->get_successor() == NULL)
- std::cerr << "Error: unexpected behaviour" << std::endl;
+ {
+ b_events.clear();
+ return true;
+ }
b_e = b_e->get_successor().get();
@@ -919,7 +932,7 @@
bool coregion_coretion(CoregionAreaPtr node_coregion, std::vector<Event*>& node_events,
CoregionAreaPtr b_coregion, std::vector<Event*>& b_events)
{
- std::cerr << "unsuported function: finded bMSC cannot contain coregion" << std::endl;
+ mem->print_report(RS_ERROR, L"Error: unsuported function (bMSC flow cannot contain coregion");
return false;
/*
@@ -1133,7 +1146,7 @@
else
if(result != bmsc_inter)
{
-std::cerr << "Warning: the HMSC interval do not cover whole bMSC interval" << std::endl;
+mem->print_report(RS_WARNING, L"Warning: the HMSC interval do not cover whole bMSC interval");
return false;
}
}
@@ -1175,7 +1188,7 @@
//function finds event only in bMSC which is looked for, so coregion area is not allowed
if(str == NULL)
{
- std::cerr << "Error: bMSC which is looked for contains coregion area" << std::endl;
+ mem->print_report(RS_ERROR, L"Error: bMSC which is looked for contains coregion area");
return NULL;
}
@@ -1203,7 +1216,7 @@
if(strict == NULL)
{
- std::cerr << "Error: Node was not found" << std::endl;
+ mem->print_report(RS_ERROR, L"Error: Node was not found");
return NULL;
}
@@ -1211,7 +1224,7 @@
if(str == NULL)
{
- std::cerr << "Error: Node was not found" << std::endl;
+ mem->print_report(RS_ERROR, L"Error: Node was not found");
return NULL;
}
}
@@ -1545,8 +1558,7 @@
if (bmsc == NULL)
{
-// print_report(RS_ERROR, stringize() << "Error: Some reference node does not refers to bMSC");
- std::cerr << "Error: Some reference node does not refers to bMSC." << std::endl;
+ mem->print_report(RS_ERROR, L"Error: Some reference node does not refers to bMSC");
return false;
}
@@ -1758,44 +1770,8 @@
if(!themself_vec.empty())
{
- if(themself_vec.size() > 1)
- {
- std::cerr << "Error: more time intervals between top and bottom of one reference node" << std::endl;
+ if(!check_node_time_themself(themself_vec, node, conf))
return false;
- }
-
- min_a = get_min_event(conf);
- max_b = get_max_event(node, conf);
-
- if(min_a == NULL || max_b == NULL)
- {
- std::cerr << "Error: unexpected behaviour" << std::endl;
- return false;
- }
-
- TimeRelationRefNodePtr relation = themself_vec.front();
-
- if(relation == NULL)
- {
- std::cout<<"Error: Unexpected program's behaviour"<<std::endl;
- return false;
- }
-
- MscTimeIntervalSetD result, hmsc_inter, bmsc_inter;
-
- hmsc_inter = relation->get_interval_set();
- bmsc_inter = time_matrix->operator()(min_a, max_b);
-
- result = MscTimeIntervalSetD::set_intersection(hmsc_inter, bmsc_inter);
-
- if(result.is_empty())
- return false;
- else
- if(result != bmsc_inter)
- {
-std::cerr << "Warning: the HMSC interval do not cover whole bMSC interval" << std::endl;
- return false;
- }
}
if(!top_vec.empty())
@@ -1829,7 +1805,7 @@
else
if(result != bmsc_inter)
{
-std::cerr << "Warning: the HMSC interval do not cover whole bMSC interval" << std::endl;
+mem->print_report(RS_ERROR, L"Warning: the HMSC interval do not cover whole bMSC interval");
return false;
}
@@ -1855,7 +1831,7 @@
else
if(result != bmsc_inter_set)
{
-std::cerr << "Warning: the HMSC interval do not cover whole bMSC interval" << std::endl;
+mem->print_report(RS_ERROR, L"Warning: the HMSC interval do not cover whole bMSC interval");
return false;
}
}
@@ -1884,7 +1860,7 @@
else
if(result != bmsc_inter_set)
{
-std::cerr << "Warning: the HMSC interval do not cover whole bMSC interval" << std::endl;
+mem->print_report(RS_ERROR, L"Warning: the HMSC interval do not cover whole bMSC interval");
return false;
}
}
@@ -1909,7 +1885,7 @@
else
if(result != bmsc_inter_set)
{
-std::cerr << "Warning: the HMSC interval do not cover whole bMSC interval" << std::endl;
+mem->print_report(RS_ERROR, L"Warning: the HMSC interval do not cover whole bMSC interval");
return false;
}
}
@@ -1919,6 +1895,59 @@
}
+bool check_node_time_themself(const std::vector<TimeRelationRefNodePtr>& themself_vec, ReferenceNodePtr node, ConfigurationPtr conf)
+{
+ Event* min_a = NULL;
+ Event* max_b = NULL;
+
+ if(themself_vec.size() > 1)
+ {
+ mem->print_report(RS_ERROR, L"Error: more time intervals between top and bottom of one reference node");
+ return false;
+ }
+
+ min_a = get_min_event(conf);
+ max_b = get_max_event(node, conf);
+
+ if(min_a == NULL || max_b == NULL)
+ {
+ if(min_a == NULL)
+ mem->print_report(RS_ERROR, stringize() << L"Error: not decidable which event is the minimal one of the "
+ << node->get_msc()->get_label() << L" node");
+ else
+ mem->print_report(RS_ERROR, stringize() << "Error: not decidable which event is the maximal one of the "
+ << node->get_msc()->get_label() << " node");
+
+ return false;
+ }
+
+ TimeRelationRefNodePtr relation = themself_vec.front();
+
+ if(relation == NULL)
+ {
+ mem->print_report(RS_ERROR, L"Error: Unexpected program's behaviour");
+ return false;
+ }
+
+ MscTimeIntervalSetD result, hmsc_inter, bmsc_inter;
+
+ hmsc_inter = relation->get_interval_set();
+ bmsc_inter = time_matrix->operator()(min_a, max_b);
+
+ result = MscTimeIntervalSetD::set_intersection(hmsc_inter, bmsc_inter);
+
+ if(result.is_empty())
+ return false;
+ else
+ if(result != bmsc_inter)
+ {
+mem->print_report(RS_ERROR, L"Warning: the HMSC interval do not cover whole bMSC interval");
+ return false;
+ }
+
+ return true;
+}
+
Event* get_min_event(ConfigurationPtr conf)
{
std::set<PositionPtr> positions = conf->get_positions();
@@ -1941,7 +1970,7 @@
if(cor == NULL)
{
- std::cerr << "Error: unexpected behaviour" << std::endl;
+ mem->print_report(RS_ERROR, L"Error: unexpected behaviour 406");
return NULL;
}
@@ -1967,8 +1996,8 @@
{
case 0: min.insert(pos_min[i]); break;
case 1: break;
- case 2: min.clear(); min.insert(pos_min[i]); break;
- default: std::cerr << "Error: unexpected behaviour" << std::endl;
+ case 2: update_minimum_set(min, pos_min[i]); break;
+ default: mem->print_report(RS_ERROR, L"Error: unexpected behaviour 407");
}
}
@@ -2032,8 +2061,8 @@
{
case 0: max.insert(pos_max[i]); break;
case 1: break;
- case 2: max.clear(); max.insert(pos_max[i]); break;
- default: std::cerr << "Error: unexpected behaviour" << std::endl;
+ case 2: update_maximum_set(max, pos_max[i]); break;
+ default: std::cerr << "Error: unexpected behaviour 408" << std::endl;
}
}
@@ -2043,10 +2072,58 @@
return *(max.begin());
}
+void update_maximum_set(std::set<Event*>& max, Event* new_element)
+{
+ std::set<Event*> to_delete;
+ std::set<Event*>::iterator it;
+
+ for(it = max.begin(); it != max.end(); it++)
+ {
+ switch (compare_absolut_position(new_element, *it))
+ {
+ case 0: break;
+ case 1: break;
+ case 2: to_delete.insert(*it); break;
+ default: std::cerr << "Error: unexpected behaviour 408" << std::endl;
+ }
+ }
+
+ for(it = to_delete.begin(); it != to_delete.end(); it++)
+ {
+ max.erase(*it);
+ }
+
+ max.insert(new_element);
+}
+
+void update_minimum_set(std::set<Event*>& min, Event* new_element)
+{
+ std::set<Event*> to_delete;
+ std::set<Event*>::iterator it;
+
+ for(it = min.begin(); it != min.end(); it++)
+ {
+ switch (compare_absolut_position(*it, new_element))
+ {
+ case 0: break;
+ case 1: break;
+ case 2: to_delete.insert(*it); break;
+ default: std::cerr << "Error: unexpected behaviour 408" << std::endl;
+ }
+ }
+
+ for(it = to_delete.begin(); it != to_delete.end(); it++)
+ {
+ min.erase(*it);
+ }
+
+ min.insert(new_element);
+}
+
/*
* compare absolut position, is the fist parameter before (more minimal) than the second
*
- * return: 0 - it is not decideable
+ * return: 0 - it is not decidable
* 1 - the fist is before the second
* 2 - the second is before the first
* 3 - error
@@ -2054,27 +2131,29 @@
int compare_absolut_position(Event* first, Event* second)
{
MscTimeIntervalSetD inter = time_matrix->operator()(first, second);
+
const IntervalList intervals = inter.get_set();
bool positive = false;
bool negative = false;
IntervalList::const_iterator it;
- //in interval [0], positive and negative are not set => negative == positive => undecidable
for(it = intervals.begin(); it != intervals.end(); it++)
{
- if(it->get_begin_value() > 0
- || (it->get_begin_value() == 0 && !it->get_begin_closed()))
- {
+ if(((abs(it->get_begin_value()) == 0 && it->get_begin_closed()))
+ || ((abs(it->get_end_value()) == 0 && it->get_end_closed())))
+ return 2;
+
+ if(it->get_begin_value() >= 0)
positive = true;
- }
- if(it->get_begin_value() < 0) negative = true;
+ if(it->get_begin_value() < 0)
+ negative = true;
- if(it->get_end_value() > 0) positive = true;
+ if(it->get_end_value() > 0)
+ positive = true;
- if(it->get_end_value() < 0
- || (it->get_end_value() == 0 && !it->get_end_closed()))
+ if(it->get_end_value() <= 0)
{
negative = true;
}
@@ -2099,14 +2178,14 @@
BMscPtr bmsc = boost::dynamic_pointer_cast<BMsc>(msc);
if(bmsc == NULL)
- std::cerr << "Error: Unexpected behaviur 35" << std::endl;
+ mem->print_report(RS_ERROR, L"Error: Unexpected behaviur 35");
InstancePtrList instances = bmsc->get_instances();
InstancePtrList::iterator inst_it;
//name of instance, event identification
std::map<std::wstring, std::vector<int> > node_last_events;
- EventPtr start;
+ EventPtr start = NULL;
EventArea* area;
StrictOrderArea* strict;
CoregionArea* cor;
@@ -2120,9 +2199,7 @@
{
start = strict->get_first();
std::vector<int> identifications;
- std::vector<Event*> e_set = get_last_instance_event(start.get());
-//TODO dopracovat coregiony
- Event* e = e_set.front();
+ Event* e = get_last_instance_event(start.get());
if(e == NULL)
continue;
@@ -2143,19 +2220,43 @@
if(cor != NULL)
{
- std::cout << "Coregion time intervals: This funcion is not currently supported." << std::endl;
+ start = cor->get_minimal_events().front();
+ std::map<CoregionAreaPtr, CoregionOrderingPtr>::iterator cor_order_it;
+ cor_order_it = coregion_ordering.find(cor);
+
+ if(cor_order_it == coregion_ordering.end())
+ {
+ mem->print_report(RS_ERROR, L"Error: unexpected behaviour");
+ return node_last_events;
+ }
+
+ start = cor_order_it->second->getOrdering().front();
+ std::vector<int> identifications;
+ Event* e = get_last_instance_event(start.get());
+
+ if(e == NULL)
+ continue;
+
+ int it_id;
+ bool it_set = true;
+
+ it_id = e->get_attribute("identification", -1, it_set);
+
+ if(!it_set)
+ identifications.push_back(it_id);
+
+ node_last_events.insert(std::make_pair((*inst_it)->get_label(), identifications));
}
}
return node_last_events;
}
-std::vector<Event*> get_last_instance_event(Event* start)
+Event* get_last_instance_event(Event* start)
{
- std::vector<Event*> result;
if(start == NULL)
- return result;
+ return NULL;
EventArea* area = start->get_general_area();
EventArea* not_null_area = area;
@@ -2183,28 +2284,22 @@
cor = dynamic_cast<CoregionArea*>(not_null_area);
if(str != NULL)
+ return str->get_last().get();
+ if(cor != NULL)
{
- result.push_back(str->get_last().get());
- return result;
+ std::map<CoregionAreaPtr, CoregionOrderingPtr>::iterator cor_ord_it;
+
+ cor_ord_it = coregion_ordering.find(cor);
+
+ if(cor_ord_it != coregion_ordering.end())
+ {
+ return cor_ord_it->second->getOrdering().back().get();
+ }
+ else
+ return NULL;
}
- else
- return get_last_coregion_events(cor);
-}
-std::vector<Event*> get_last_coregion_events(CoregionArea* cor)
-{
- std::vector<Event*> result;
-
- CoregionEventPVector vec = cor->get_maximal_events();
- CoregionEventPVector::iterator it;
-
- for(it = vec.begin(); it != vec.end(); it++)
- {
- EventPtr e = *it;
- result.push_back(e.get());
- }
-
- return result;
+ return NULL;
}
void remove_events_attributes(std::vector<Event*> vec)
Modified: trunk/tests/membership/CMakeLists.txt
===================================================================
--- trunk/tests/membership/CMakeLists.txt 2010-09-14 21:03:53 UTC (rev 925)
+++ trunk/tests/membership/CMakeLists.txt 2010-09-14 23:32:02 UTC (rev 926)
@@ -215,4 +215,19 @@
ADD_TEST(membership_test-92 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/time_hard_bmsc05.mpr ${CMAKE_CURRENT_SOURCE_DIR}/time_hard_bmsc_pat02.mpr 0)
#coregion minimal
-ADD_TEST(membership_test-93 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal.mpr ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal_pat1.mpr 1)
+ADD_TEST(membership_test-93 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal.mpr ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal_pat1.mpr 0)
+
+ADD_TEST(membership_test-94 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal.mpr ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal_pat2.mpr 0)
+
+ADD_TEST(membership_test-95 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal.mpr ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal_pat3.mpr )
+
+ADD_TEST(membership_test-96 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal.mpr ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal_pat4.mpr )
+
+ADD_TEST(membership_test-97 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal.mpr ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal_pat5.mpr 1)
+
+ADD_TEST(membership_test-98 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal.mpr ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal_pat6.mpr 1)
+
+ADD_TEST(membership_test-99 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal.mpr ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal_pat7.mpr 1)
+
+ADD_TEST(membership_test-100 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal.mpr ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal_pat8.mpr 0)
+
Modified: trunk/tests/membership/coregion_minimal_pat2.mpr
===================================================================
--- trunk/tests/membership/coregion_minimal_pat2.mpr 2010-09-14 21:03:53 UTC (rev 925)
+++ trunk/tests/membership/coregion_minimal_pat2.mpr 2010-09-14 23:32:02 UTC (rev 926)
@@ -26,8 +26,3 @@
in Ping_pong,2 from B;
endinstance;
endmsc;
-msc Page_1;
-initial connect L0;
-L0: reference NAME connect L1;
-L1: final;
-endmsc;
Modified: trunk/tests/membership/coregion_minimal_pat3.mpr
===================================================================
--- trunk/tests/membership/coregion_minimal_pat3.mpr 2010-09-14 21:03:53 UTC (rev 925)
+++ trunk/tests/membership/coregion_minimal_pat3.mpr 2010-09-14 23:32:02 UTC (rev 926)
@@ -27,8 +27,3 @@
in Ping_pong,2 from B;
endinstance;
endmsc;
-msc Page_1;
-initial connect L0;
-L0: reference NAME connect L1;
-L1: final;
-endmsc;
Modified: trunk/tests/membership/membership_test.cpp
===================================================================
--- trunk/tests/membership/membership_test.cpp 2010-09-14 21:03:53 UTC (rev 925)
+++ trunk/tests/membership/membership_test.cpp 2010-09-14 23:32:02 UTC (rev 926)
@@ -98,6 +98,7 @@
char *filename = extract_filename(argv[1]);
MembershipAlg mem;
+ mem.set_printer(&printer);
BMscPtr bmsc = boost::dynamic_pointer_cast<BMsc>(msc_b[0]);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-09-15 20:32:01
|
Revision: 932
http://scstudio.svn.sourceforge.net/scstudio/?rev=932&view=rev
Author: madzin
Date: 2010-09-15 20:31:55 +0000 (Wed, 15 Sep 2010)
Log Message:
-----------
repair small bugs and add test
Modified Paths:
--------------
trunk/src/membership/membership_alg.cpp
trunk/src/membership/membership_alg.h
trunk/tests/membership/CMakeLists.txt
trunk/tests/membership/complete_pat2.mpr
Added Paths:
-----------
trunk/tests/membership/complete1.mpr
trunk/tests/membership/complete_pat5.mpr
trunk/tests/membership/partial_mem_easy.mpr
trunk/tests/membership/test_bmsc32.mpr
trunk/tests/membership/test_bmsc32_1.mpr
trunk/tests/membership/test_bmsc32_2.mpr
trunk/tests/membership/test_bmsc33.mpr
trunk/tests/membership/test_bmsc33_1.mpr
trunk/tests/membership/test_bmsc34.mpr
trunk/tests/membership/test_hmsc33.mpr
Modified: trunk/src/membership/membership_alg.cpp
===================================================================
--- trunk/src/membership/membership_alg.cpp 2010-09-15 19:47:49 UTC (rev 931)
+++ trunk/src/membership/membership_alg.cpp 2010-09-15 20:31:55 UTC (rev 932)
@@ -267,23 +267,86 @@
Searcher::PreconditionList MembershipAlg::get_preconditions(MscPtr msc) const
{
Searcher::PreconditionList result;
+
+ result.push_back(PrerequisiteCheck(L"Correct Time Constraint Syntax", PrerequisiteCheck::PP_REQUIRED));
+ result.push_back(PrerequisiteCheck(L"Time Consistent", PrerequisiteCheck::PP_REQUIRED));
+
return result;
}
/*
+bool check_time_consistency_and_syntax(MscPtr msc, MscPtr bmsc)
+{
+ HMscPtr hmsc = boost::dynamic_pointer_cast<HMsc > (msc);
+ BMscPtr bmsc_f = boost::dynamic_pointer_cast<BMsc > (bmsc);
+ ChannelMapperPtr mapper;
+ ConsistencyChecker checker;
+ ConstraintsChecker checker2;
+ SRChannelMapperPtr srm = SRChannelMapper::instance(); //sender-receiver
+// SRMChannelMapperPtr srlm = SRMChannelMapper::instance(); //sender-receiver-label
+
+ if (bmsc_f == NULL)
+ {
+ mem->print_report(RS_ERROR, L"MSC which is looked for, must be bMSC.");
+ return NULL;
+ }
+
+ std::list<BMscPtr> consistency_results = checker.check(bmsc_f,srm);
+ std::list<BMscPtr> constraints_results = checker2.check(bmsc_f,srm);
+
+ if(!consistency_results.empty() || !consistency_results.empty())
+ {
+ mem->print_report(RS_ERROR, L"MSC which is looked for, is not time consistent or time constraints.");
+ return false;
+ }
+
+ if (hmsc == NULL)
+ {
+ BMscPtr bmsc_scecification = boost::dynamic_pointer_cast<BMsc > (msc);
+
+ if(bmsc_scecification != NULL)
+ {
+ std::list<BMscPtr> consistency_resultsII = checker.check(bmsc_scecification,srm);
+ std::list<BMscPtr> constraints_resultsII = checker2.check(bmsc_scecification,srm);
+
+ if(!consistency_resultsII.empty() || !constraints_resultsII.empty())
+ {
+ mem->print_report(RS_ERROR, L"MSC which is specification, is not time consistent or time constraints.");
+ return false;
+ }
+ }
+ }
+ else
+ {
+// std::list<HMscPtr> consistency_resultsIII = checker.check(hmsc,srm);
+// if(!consistency_resultsIII.empty())
+// {
+// mem->print_report(RS_ERROR, L"MSC which is specification, is not time consistent.");
+// return false;
+// }
+ }
+
+ return true;
+}
+*/
+
+/*
* Tries finding bMsc in Msc
*/
MscPtr MembershipAlg::find(MscPtr msc, MscPtr bmsc)
{
mem = this;
+// if(!check_time_consistency_and_syntax(msc, bmsc))
+// return false;
+
HMscPtr hmsc = boost::dynamic_pointer_cast<HMsc > (msc);
BMscPtr bmsc_f = boost::dynamic_pointer_cast<BMsc > (bmsc);
+
if (bmsc_f == NULL)
{
- print_report(RS_ERROR,
- stringize() << "MSC which is looked for, must be bMSC.");
+ print_report(RS_ERROR, L"MSC which is looked for, must be bMSC.");
return NULL;
}
@@ -446,11 +509,14 @@
}
//checks time constraints for this node
- if(!check_node_time(node, old_config_II))
+ if(focused_instances.empty())
{
- remove_events_attributes(attributed_events);
- attributed_events.clear();
- return false;
+ if(!check_node_time(node, old_config_II))
+ {
+ remove_events_attributes(attributed_events);
+ attributed_events.clear();
+ return false;
+ }
}
//checks the ordering of events (by attribute which was set at check_node(node, membership,b))
Modified: trunk/src/membership/membership_alg.h
===================================================================
--- trunk/src/membership/membership_alg.h 2010-09-15 19:47:49 UTC (rev 931)
+++ trunk/src/membership/membership_alg.h 2010-09-15 20:31:55 UTC (rev 932)
@@ -22,6 +22,7 @@
#include "data/searcher.h"
#include "membership/export.h"
#include "check/pseudocode/msc_duplicators.h"
+#include "check/time/constraint_syntax.h"
bool contain_focused_instances(std::wstring instance);
Modified: trunk/tests/membership/CMakeLists.txt
===================================================================
--- trunk/tests/membership/CMakeLists.txt 2010-09-15 19:47:49 UTC (rev 931)
+++ trunk/tests/membership/CMakeLists.txt 2010-09-15 20:31:55 UTC (rev 932)
@@ -219,9 +219,9 @@
ADD_TEST(membership_test-94 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal.mpr ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal_pat2.mpr 0)
-ADD_TEST(membership_test-95 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal.mpr ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal_pat3.mpr )
+ADD_TEST(membership_test-95 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal.mpr ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal_pat3.mpr 0)
-ADD_TEST(membership_test-96 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal.mpr ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal_pat4.mpr )
+ADD_TEST(membership_test-96 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal.mpr ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal_pat4.mpr 0)
ADD_TEST(membership_test-97 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal.mpr ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal_pat5.mpr 1)
@@ -231,3 +231,35 @@
ADD_TEST(membership_test-100 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal.mpr ${CMAKE_CURRENT_SOURCE_DIR}/coregion_minimal_pat8.mpr 0)
+#partial membership
+ADD_TEST(membership_test-101 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/partial_mem_easy.mpr ${CMAKE_CURRENT_SOURCE_DIR}/partial_mem_easy_pat1.mpr 1 A)
+
+ADD_TEST(membership_test-102 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/partial_mem_easy.mpr ${CMAKE_CURRENT_SOURCE_DIR}/partial_mem_easy_pat1.mpr 0 A B)
+
+ADD_TEST(membership_test-103 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/partial_mem_easy.mpr ${CMAKE_CURRENT_SOURCE_DIR}/partial_mem_easy.mpr 1 A B)
+
+ADD_TEST(membership_test-104 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/partial_mem_easy.mpr ${CMAKE_CURRENT_SOURCE_DIR}/partial_mem_easy.mpr 1 A B C)
+
+
+
+
+ADD_TEST(membership_test-105 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/complete.mpr ${CMAKE_CURRENT_SOURCE_DIR}/complete_pat1.mpr 0)
+
+ADD_TEST(membership_test-106 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/complete.mpr ${CMAKE_CURRENT_SOURCE_DIR}/complete_pat5.mpr 1)
+
+ADD_TEST(membership_test-107 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/complete.mpr ${CMAKE_CURRENT_SOURCE_DIR}/complete_pat2.mpr 0)
+
+ADD_TEST(membership_test-108 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/complete1.mpr ${CMAKE_CURRENT_SOURCE_DIR}/complete_pat3.mpr 1)
+
+ADD_TEST(membership_test-109 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/complete.mpr ${CMAKE_CURRENT_SOURCE_DIR}/complete_pat1.mpr 1 PC)
+
+
+#complete.mpr separeted into small pieces
+ADD_TEST(membership_test-115 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc32.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc32_1.mpr 1)
+
+ADD_TEST(membership_test-116 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc33.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc33_1.mpr 1)
+
+ADD_TEST(membership_test-117 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_hmsc33.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc33_1.mpr 1)
+
+#do not meet preconditions
+#ADD_TEST(membership_test-118 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc32.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc32_2.mpr 0)
Added: trunk/tests/membership/complete1.mpr
===================================================================
--- trunk/tests/membership/complete1.mpr (rev 0)
+++ trunk/tests/membership/complete1.mpr 2010-09-15 20:31:55 UTC (rev 932)
@@ -0,0 +1,100 @@
+/* remove some time intervals in HMSC, otherwise same as complete.mpr */
+
+mscdocument complete.vsd;
+msc Page_1;
+initial connect L0;
+L0: reference A connect L1;
+L1: connect L2, L3;
+L2: reference C connect L4;
+L3: reference B time [1];
+ connect L5;
+L4: reference D connect L5;
+L5: connect L6;
+L6: final;
+endmsc;
+msc A;
+inst PC;
+inst Router;
+inst Server;
+PC: instance;
+label e0;
+out c,0 to Router;
+time e1 [0,1);
+endinstance;
+Router: instance;
+concurrent;
+label e1;
+in c,0 from PC;
+label e2;
+out a,1 to Server before e3;
+time e3 [1,2];
+label e3;
+out b,2 to Server;
+endconcurrent;
+endinstance;
+Server: instance;
+in a,1 from Router;
+in b,2 from Router;
+endinstance;
+endmsc;
+msc B;
+inst PC;
+inst Router;
+inst Server;
+PC: instance;
+in c,0 from Server;
+out b,1 to Router;
+endinstance;
+Router: instance;
+in c,2 from Server;
+in b,1 from PC;
+endinstance;
+Server: instance;
+concurrent;
+out c,2 to Router;
+out c,0 to PC;
+endconcurrent;
+endinstance;
+endmsc;
+msc C;
+inst PC;
+inst Router;
+inst Server;
+PC: instance;
+out a,0 to Router;
+out a,1 to Router;
+endinstance;
+Router: instance;
+in a,0 from PC;
+in b,2 from Server;
+in a,1 from PC;
+endinstance;
+Server: instance;
+out b,2 to Router;
+endinstance;
+endmsc;
+msc D;
+inst PC;
+inst Router;
+inst Server;
+PC: instance;
+in b,0 from Router;
+out c,1 to Router;
+endinstance;
+Router: instance;
+concurrent;
+in a,2 from Server;
+in a,3 from Server;
+in b,4 from Server;
+out b,0 to PC;
+endconcurrent;
+in c,1 from PC;
+endinstance;
+Server: instance;
+concurrent;
+out a,2 to Router;
+out a,3 to Router;
+out b,4 to Router;
+endconcurrent;
+endinstance;
+endmsc;
Modified: trunk/tests/membership/complete_pat2.mpr
===================================================================
--- trunk/tests/membership/complete_pat2.mpr 2010-09-15 19:47:49 UTC (rev 931)
+++ trunk/tests/membership/complete_pat2.mpr 2010-09-15 20:31:55 UTC (rev 932)
@@ -36,7 +36,7 @@
in b,3 from Router;
label e10;
out c,5 to Router;
-time e8 [0], e11 [0,1);
+time e8 [0], e11 [1];
label e11;
out c,1 to PC;
time e2 [0];
Added: trunk/tests/membership/complete_pat5.mpr
===================================================================
--- trunk/tests/membership/complete_pat5.mpr (rev 0)
+++ trunk/tests/membership/complete_pat5.mpr 2010-09-15 20:31:55 UTC (rev 932)
@@ -0,0 +1,44 @@
+mscdocument complete_pat1.vsd;
+msc Page_1;
+inst PC;
+inst Router;
+inst Server;
+PC: instance;
+label e0;
+out c,0 to Router;
+time e1 [0,1);
+label e2;
+in c,1 from Server;
+time e3 [0];
+label e3;
+out b,2 to Router;
+time e4 [0];
+endinstance;
+Router: instance;
+label e1;
+in c,0 from PC;
+label e5;
+out a,3 to Server;
+time e6 [1,2];
+label e6;
+out b,4 to Server;
+time e7 [5,6];
+label e8;
+in c,5 from Server;
+label e4;
+in b,2 from PC;
+endinstance;
+Server: instance;
+label e9;
+in a,3 from Router;
+time e5 [0,1);
+label e7;
+in b,4 from Router;
+label e10;
+out c,5 to Router;
+time e8 [0], e11 [1];
+label e11;
+out c,1 to PC;
+time e2 [0];
+endinstance;
+endmsc;
Added: trunk/tests/membership/partial_mem_easy.mpr
===================================================================
--- trunk/tests/membership/partial_mem_easy.mpr (rev 0)
+++ trunk/tests/membership/partial_mem_easy.mpr 2010-09-15 20:31:55 UTC (rev 932)
@@ -0,0 +1,20 @@
+mscdocument partial_mem_easy.vsd;
+msc Page_1;
+inst A;
+inst B;
+inst C;
+A: instance;
+out a,0 to B;
+in e,1 from B;
+endinstance;
+B: instance;
+in a,0 from A;
+out b,2 to C;
+in c,3 from C;
+out e,1 to A;
+endinstance;
+C: instance;
+in b,2 from B;
+out c,3 to B;
+endinstance;
+endmsc;
Added: trunk/tests/membership/test_bmsc32.mpr
===================================================================
--- trunk/tests/membership/test_bmsc32.mpr (rev 0)
+++ trunk/tests/membership/test_bmsc32.mpr 2010-09-15 20:31:55 UTC (rev 932)
@@ -0,0 +1,25 @@
+msc A;
+inst PC;
+inst Router;
+inst Server;
+PC: instance;
+label e0;
+out c,0 to Router;
+time e1 [0,1);
+endinstance;
+Router: instance;
+concurrent;
+label e1;
+in c,0 from PC;
+label e2;
+out a,1 to Server before e3;
+time e3 [1,2];
+label e3;
+out b,2 to Server;
+endconcurrent;
+endinstance;
+Server: instance;
+in a,1 from Router;
+in b,2 from Router;
+endinstance;
+endmsc;
Added: trunk/tests/membership/test_bmsc32_1.mpr
===================================================================
--- trunk/tests/membership/test_bmsc32_1.mpr (rev 0)
+++ trunk/tests/membership/test_bmsc32_1.mpr 2010-09-15 20:31:55 UTC (rev 932)
@@ -0,0 +1,27 @@
+msc Page_1;
+inst PC;
+inst Router;
+inst Server;
+PC: instance;
+label e0;
+out c,0 to Router;
+time e1 [0,1);
+endinstance;
+Router: instance;
+label e1;
+in c,0 from PC;
+label e5;
+out a,3 to Server;
+time e6 [1,2];
+label e6;
+out b,4 to Server;
+time e7 [5,6];
+endinstance;
+Server: instance;
+label e9;
+in a,3 from Router;
+time e5 [1];
+label e7;
+in b,4 from Router;
+endinstance;
+endmsc;
Added: trunk/tests/membership/test_bmsc32_2.mpr
===================================================================
--- trunk/tests/membership/test_bmsc32_2.mpr (rev 0)
+++ trunk/tests/membership/test_bmsc32_2.mpr 2010-09-15 20:31:55 UTC (rev 932)
@@ -0,0 +1,27 @@
+msc Page_1;
+inst PC;
+inst Router;
+inst Server;
+PC: instance;
+label e0;
+out c,0 to Router;
+time e1 [0,1);
+endinstance;
+Router: instance;
+label e1;
+in c,0 from PC;
+label e5;
+out b,3 to Server;
+time e6 [5,6);
+label e7;
+out a,4 to Server;
+time e5 [-2,-1];
+endinstance;
+Server: instance;
+label e9;
+in a,4 from Router;
+time e7 [0,1);
+label e6;
+in b,3 from Router;
+endinstance;
+endmsc;
Added: trunk/tests/membership/test_bmsc33.mpr
===================================================================
--- trunk/tests/membership/test_bmsc33.mpr (rev 0)
+++ trunk/tests/membership/test_bmsc33.mpr 2010-09-15 20:31:55 UTC (rev 932)
@@ -0,0 +1,19 @@
+msc B;
+inst PC;
+inst Router;
+inst Server;
+PC: instance;
+in c,0 from Server;
+out b,1 to Router;
+endinstance;
+Router: instance;
+in c,2 from Server;
+in b,1 from PC;
+endinstance;
+Server: instance;
+concurrent;
+out c,2 to Router;
+out c,0 to PC;
+endconcurrent;
+endinstance;
+endmsc;
Added: trunk/tests/membership/test_bmsc33_1.mpr
===================================================================
--- trunk/tests/membership/test_bmsc33_1.mpr (rev 0)
+++ trunk/tests/membership/test_bmsc33_1.mpr 2010-09-15 20:31:55 UTC (rev 932)
@@ -0,0 +1,28 @@
+msc Page_1;
+inst PC;
+inst Router;
+inst Server;
+PC: instance;
+label e2;
+in c,1 from Server;
+time e3 [0];
+label e3;
+out b,2 to Router;
+time e4 [0];
+endinstance;
+Router: instance;
+label e8;
+in c,5 from Server;
+label e4;
+in b,2 from PC;
+endinstance;
+Server: instance;
+label e10;
+out c,5 to Router;
+time e8 [0], e11 [1];
+label e11;
+out c,1 to PC;
+time e2 [0];
+endinstance;
+endmsc;
+
Added: trunk/tests/membership/test_bmsc34.mpr
===================================================================
--- trunk/tests/membership/test_bmsc34.mpr (rev 0)
+++ trunk/tests/membership/test_bmsc34.mpr 2010-09-15 20:31:55 UTC (rev 932)
@@ -0,0 +1,25 @@
+msc A;
+inst PC;
+inst Router;
+inst Server;
+PC: instance;
+label e0;
+out c,0 to Router;
+time e1 [0,1);
+endinstance;
+Router: instance;
+concurrent;
+label e1;
+in c,0 from PC;
+label e2;
+out a,1 to Server;
+time e3 [1,2];
+label e3;
+out b,2 to Server;
+endconcurrent;
+endinstance;
+Server: instance;
+in a,1 from Router;
+in b,2 from Router;
+endinstance;
+endmsc;
Added: trunk/tests/membership/test_hmsc33.mpr
===================================================================
--- trunk/tests/membership/test_hmsc33.mpr (rev 0)
+++ trunk/tests/membership/test_hmsc33.mpr 2010-09-15 20:31:55 UTC (rev 932)
@@ -0,0 +1,25 @@
+msc Page_1;
+initial connect L0;
+L0: reference B time [1]; connect L1;
+L1: final;
+endmsc;
+
+msc B;
+inst PC;
+inst Router;
+inst Server;
+PC: instance;
+in c,0 from Server;
+out b,1 to Router;
+endinstance;
+Router: instance;
+in c,2 from Server;
+in b,1 from PC;
+endinstance;
+Server: instance;
+concurrent;
+out c,2 to Router;
+out c,0 to PC;
+endconcurrent;
+endinstance;
+endmsc;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <xr...@us...> - 2010-09-16 08:58:25
|
Revision: 934
http://scstudio.svn.sourceforge.net/scstudio/?rev=934&view=rev
Author: xrehak
Date: 2010-09-16 08:58:18 +0000 (Thu, 16 Sep 2010)
Log Message:
-----------
Basic configuration files for DoxyGen.
Added Paths:
-----------
trunk/doxy.footer.html
trunk/doxygen.config
Added: trunk/doxy.footer.html
===================================================================
--- trunk/doxy.footer.html (rev 0)
+++ trunk/doxy.footer.html 2010-09-16 08:58:18 UTC (rev 934)
@@ -0,0 +1,7 @@
+<hr size="1">
+<a href="http://sourceforge.net/"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=219467&type=2" alt="SourceForge.net Logo" height="37" align="left" border="0" width="125"></a>
+<address style="text-align: right;"><small>Generated on $datetime for Sequence Chart Studio by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"></a></small></address>
+
+</body></html>
Property changes on: trunk/doxy.footer.html
___________________________________________________________________
Added: svn:keywords
+ Date Revision Author HeadURL Id
Added: svn:eol-style
+ native
Added: trunk/doxygen.config
===================================================================
--- trunk/doxygen.config (rev 0)
+++ trunk/doxygen.config 2010-09-16 08:58:18 UTC (rev 934)
@@ -0,0 +1,1515 @@
+# Doxyfile 1.6.1
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = "Sequence Chart Studio"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER = "svn HEAD revision"
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = doc/doxy_output/
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses.
+# With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this tag.
+# The format is ext=language, where ext is a file extension, and language is one of
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = YES
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = NO
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = .
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS = *.cpp \
+ *.h
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in...
[truncated message content] |
|
From: <lko...@us...> - 2010-09-16 12:17:51
|
Revision: 939
http://scstudio.svn.sourceforge.net/scstudio/?rev=939&view=rev
Author: lkorenciak
Date: 2010-09-16 12:17:44 +0000 (Thu, 16 Sep 2010)
Log Message:
-----------
added returning of counterexamples when time consistency check is not satisfied + some minor fixes/changes in few other algorithms
Modified Paths:
--------------
trunk/src/check/liveness/deadlock_checker.cpp
trunk/src/check/time/find_block.cpp
trunk/src/check/time/find_block.h
trunk/src/check/time/tightening.h
trunk/src/check/time/time_consistency.h
trunk/src/data/time.h
trunk/tests/time/consistency/CMakeLists.txt
Modified: trunk/src/check/liveness/deadlock_checker.cpp
===================================================================
--- trunk/src/check/liveness/deadlock_checker.cpp 2010-09-16 12:14:08 UTC (rev 938)
+++ trunk/src/check/liveness/deadlock_checker.cpp 2010-09-16 12:17:44 UTC (rev 939)
@@ -44,7 +44,6 @@
{
HMscPathDuplicator duplicator;
HMscPtr example = duplicator.duplicate_path(path);
- MscElementPListList::const_iterator h;
MscElement* last = path.back().back();
duplicator.get_copy(last)->set_marked(true);
return example;
Modified: trunk/src/check/time/find_block.cpp
===================================================================
--- trunk/src/check/time/find_block.cpp 2010-09-16 12:14:08 UTC (rev 938)
+++ trunk/src/check/time/find_block.cpp 2010-09-16 12:17:44 UTC (rev 939)
@@ -69,7 +69,7 @@
}
}
}
- Block block= Block(trav->m_counter_of_blocks, n, n, 0, m_traverser.get_reached_elements());
+ Block block= Block(trav->m_counter_of_blocks, n, n, 0, m_traverser->get_reached_elements());
trav->m_list_of_blocks.push_back(block);
trav->m_last_block=trav->m_counter_of_blocks;
trav->m_open_constraints.insert(node_constraints.begin(), node_constraints.end());
Modified: trunk/src/check/time/find_block.h
===================================================================
--- trunk/src/check/time/find_block.h 2010-09-16 12:14:08 UTC (rev 938)
+++ trunk/src/check/time/find_block.h 2010-09-16 12:17:44 UTC (rev 939)
@@ -33,16 +33,16 @@
//complete virtual methods from WNFlistener and NFlistener
class SCTIME_EXPORT MyTraverse:public WhiteNodeFoundListener, public NodeFinishedListener
{
- DFSBMscGraphTraverser m_traverser;
+ DFSBMscGraphTraverser* m_traverser;
public:
TraverseAndMarkBlocks* trav;
- MyTraverse(DFSBMscGraphTraverser traverser)
+ MyTraverse(DFSBMscGraphTraverser* traverser)
{
m_traverser = traverser;
trav = NULL;
}
- MyTraverse(TraverseAndMarkBlocks* t,DFSBMscGraphTraverser traverser)
+ MyTraverse(TraverseAndMarkBlocks* t,DFSBMscGraphTraverser* traverser)
{
m_traverser = traverser;
trav=t;
@@ -71,6 +71,9 @@
:m_number(n),m_begin(begin),m_end(end),m_if_end(if_end)
{
m_path_to_block.clear();
+ std::cout<<"size of path (list of lists) we got: "<<list.size()<<" size of the first list: "<<std::endl;
+ if(list.size() == 0) std::cout<<"is empty"<<std::endl;
+ else std::cout<<list.back().size()<<std::endl;
for(MscElementPListList::iterator it = list.begin();it!=list.end();it++)
m_path_to_block.push_back(MscElementPList(it->begin(),it->end()));
}
@@ -140,7 +143,7 @@
//BMscGraphDuplicator* duplicator= new BMscGraphDuplicator();
//m_msc=duplicator->duplicate_hmsc(m_msc);
DFSBMscGraphTraverser traverser_block;
- MyTraverse my_trav(this,traverser_block);
+ MyTraverse my_trav(this,&traverser_block);
traverser_block.add_white_node_found_listener(&my_trav);
traverser_block.add_node_finished_listener(&my_trav);
traverser_block.traverse(m_msc);
Modified: trunk/src/check/time/tightening.h
===================================================================
--- trunk/src/check/time/tightening.h 2010-09-16 12:14:08 UTC (rev 938)
+++ trunk/src/check/time/tightening.h 2010-09-16 12:17:44 UTC (rev 939)
@@ -34,88 +34,88 @@
#include <utility>
/**
- * \brief tightens BMsc
+ * \brief
*/
-class AllCombination: public std::vector<std::pair<EventP,EventP> >
-{
-private:
- std::list<std::vector<std::pair<EventP,EventP> > > lists;
+// class AllCombination: public std::vector<std::pair<EventP,EventP> >
+// {
+// private:
+// std::list<std::vector<std::pair<EventP,EventP> > > lists;
+//
+// std::vector<std::vector<std::pair<EventP,EventP> > >* v_lists;
+// std::vector<size_type>* iterators;
+// bool ini;
+//
+// void set_value(size_t to)
+// {
+// for(size_t i= 0; i<= to;i++)
+// {
+// at(i)=((*v_lists)[i])[(*iterators)[i]];
+// }
+//
+// }
+//
+// bool move_next(size_t i)
+// {
+// if(i>=v_lists->size())
+// {
+// return false;
+// }
+//
+// (*iterators)[i]++;
+//
+// if((*iterators)[i]>=(*v_lists)[i].size())
+// {
+// (*iterators)[i]=0;
+// return move_next(++i);
+// }
+// set_value(i);
+// return true;
+// }
+//
+// public:
+// AllCombination():v_lists(NULL),iterators(NULL),ini(false)
+// {
+//
+// }
+//
+// ~AllCombination()
+// {
+// if(ini)
+// {
+// delete v_lists;
+// delete iterators;
+// }
+// }
+//
+// void add_list(std::vector<std::pair<EventP,EventP> > floor)
+// {
+// lists.push_back(floor);
+// }
+//
+// void init()
+// {
+// if(lists.size() == 0)
+// return ;
+// if(ini)
+// throw std::runtime_error("Already allocated!");
+// else
+// ini = true;
+//
+// v_lists = new std::vector<std::vector<std::pair<EventP,EventP> > >(lists.begin(),lists.end());
+// resize(lists.size());
+// iterators = new std::vector<size_type>(lists.size(),0);
+// set_value(lists.size()-1);
+// }
+//
+// bool move_next()
+// {
+// return move_next(0);
+// }
+//
+// };
- std::vector<std::vector<std::pair<EventP,EventP> > >* v_lists;
- std::vector<size_type>* iterators;
- bool ini;
- void set_value(size_t to)
- {
- for(size_t i= 0; i<= to;i++)
- {
- at(i)=((*v_lists)[i])[(*iterators)[i]];
- }
-
- }
-
- bool move_next(size_t i)
- {
- if(i>=v_lists->size())
- {
- return false;
- }
-
- (*iterators)[i]++;
-
- if((*iterators)[i]>=(*v_lists)[i].size())
- {
- (*iterators)[i]=0;
- return move_next(++i);
- }
- set_value(i);
- return true;
- }
-
-public:
- AllCombination():v_lists(NULL),iterators(NULL),ini(false)
- {
-
- }
-
- ~AllCombination()
- {
- if(ini)
- {
- delete v_lists;
- delete iterators;
- }
- }
-
- void add_list(std::vector<std::pair<EventP,EventP> > floor)
- {
- lists.push_back(floor);
- }
-
- void init()
- {
- if(lists.size() == 0)
- return ;
- if(ini)
- throw std::runtime_error("Already allocated!");
- else
- ini = true;
-
- v_lists = new std::vector<std::vector<std::pair<EventP,EventP> > >(lists.begin(),lists.end());
- resize(lists.size());
- iterators = new std::vector<size_type>(lists.size(),0);
- set_value(lists.size()-1);
- }
-
- bool move_next()
- {
- return move_next(0);
- }
-
-};
-
-
class TightenBMsc
{
@@ -225,7 +225,6 @@
-// std::stack<EventP> events_to_delete;
SRChannelMapperPtr srm = SRChannelMapper::instance();
BMscIntervalSetMatrix b_matrix(bmsc,m_causal,srm); // TODO: channelmapper
@@ -250,7 +249,6 @@
{
a = new StrictEvent();
b_matrix.add_event(a);
-// events_to_delete.push(a);
rel_to_event[top] = a;
MinimalEventPList min(in);
@@ -261,7 +259,7 @@
b_matrix.fill(a,copy,MscTimeIntervalD(0,D::infinity()));
floor.push_back(std::make_pair<EventP,EventP>(a,copy));
}
- combination.add_list(floor);
+ if(!min.empty()) combination.add_list(floor);
}
// open/close relations
@@ -299,7 +297,6 @@
{
a = new StrictEvent();
b_matrix.add_event(a);
-// events_to_delete.push(a);
rel_to_event[bottom] = a;
MaximalEventPList max(in);
std::vector<std::pair<EventP,EventP> > floor;
@@ -309,7 +306,7 @@
b_matrix.fill(copy,a,MscTimeIntervalD(0,D::infinity()));
floor.push_back(std::make_pair<EventP,EventP>(copy,a));
}
- combination.add_list(floor);
+ if(!max.empty()) combination.add_list(floor);
}
// open/close relations
@@ -354,15 +351,7 @@
MscSolveTCSP solve;
MscSolveTCSPReport report = solve.solveTCSP(b_matrix);
if(report.csp_mtxs.size()==0){ // inconsistent
-
- class InconsistencyException: public std::exception
- {
- virtual const char* what() const throw()
- {
- return "inconsistent BMSC, but should not be inconsistent";
- }
- } myex;
- throw myex;//TODO do something when inconsistent (e.g.exception). For consistency check this should return something reasonable
+ throw std::runtime_error("Inconsistent path, but should be consistent due to preconditions.");
}
return std::make_pair<BMscIntervalSetMatrix,IntervalSetMatrix>(b_matrix,report.m_matrix_result);
}
@@ -397,13 +386,7 @@
} while(combination.move_next());
-// while(!events_to_delete.empty()){
-// EventP p= events_to_delete.top();
-// events_to_delete.pop();
-// delete p;
-// }
-
return std::make_pair<BMscIntervalSetMatrix,IntervalSetMatrix>(b_matrix,result);
}
Modified: trunk/src/check/time/time_consistency.h
===================================================================
--- trunk/src/check/time/time_consistency.h 2010-09-16 12:14:08 UTC (rev 938)
+++ trunk/src/check/time/time_consistency.h 2010-09-16 12:17:44 UTC (rev 939)
@@ -20,8 +20,8 @@
#define TIME_H_CON
#include "time_pseudocode.h"
+//#include "tightening.h"
-
#include <limits>
#include <set>
#include <list>
@@ -29,6 +29,19 @@
#include <string>
#include <exception>
+
+#include "check/pseudocode/msc_duplicators.h"
+#include "hmsc_all_paths.h"
+#include "hmsc_block_paths.h"
+#include "traverse_erase.h"
+#include "data/dfs_hmsc_traverser.h"
+
+#include <iostream>
+
+#include "data/Z120/z120.h"
+#include <utility>
+
+
// #define _DEBUG
#ifdef _DEBUG
#include<iostream>
@@ -43,8 +56,19 @@
#define DEBUG_(x,y)
#endif
+typedef std::pair<Event*,Event*> EventPair;
+typedef std::list<EventPair> EventPairsList;
+typedef std::pair<MscTimeIntervalSetD,IntervalSetMatrix> ConstMatrixPair;
+typedef std::pair<MscTimeIntervalSetD,BMscIntervalSetMatrix> ConstBMscMatrixPair;
+typedef boost::intrusive_ptr<BMscIntervalMatrixConverter*> BMscIntervalMatrixConverterPtr;
+struct MscSolveTCSPReport;
+class MscSolveTCSP;
+
+
+///////////////////////////////////////////////////////////////
+
class MscTimeInconsistencyException;
@@ -132,11 +156,6 @@
{}
}; // end of FloydWarshall
-typedef std::pair<Event*,Event*> EventPair;
-typedef std::list<EventPair> EventPairsList;
-typedef std::pair<MscTimeIntervalSetD,IntervalSetMatrix> ConstMatrixPair;
-typedef std::pair<MscTimeIntervalSetD,BMscIntervalSetMatrix> ConstBMscMatrixPair;
-typedef boost::intrusive_ptr<BMscIntervalMatrixConverter*> BMscIntervalMatrixConverterPtr;
class TightenBMsc;
class BMscTighter;
@@ -222,11 +241,728 @@
};
-class SCTIME_EXPORT ConsistencyChecker: public Checker, public BMscChecker
+
+///////////////////////////////////////////////////////////////////
+
+class TemporaryStrictEvent: public StrictEvent
{
+ ReferenceNode* m_ref_node;
+ bool m_is_top;
+
public:
+ TemporaryStrictEvent(ReferenceNode* ref_node,bool is_top)
+ {
+ m_ref_node = ref_node;
+ m_is_top = is_top;
+ }
+
+ ReferenceNode* get_ref_node()
+ {
+ return m_ref_node;
+ }
+
+ bool is_top()
+ {
+ return m_is_top;
+ }
+};
+class TimeRelationRefNodeCycle: public WhiteNodeFoundListener, public GrayNodeFoundListener, public NodeFinishedListener
+{
+ std::map<TimeRelationRefNode*,MscElementPListList> m_open_relations;
+ std::map<TimeRelationRefNode*,MscElementPListList> m_cycle_relations;
+ DFSHMscTraverser* m_hmsc_traverser;
+
+public:
+ TimeRelationRefNodeCycle(DFSHMscTraverser* hmsc_traverser)
+ {
+ m_hmsc_traverser = hmsc_traverser;
+ }
+
+ ~TimeRelationRefNodeCycle()
+ {
+ }
+
+ //checks each of time relation events connected to node from parameter and if it is not in open_relations it adds it there,
+ //if it is open_relations it deletes the relation from there
+
+ void on_white_node_found(HMscNode* node)
+ {
+ std::cout<<"white node found, m_reached_elements size: "<< m_hmsc_traverser->get_reached_elements().size() <<std::endl;
+ ReferenceNode* ref_node = dynamic_cast<ReferenceNode*>(node);
+ if(!ref_node) { std::cout<<"white node finished"<<std::endl; return; }
+
+ TimeRelationRefNodePtrSet set = ref_node->get_time_relations_top();
+ TimeRelationRefNodePtrSet::iterator it;
+ std::map<TimeRelationRefNode*,MscElementPListList>::iterator it2;
+ for(it = set.begin();it!= set.end();it++)
+ {
+ it2 = m_open_relations.find(it->get());
+ if(it2 == m_open_relations.end())
+ {
+ it2 = m_cycle_relations.find(it->get());
+ if(it2 == m_cycle_relations.end())
+ {
+ std::cout<<"no relation found"<<std::endl;
+ MscElementPListList list;
+ m_open_relations.insert(std::make_pair<TimeRelationRefNode*,MscElementPListList>( it->get(),list));
+ }
+ else
+ {
+ std::cout<<"relation found in m_cycl relations, updating path"<<std::endl;
+ it2->second = m_hmsc_traverser->get_reached_elements(); //este sa da odobrat a vlozit znova
+ std::cout<<"update OK"<<std::endl;
+ }
+ }
+ else
+ {
+ std::cout<<"relation found"<<std::endl;
+ m_open_relations.erase(it2);
+ }
+ }
+
+ std::cout<<"top done, doing bottom"<<std::endl;
+
+ set = ref_node->get_time_relations_bottom();
+ for(it = set.begin();it!= set.end();it++)
+ {
+ it2 = m_open_relations.find(it->get());
+ if(it2 == m_open_relations.end())
+ {
+ it2 = m_cycle_relations.find(it->get());
+ if(it2 == m_cycle_relations.end())
+ {
+ std::cout<<"no relation found"<<std::endl;
+ MscElementPListList list;
+ m_open_relations.insert(std::make_pair<TimeRelationRefNode*,MscElementPListList>( it->get(),list));
+ }
+ else
+ {
+ std::cout<<"relation found in m_cycl relations, updating path"<<std::endl;
+ it2->second = m_hmsc_traverser->get_reached_elements(); //este sa da odobrat a vlozit znova
+ std::cout<<"update OK, list size which is added: "<<it2->second.size() << " suppose to be: "<<m_hmsc_traverser->get_reached_elements().size() << std::endl;
+ }
+ }
+ else
+ {
+ std::cout<<"relation found: "<<it->get()->get_interval_set()<<std::endl;
+ m_open_relations.erase(it2);
+ }
+ }
+ std::cout<<"white node finished"<<std::endl;
+ }
+
+ void on_gray_node_found(HMscNode* node)
+ {
+ std::cout<<"FFFFFFFFFFFFFFFFFFFFFFgray node found"<<std::endl;
+ for(std::map<TimeRelationRefNode*,MscElementPListList>::iterator it2=m_open_relations.begin();it2 != m_open_relations.end();it2++)
+ {
+ m_cycle_relations.insert(std::make_pair<TimeRelationRefNode*,MscElementPListList>( it2->first,it2->second)); //????
+ m_open_relations.erase(it2);
+ }
+ std::cout<<"gray node finished"<<std::endl;
+ }
+
+ void on_node_finished(HMscNode* node)
+ {
+ std::cout<<"on node finished"<<std::endl;
+
+ ReferenceNode* ref_node = dynamic_cast<ReferenceNode*>(node);
+ if(!ref_node) {std::cout<<"on node finished done"<<std::endl; return;}
+ TimeRelationRefNodePtrSet set = ref_node->get_time_relations_bottom();
+
+ TimeRelationRefNodePtrSet::iterator it;
+ std::map<TimeRelationRefNode*,MscElementPListList>::iterator it2;
+ for(it = set.begin();it!= set.end();it++)
+ {
+ it2 = m_open_relations.find(it->get());
+ if(it2 == m_open_relations.end())
+ {
+ it2 = m_cycle_relations.find(it->get());
+ if(it2 == m_cycle_relations.end())
+ {
+ m_open_relations.insert(std::make_pair<TimeRelationRefNode*,MscElementPListList>( it->get(),m_hmsc_traverser->get_reached_elements()));
+ }
+ else
+ {
+ //do nothing
+ }
+ }
+ else
+ {
+ m_open_relations.erase(it2);
+ }
+ }
+
+ set = ref_node->get_time_relations_top();
+ for(it = set.begin();it!= set.end();it++)
+ {
+ it2 = m_open_relations.find(it->get());
+ if(it2 == m_open_relations.end())
+ {
+ it2 = m_cycle_relations.find(it->get());
+ if(it2 == m_cycle_relations.end())
+ {
+ m_open_relations.insert(std::make_pair<TimeRelationRefNode*,MscElementPListList>( it->get(),m_hmsc_traverser->get_reached_elements()));
+ }
+ else
+ {
+ //do nothing
+ }
+ }
+ else
+ {
+ m_open_relations.erase(it2);
+ }
+ }
+ std::cout<<"on node finished done"<<std::endl;
+ }
+
+
+ std::map<TimeRelationRefNode*,MscElementPListList> get_cycle_relations()
+ {
+ return m_cycle_relations;
+ }
+
+};
+
+
+class AllCombination: public std::vector<std::pair<EventP,EventP> >
+{
+private:
+ std::list<std::vector<std::pair<EventP,EventP> > > lists;
+
+ std::vector<std::vector<std::pair<EventP,EventP> > >* v_lists;
+ std::vector<size_type>* iterators;
+ bool ini;
+
+ void set_value(size_t to)
+ {
+ for(size_t i= 0; i<= to;i++)
+ {
+ at(i)=((*v_lists)[i])[(*iterators)[i]];
+ }
+
+ }
+
+ bool move_next(size_t i)
+ {
+ if(i>=v_lists->size())
+ {
+ return false;
+ }
+
+ (*iterators)[i]++;
+
+ if((*iterators)[i]>=(*v_lists)[i].size())
+ {
+ (*iterators)[i]=0;
+ return move_next(++i);
+ }
+ set_value(i);
+ return true;
+ }
+
+public:
+ AllCombination():v_lists(NULL),iterators(NULL),ini(false)
+ {
+
+ }
+
+ ~AllCombination()
+ {
+ if(ini)
+ {
+ delete v_lists;
+ delete iterators;
+ }
+ }
+
+ void add_list(std::vector<std::pair<EventP,EventP> > floor)
+ {
+ lists.push_back(floor);
+ }
+
+ void init()
+ {
+ if(lists.size() == 0)
+ return ;
+ if(ini)
+ throw std::runtime_error("Already allocated!");
+ else
+ ini = true;
+
+ v_lists = new std::vector<std::vector<std::pair<EventP,EventP> > >(lists.begin(),lists.end());
+ resize(lists.size());
+ iterators = new std::vector<size_type>(lists.size(),0);
+ set_value(lists.size()-1);
+ }
+
+ bool move_next()
+ {
+ return move_next(0);
+ }
+
+};
+
+
+
+
+class SCTIME_EXPORT HMscConsistencyChecker: public PathFoundListener
+{
+
+ private:
+ bool m_causal;
+ std::list<Block>::iterator m_iter;
+ std::list<HMscPtr> m_final_result;
+public:
+ HMscConsistencyChecker():m_causal(false)
+ {
+
+ }
+
+ ~HMscConsistencyChecker()
+ {
+ }
+
+ virtual std::list<HMscPtr> check(HMscPtr hmsc, ChannelMapperPtr mapper)
+ {
+ //check whether the relations spanning across cycle contain infinity
+
+ std::cout<<"starting check"<<std::endl;
+ DFSHMscTraverser hmsc_traverser;
+ TimeRelationRefNodeCycle cycle_relations_finder(&hmsc_traverser);
+ hmsc_traverser.add_white_node_found_listener(&cycle_relations_finder);
+ hmsc_traverser.add_gray_node_found_listener(&cycle_relations_finder);
+ hmsc_traverser.add_node_finished_listener(&cycle_relations_finder);
+ hmsc_traverser.traverse(hmsc);
+
+ std::cout<<"traversed hmsc, marking relations"<<std::endl;
+
+ std::map<TimeRelationRefNode*,MscElementPListList> cycle_relations = cycle_relations_finder.get_cycle_relations();
+ std::cout<<"number of found cycle relations: "<<cycle_relations.size()<<std::endl;
+ std::map<TimeRelationRefNode*,MscElementPListList>::iterator it;
+ for(it = cycle_relations.begin();it != cycle_relations.end();it++)
+ {
+ std::cout<<"candidate for inconsistency"<<std::endl;
+ MscTimeIntervalD inter = (it->first)->get_interval_set().get_set().back(); //we assume that inteval sets are ordered (infty is last)
+ std::cout<<"checking infinity"<<std::endl;
+ if(!inter.is_upper_bound_infinity()) //check whether the interval set of time realtion contains infinity //the extension of time interval is needed
+ {
+ std::cout<<"found inconsistency"<<std::endl;
+ HMscPathDuplicator duplicator2;
+ (it->second);
+// std::cout<<"getting list: "<< std::endl;
+ MscElementPListList list3 = (it->second);
+// std::cout<<"list size: "<<std::endl;
+ HMscPtr ce_hmsc = duplicator2.duplicate_path(list3);
+// std::cout<<"duplicated, marking: "<< it->first<< " what is "<< inter <<std::endl;
+ //TODO update duplicator do duplicate also time relations, then use: duplicator2.get_copy(it->first)->set_marked();
+ TimeRelationRefNodePtr rel(new TimeRelationRefNode(inter));
+// std::cout<<"relation created"<<std::endl;
+ rel->glue_ref_nodes(it->first->is_bottom_node_a(),
+ dynamic_cast<ReferenceNode*>(duplicator2.get_copy(it->first->get_ref_node_a())),
+ it->first->is_bottom_node_b(),
+ dynamic_cast<ReferenceNode*>(duplicator2.get_copy(it->first->get_ref_node_b())));
+// std::cout<<"relation glued"<<std::endl;
+ rel->set_marked();
+ m_final_result.push_back(ce_hmsc);
+// std::cout<<"counterexample created. number of counterexmaples: "<< m_final_result.size()<<std::endl;
+ }
+ }
+
+ std::cout<<"relations marked, duplicating hmsc, finding blocks and running check on each path in block"<<std::endl;
+
+ HMscDuplicator duplicator;
+ HMscPtr result = duplicator.duplicate(hmsc);
+
+//maybe I can get rid of one duplication- TODO check the algorithm whether it will be correct
+
+ BMscGraphDuplicator graph_dup;
+ HMscPtr bmsc_graph = graph_dup.duplicate_hmsc(result);
+
+
+ TraverseAndMarkBlocks block_marker;
+ block_marker.travers_and_mark_blocks(bmsc_graph);
+
+
+// AllPathsAllBlocks block_to_path(block_marker.m_list_of_blocks,bmsc_graph);
+// block_to_path.set_listener(this);
+// block_to_path.all_paths_all_blocks();
+ int i=0;
+ for (m_iter = block_marker.m_list_of_blocks.begin(); m_iter != block_marker.m_list_of_blocks.end(); m_iter++) //iterate blocks
+ {
+ i++;
+// std::cout << "Cesty v " << i << " bloku" << std::endl;
+ HMscNodePtrSet m_last;
+ m_last.insert(m_iter->get_end());
+ AllPaths allpaths = AllPaths(bmsc_graph, m_iter->get_begin(), m_last, 1);
+
+ allpaths.add_path_found_listener(this);
+ allpaths.traverse();
+ m_last.clear();
+ }
+ std::cout<<"almost at the end. size of final_result: "<<m_final_result.size()<<std::endl;
+ return m_final_result;
+ }
+
+
+/**
+* \brief Tightens BMscGraph path and returns BMscIntervalSetMatrix with original constraints and IntervalSetMatrix with tightened constraints.
+*/
+ virtual void on_path_found(std::list<MscElement*>& path)
+ {
+ std::list<HMscPtr> counter_examples;
+ HMscFlatPathToBMscDuplicator duplicator;
+ BMscPtr bmsc = duplicator.duplicate_path(path);
+
+ SRChannelMapperPtr srm = SRChannelMapper::instance();
+ BMscIntervalSetMatrix b_matrix(bmsc,m_causal,srm); // TODO: channelmapper
+
+ std::map<BMsc*,int> bmsc_to_count;
+ std::map<const TimeRelationRefNodePtrSet*,EventP> rel_to_event;
+ std::set<TimeRelationRefNode*> open_rel;
+
+ Event* a;
+ AllCombination combination;
+ for(std::list<MscElement*>::iterator it=path.begin();it!=path.end();it++)
+ {
+ ReferenceNode* ref = dynamic_cast<ReferenceNode*>(*it);
+ if(ref==NULL)
+ continue;
+ BMscPtr in = ref->get_bmsc();
+ bmsc_to_count[in.get()]++; // @Warning initial integer number = 0?
+ TimeRelationRefNodePtrSet* top = &(ref->get_time_relations_top());
+ TimeRelationRefNodePtrSet* bottom = &(ref->get_time_relations_bottom());
+
+
+ if(top->size()>0)
+ {
+ a = new TemporaryStrictEvent(ref,true);
+ b_matrix.add_event(a);
+ rel_to_event[top] = a;
+
+ MinimalEventPList min(in);
+ std::vector<std::pair<EventP,EventP> > floor;
+ for(MinimalEventPList::iterator m=min.begin();m!=min.end();m++)
+ {
+ Event* copy = dynamic_cast<Event*>(duplicator.get_copy_with_occurence(*m,bmsc_to_count[in.get()]));
+ b_matrix.fill(a,copy,MscTimeIntervalD(0,D::infinity()));
+ floor.push_back(std::make_pair<EventP,EventP>(a,copy));
+ }
+ if(!min.empty()) combination.add_list(floor);
+
+ }
+ // open/close relations
+ for(TimeRelationRefNodePtrSet::const_iterator it=top->begin();it!=top->end();it++)
+ {
+ if(open_rel.find(it->get()) != open_rel.end())
+ {//time relation is open -> close it
+ const TimeRelationRefNodePtrSet* other;
+ //find the correct time relation (for getting previously created
+ // node to which the processed time relation (it*) should be connected)
+ if(ref==(*it)->get_ref_node_a()&&(*it)->is_top_node_a())
+ {
+ if((*it)->is_top_node_b())
+ other = &((*it)->get_ref_node_b()->get_time_relations_top());
+ else
+ other = &((*it)->get_ref_node_b()->get_time_relations_bottom());
+ }
+ else
+ {
+ if((*it)->is_top_node_a())
+ other = &((*it)->get_ref_node_a()->get_time_relations_top());
+ else
+ other = &((*it)->get_ref_node_a()->get_time_relations_bottom());
+ }
+ //fill the time relation to the matrix (node a was found later)
+ b_matrix.fill(rel_to_event[other],a,(*it)->get_interval_set());
+ b_matrix.tied_rel_to_cell(*it,rel_to_event[other],a);
+ }
+ else //time relation has not been opened yet -> open it
+ open_rel.insert((*it).get());
+
+ }
+
+ if(bottom->size()>0)
+ {
+ a = new TemporaryStrictEvent(ref,false);
+ b_matrix.add_event(a);
+ rel_to_event[bottom] = a;
+ MaximalEventPList max(in);
+ std::vector<std::pair<EventP,EventP> > floor;
+ for(MaximalEventPList::iterator m=max.begin();m!=max.end();m++)
+ {
+ Event* copy = dynamic_cast<Event*>(duplicator.get_copy_with_occurence(*m,bmsc_to_count[in.get()]));
+ b_matrix.fill(copy,a,MscTimeIntervalD(0,D::infinity()));
+ floor.push_back(std::make_pair<EventP,EventP>(copy,a));
+ }
+ if(!max.empty()) combination.add_list(floor);
+ }
+
+ // open/close relations
+ for(TimeRelationRefNodePtrSet::iterator it=bottom->begin();it!=bottom->end();it++)
+ {
+ if(open_rel.find(it->get()) != open_rel.end())
+ { //time relation is open -> close it
+ const TimeRelationRefNodePtrSet* other;
+ //find the correct time relation (for getting previously created
+ // node to which the processed time relation (it*) should be connected)
+ if(ref==(*it)->get_ref_node_a()&&(*it)->is_bottom_node_a())
+ {
+ if((*it)->is_top_node_b())
+ other = &((*it)->get_ref_node_b()->get_time_relations_top());
+ else
+ other = &((*it)->get_ref_node_b()->get_time_relations_bottom());
+ }
+ else
+ {
+ if((*it)->is_top_node_a())
+ other = &((*it)->get_ref_node_a()->get_time_relations_top());
+ else
+ other = &((*it)->get_ref_node_a()->get_time_relations_bottom());
+ }
+ //fill the time relation to the matrix (node a was found later)
+ b_matrix.fill(rel_to_event[other],a,(*it)->get_interval_set());
+ b_matrix.tied_rel_to_cell(*it,rel_to_event[other],a);
+ }
+ else //time relation has not been opened yet -> open it
+ open_rel.insert((*it).get());
+ }
+ }
+ b_matrix.build_up();
+
+
+ IntervalSetMatrix result;
+ result.resize(b_matrix.size());
+
+ combination.init();
+ if(combination.size()==0){
+ //tighten the matrix
+ MscSolveTCSP solve;
+ MscSolveTCSPReport report = solve.solveTCSP(b_matrix);
+ if(report.csp_mtxs.size()==0) // inconsistent
+ {
+ std::cout<<"report.inconsis_mtxs.size() == "<<report.inconsis_mtxs.size()<<std::endl;
+ m_final_result.push_back(make_counterexample(b_matrix,&report, path));
+ }
+ return ;
+ }
+
+ do
+ {
+ // push there [0,0] interval
+ for(unsigned i=0;i<combination.size();i++)
+ {
+ b_matrix.fill(combination[i].first,combination[i].second,MscTimeIntervalD(0,0));
+ }
+ MscSolveTCSP solve;
+ if(b_matrix.get_rel_empty_set().size()!=0) // inconsistent
+ throw std::runtime_error("inconsistent matrix - found empty time interval in matrix.");
+ MscSolveTCSPReport report = solve.solveTCSP(b_matrix);
+ if(report.csp_mtxs.size()!=0) // inconsistent => fill the values to result matrix
+ {
+ IntervalSetMatrix new_result = report.m_matrix_result;
+
+ for(unsigned i=0;i<new_result.size();i++)
+ for(unsigned j=0;j<new_result.size();j++)
+ result(i,j) = MscTimeIntervalSetD::set_union(result(i,j),new_result(i,j));
+ }
+ else
+ {
+ std::cout<<"report.inconsis_mtxs.size() == "<<report.inconsis_mtxs.size()<<std::endl;
+ counter_examples.push_back(make_counterexample(b_matrix,&report, path));
+ }
+
+
+ //return back previous values
+ for(unsigned i=0;i<combination.size();i++)
+ {
+ b_matrix.fill(combination[i].first,combination[i].second,MscTimeIntervalD(0,D::infinity()));
+ }
+
+ } while(combination.move_next());
+
+ if(result(0,0).get_set().empty())
+ m_final_result.insert(m_final_result.end(),counter_examples.begin(),counter_examples.end());
+
+ return ;
+ }
+
+//TODO nekopiruje sa dobre report, asi budem
+ HMscPtr make_counterexample(BMscIntervalSetMatrix b_matrix, MscSolveTCSPReport* report,std::list<MscElement*> path)
+ {
+ HMscPtr example;
+ std::cout<<"1 "<<std::endl;
+ MscElementPListList path_list = m_iter->get_path_to_block();
+ std::cout<<"1,5"<<std::endl;
+ if(path_list.size() > 1){
+ throw std::runtime_error("Found hierarchical path. Expected flat path.");
+ }
+ std::cout<<"1,7 size of path_list: "<< path_list.size()<< " size of path_list.back(): "<<std::endl;
+ std::cout << path_list.back().size()<<std::endl;
+ //concatenate paths and then duplicate
+ path.insert(path.begin(),pat...
[truncated message content] |
|
From: <xr...@us...> - 2010-09-16 15:32:16
|
Revision: 942
http://scstudio.svn.sourceforge.net/scstudio/?rev=942&view=rev
Author: xrehak
Date: 2010-09-16 15:32:05 +0000 (Thu, 16 Sep 2010)
Log Message:
-----------
DoxyGen config moved. How_to added.
Added Paths:
-----------
trunk/doc/doxygen/
trunk/doc/doxygen/doxy.footer.html
trunk/doc/doxygen/doxygen.config
trunk/doc/doxygen/how_to_make_new_doxy.txt
Removed Paths:
-------------
trunk/doxy.footer.html
trunk/doxygen.config
Copied: trunk/doc/doxygen/doxy.footer.html (from rev 941, trunk/doxy.footer.html)
===================================================================
--- trunk/doc/doxygen/doxy.footer.html (rev 0)
+++ trunk/doc/doxygen/doxy.footer.html 2010-09-16 15:32:05 UTC (rev 942)
@@ -0,0 +1,7 @@
+<hr size="1">
+<a href="http://sourceforge.net/"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=219467&type=2" alt="SourceForge.net Logo" height="37" align="left" border="0" width="125"></a>
+<address style="text-align: right;"><small>Generated on $datetime for Sequence Chart Studio by
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"></a></small></address>
+
+</body></html>
Copied: trunk/doc/doxygen/doxygen.config (from rev 941, trunk/doxygen.config)
===================================================================
--- trunk/doc/doxygen/doxygen.config (rev 0)
+++ trunk/doc/doxygen/doxygen.config 2010-09-16 15:32:05 UTC (rev 942)
@@ -0,0 +1,1515 @@
+# Doxyfile 1.6.1
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = "Sequence Chart Studio"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER = "svn HEAD revision"
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = .
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses.
+# With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this tag.
+# The format is ext=language, where ext is a file extension, and language is one of
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = YES
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = NO
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = ../..
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS = *.cpp \
+ *.h
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE...
[truncated message content] |
|
From: <ma...@us...> - 2010-09-16 16:18:22
|
Revision: 943
http://scstudio.svn.sourceforge.net/scstudio/?rev=943&view=rev
Author: madzin
Date: 2010-09-16 16:18:15 +0000 (Thu, 16 Sep 2010)
Log Message:
-----------
first part of refactoring process
Modified Paths:
--------------
trunk/src/membership/membership_alg.cpp
trunk/src/membership/membership_alg.h
trunk/tests/membership/CMakeLists.txt
Modified: trunk/src/membership/membership_alg.cpp
===================================================================
--- trunk/src/membership/membership_alg.cpp 2010-09-16 15:32:05 UTC (rev 942)
+++ trunk/src/membership/membership_alg.cpp 2010-09-16 16:18:15 UTC (rev 943)
@@ -29,68 +29,27 @@
#include <limits>
#include <map>
-//MembershipAlg object to be albe to use print_report
-MembershipAlg* mem;
-
-// map of bmsc names and configurations which were checked
-std::map<std::wstring, std::set<ConfigurationPtr> > checked;
-
-std::map<TimeRelationRefNodePtr, ConfigurationPtr> top_time_references;
-std::map<TimeRelationRefNodePtr, ConfigurationPtr> bottom_time_references;
-
-std::vector<Event*> attributed_events;
-
-//save ordering of coregion events in appropriate coregion
-std::map<CoregionAreaPtr, CoregionOrderingPtr> coregion_ordering;
-//snapshots of context for each coregion
-std::map<CoregionAreaPtr, SnapshotContextPtr> snapshots;
-//checked possibilities of coregion ordering
-std::map<CoregionAreaPtr, std::vector<CoregionOrderingPtr> > checked_orderings;
-
-//name of instances on which a user is focused on
-std::vector<std::wstring> focused_instances;
-
-//identification for receive events
-int max_id;
-
-BMscPtr global_bmsc;
-BMscIntervalSetMatrix* time_matrix;
-
InstancePtr find_instance(InstancePtrList instances, std::wstring name);
-HMscPtr search_bmsc(BMscPtr bmsc, BMscPtr bmsc_f);
-HMscPtr search_hmsc(HMscPtr hmsc, BMscPtr bmsc_f);
+HMscPtr search_bmsc(MembershipContext* c, BMscPtr bmsc, BMscPtr bmsc_f);
+HMscPtr search_hmsc(MembershipContext* c, HMscPtr hmsc, BMscPtr bmsc_f);
/*
- * find name of the instance among fosuces instances
- */
-bool contain_focused_instances(std::wstring instance)
-{
- for(unsigned int i = 0; i < focused_instances.size(); i++)
- {
- if(focused_instances[i] == instance)
- return true;
- }
-
- return false;
-}
-
-/*
* checks whole branch from defined node in HMSC
*/
-bool check_branch(HMscNodePtr node, ConfigurationPtr b);
+bool check_branch(MembershipContext* c, HMscNodePtr node, ConfigurationPtr b);
/*
* adds searched configuration to map of checked configurations
*
* configuration - state of node in searched HMSC and state of bMSC which is looked for
*/
-void add_checked_branch(ReferenceNodePtr ref_node, ConfigurationPtr searched_conf);
+void add_checked_branch(MembershipContext* c, ReferenceNodePtr ref_node, ConfigurationPtr searched_conf);
/*
* checks if instance contains any event
*/
-bool is_empty_instance(InstancePtrList node_instances, InstancePtrList b_instances);
+bool is_empty_instance(MembershipContext* c, InstancePtrList node_instances, InstancePtrList b_instances);
/*
* compares strict order area from HMSC node with matching strict order area from bMSC which is looked for
@@ -100,7 +59,7 @@
* type: membership - checks matching events and adds receive ordering
* receive_ordering - checks receive ordering
*/
-bool strict_strict(std::vector<Event*>& node_events, std::vector<Event*>& b_events, enum check_type type);
+bool strict_strict(MembershipContext* c, std::vector<Event*>& node_events, std::vector<Event*>& b_events, enum check_type type);
/*
* compares coregion area from HMSC node with matching strict order area from bMSC which is looked for
@@ -110,14 +69,14 @@
* type: membership - checks matching events and adds receive ordering
* receive_ordering - checks receive ordering
*/
-bool coregion_strict(std::vector<Event*>& node_events, std::vector<Event*>& b_events, enum check_type type);
+bool coregion_strict(MembershipContext* c, std::vector<Event*>& node_events, std::vector<Event*>& b_events, enum check_type type);
/*
* compares strict order area from HMSC node and coregion area from bMSC which is looked for
*
* DEVELOPMENT WAS STOPPED
*/
-bool strict_coregion(StrictOrderAreaPtr node_strict, std::vector<Event*>& node_events,
+bool strict_coregion(MembershipContext* c, StrictOrderAreaPtr node_strict, std::vector<Event*>& node_events,
CoregionAreaPtr b_coregion, std::vector<Event*>& b_events);
/*
@@ -125,7 +84,7 @@
*
* DEVELOPMENT WAS STOPPED
*/
-bool coregion_coretion(CoregionAreaPtr node_coregion, std::vector<Event*>& node_events,
+bool coregion_coregion(MembershipContext* c, CoregionAreaPtr node_coregion, std::vector<Event*>& node_events,
CoregionAreaPtr b_coregion, std::vector<Event*>& b_events);
/*
@@ -136,12 +95,12 @@
/*
* compares events attributes
*/
-bool compare_events_attribute(Event* a, Event* b);
+bool compare_events_attribute(MembershipContext* c, Event* a, Event* b);
/*
* tries to find configuration into map of seared configuration
*/
-bool look_at_checked_conf(ReferenceNodePtr node, ConfigurationPtr b);
+bool look_at_checked_conf(MembershipContext* c, ReferenceNodePtr node, ConfigurationPtr b);
/*
* compares one instance from HMSC node with matching instance from bMSC which is looked for
@@ -151,7 +110,7 @@
* receive_ordering - checks receive ordering
* old_position - events where the checking starts
*/
-bool check_instance(InstancePtr node_instance, enum check_type type, PositionPtr old_position);
+bool check_instance(MembershipContext* c, InstancePtr node_instance, enum check_type type, PositionPtr old_position);
/*
* compares bMsc from HMSC node with matching scenario in bMSC which is looked for
@@ -160,7 +119,7 @@
* receive_ordering - checks receive ordering
* old_conf - HMSC node configuration of start searching
*/
-bool check_node(ReferenceNodePtr node, enum check_type type, ConfigurationPtr old_conf);
+bool check_node(MembershipContext* c, ReferenceNodePtr node, enum check_type type, ConfigurationPtr old_conf);
/*
* in case events are send events, adds attribute to both events and to both receive event in case messages are complete
@@ -168,12 +127,12 @@
* parameters: node_e - event from HMSC node
* b_e - event from bMSC
*/
-void set_identification(Event* node_e, Event* b_e);
+void set_identification(MembershipContext* c, Event* node_e, Event* b_e);
/*
* checks whether node has null pointer to reference bMSC
*/
-bool is_node_null(ReferenceNodePtr node);
+bool is_node_null(MembershipContext* c, ReferenceNodePtr node);
/*
* checks whether instance contains any event
@@ -194,25 +153,25 @@
* checks time constraints in HMSC node
*/
//TODO skontrolovat co to vlastne robi, a kde kontrolujem casove obmedzenia v ramci bMSC z dajakeho HMSC nodu
-bool check_node_time(ReferenceNodePtr node, ConfigurationPtr conf);
+bool check_node_time(MembershipContext* c, ReferenceNodePtr node, ConfigurationPtr conf);
-bool check_node_time_themself(const std::vector<TimeRelationRefNodePtr>& themself_vec, ReferenceNodePtr node, ConfigurationPtr conf);
+bool check_node_time_themself(MembershipContext* c, const std::vector<TimeRelationRefNodePtr>& themself_vec, ReferenceNodePtr node, ConfigurationPtr conf);
/*
* finds the maximum event of HMSC node and returns time interval value of matching event in bMSC
*/
-Event* get_max_event(ReferenceNodePtr node, ConfigurationPtr conf);
+Event* get_max_event(MembershipContext* c, ReferenceNodePtr node, ConfigurationPtr conf);
/*
* returns map where the key is instance name and the value is vector of the event identifications
* (in case of coregion area)
*/
-std::map<std::wstring, std::vector<int> > get_node_last_events(ReferenceNodePtr node);
+std::map<std::wstring, std::vector<int> > get_node_last_events(MembershipContext* c, ReferenceNodePtr node);
/*
* finds the minimum event of HMSC node and returns time interval value of matching event in bMSC
*/
-Event* get_min_event(ConfigurationPtr conf);
+Event* get_min_event(MembershipContext* c, ConfigurationPtr conf);
/*
* compare absolut position, is the fist parameter before (more minimal) than the second
@@ -221,20 +180,21 @@
* 1 - the fist is before the second
* 2 - the second is before the first
*/
-int compare_absolut_position(Event* first, Event* second);
+int compare_absolut_position(MembershipContext* c, Event* first, Event* second);
/*
* returns the last event on instance
*/
-Event* get_last_instance_event(Event* start);
+Event* get_last_instance_event(MembershipContext* c, Event* start);
/*
* compares events time relations
*
- * paramterers: a - HMSC node
+ * paramterers: c - membership context
+ * a - HMSC node
* b - bMSC node
*/
-bool compare_events_time_relations(Event* a, Event* b);
+bool compare_events_time_relations(MembershipContext* c, Event* a, Event* b);
/*
* finds event in bMSC on instance by id
@@ -242,13 +202,8 @@
* parameters: label - label of instance where the event should be
* id - id of event which is looked for
*/
-Event* find_event_on_instance_by_id(std::wstring label, int id, StrictEventPtr start_event = NULL);
+Event* find_event_on_instance_by_id(MembershipContext* c, std::wstring label, int id, StrictEventPtr start_event = NULL);
-/*
- * removes event attribute "indentification"
- */
-void remove_events_attributes(std::vector<Event*> vec);
-
/*
* return matrix of time intervals among each nodes
*/
@@ -257,9 +212,9 @@
/*
*
*/
-void update_maximum_set(std::set<Event*>& max, Event* new_element);
+void update_maximum_set(MembershipContext* c, std::set<Event*>& max, Event* new_element);
-void update_minimum_set(std::set<Event*>& min, Event* new_element);
+void update_minimum_set(MembershipContext* c, std::set<Event*>& min, Event* new_element);
/*
* Returns precondition list of the membership algorithm
@@ -275,71 +230,14 @@
}
/*
-bool check_time_consistency_and_syntax(MscPtr msc, MscPtr bmsc)
-{
- HMscPtr hmsc = boost::dynamic_pointer_cast<HMsc > (msc);
- BMscPtr bmsc_f = boost::dynamic_pointer_cast<BMsc > (bmsc);
- ChannelMapperPtr mapper;
- ConsistencyChecker checker;
- ConstraintsChecker checker2;
- SRChannelMapperPtr srm = SRChannelMapper::instance(); //sender-receiver
-// SRMChannelMapperPtr srlm = SRMChannelMapper::instance(); //sender-receiver-label
-
- if (bmsc_f == NULL)
- {
- mem->print_report(RS_ERROR, L"MSC which is looked for, must be bMSC.");
- return NULL;
- }
-
- std::list<BMscPtr> consistency_results = checker.check(bmsc_f,srm);
- std::list<BMscPtr> constraints_results = checker2.check(bmsc_f,srm);
-
- if(!consistency_results.empty() || !consistency_results.empty())
- {
- mem->print_report(RS_ERROR, L"MSC which is looked for, is not time consistent or time constraints.");
- return false;
- }
-
- if (hmsc == NULL)
- {
- BMscPtr bmsc_scecification = boost::dynamic_pointer_cast<BMsc > (msc);
-
- if(bmsc_scecification != NULL)
- {
- std::list<BMscPtr> consistency_resultsII = checker.check(bmsc_scecification,srm);
- std::list<BMscPtr> constraints_resultsII = checker2.check(bmsc_scecification,srm);
-
- if(!consistency_resultsII.empty() || !constraints_resultsII.empty())
- {
- mem->print_report(RS_ERROR, L"MSC which is specification, is not time consistent or time constraints.");
- return false;
- }
- }
- }
- else
- {
-// std::list<HMscPtr> consistency_resultsIII = checker.check(hmsc,srm);
-// if(!consistency_resultsIII.empty())
-// {
-// mem->print_report(RS_ERROR, L"MSC which is specification, is not time consistent.");
-// return false;
-// }
- }
-
- return true;
-}
-*/
-
-/*
* Tries finding bMsc in Msc
*/
-MscPtr MembershipAlg::find(MscPtr msc, MscPtr bmsc)
+MscPtr MembershipAlg::find(MscPtr msc, MscPtr bmsc, std::vector<std::wstring> instances)
{
- mem = this;
+ MembershipContext* c = new MembershipContext();
+ c->set_mem(this);
+ c->set_focused_instances(instances);
-// if(!check_time_consistency_and_syntax(msc, bmsc))
-// return false;
-
HMscPtr hmsc = boost::dynamic_pointer_cast<HMsc > (msc);
BMscPtr bmsc_f = boost::dynamic_pointer_cast<BMsc > (bmsc);
@@ -350,15 +248,15 @@
return NULL;
}
- global_bmsc = bmsc_f;
+ c->set_bmsc(bmsc_f);
if (hmsc != NULL)
- return search_hmsc(hmsc, bmsc_f);
+ return search_hmsc(c, hmsc, bmsc_f);
else
{
BMscPtr bmsc = boost::dynamic_pointer_cast<BMsc > (msc);
if(bmsc != NULL)
- return search_bmsc(bmsc, bmsc_f);
+ return search_bmsc(c, bmsc, bmsc_f);
else
{
print_report(RS_ERROR, stringize() << "Membership algorithm cannot recognize a type of browsed MSC");
@@ -367,20 +265,17 @@
}
}
-MscPtr MembershipAlg::find(MscPtr msc, MscPtr bmsc, std::vector<std::wstring> instances)
+MscPtr MembershipAlg::find(MscPtr msc, MscPtr bmsc)
{
- focused_instances.insert(focused_instances.begin(), instances.begin(), instances.end());
-
- return this->find(msc, bmsc);
+ std::vector<std::wstring> instances;
+ return this->find(msc, bmsc, instances);
}
/*
* Tries to find bMSC in HMSC
*/
-HMscPtr search_hmsc(HMscPtr hmsc, BMscPtr bmsc_f)
+HMscPtr search_hmsc(MembershipContext* c, HMscPtr hmsc, BMscPtr bmsc_f)
{
- max_id = 0;
-
BMscGraphDuplicator duplicator;
HMscPtr dup_hmsc;
@@ -411,7 +306,7 @@
//get time matrix
BMscIntervalSetMatrix time_matrix2 = get_bmsc_matrix(bmsc_f);
- time_matrix = &time_matrix2;
+ c->set_time_matrix(&time_matrix2);
//creates configuration of defined bMSC
ConfigurationPtr searched_conf = new Configuration(bmsc_f->get_instances());
@@ -419,7 +314,7 @@
StartNodePtr start_node = dup_hmsc->get_start();
//strt of searching
- if (check_branch(start_node, searched_conf))
+ if (check_branch(c, start_node, searched_conf))
{
return new HMsc(); //TODO return path in hmsc
}
@@ -433,16 +328,16 @@
/*
* Checks branch if the communication is coressponding
- * parameters :
+ *
+ * parameters : c - membership context
* node - reference node
* b - MSC configuration for search
*/
-bool check_branch(HMscNodePtr hmsc_node, ConfigurationPtr b)
+bool check_branch(MembershipContext* c, HMscNodePtr hmsc_node, ConfigurationPtr b)
{
//remove attributes from previous computation
- if(!attributed_events.empty()){
- remove_events_attributes(attributed_events);
- attributed_events.clear();
+ if(!c->get_attributed_events().empty()){
+ c->clear_attributed_events();
}
//checks end node
@@ -450,7 +345,7 @@
if (end != NULL)
{
- if (b->is_null(focused_instances))
+ if (b->is_null(c))
return true;
else
return false;
@@ -473,7 +368,7 @@
{
HMscNode* succ = dynamic_cast<HMscNode*> ((*it)->get_successor());
ConfigurationPtr old = new Configuration(b);
- if (check_branch(succ, b))
+ if (check_branch(c, succ, b))
return true;
else
b = old;
@@ -484,15 +379,11 @@
else
{
//when deosn't exist empty path to EndNode
-// if (b->is_null() && !is_node_null(node))
-// return false;
-
- //when deosn't exist empty path to EndNode
- if (b->is_null(focused_instances) && !is_node_null(node))
+ if (b->is_null(c) && !is_node_null(c, node))
return false;
//checks if this node with this configuration was checked
- if (!look_at_checked_conf(node, b))
+ if (!look_at_checked_conf(c, node, b))
return false;
ConfigurationPtr old_config_I, old_config_II;
@@ -501,29 +392,26 @@
old_config_II = new Configuration(b);
//tries to matching events between searched MSC and bMSC which is looked for
- if (!check_node(node, membership, b))
+ if (!check_node(c, node, membership, b))
{
- remove_events_attributes(attributed_events);
- attributed_events.clear();
+ c->clear_attributed_events();
return false;
}
//checks time constraints for this node
- if(focused_instances.empty())
+ if(c->get_focused_instances().empty())
{
- if(!check_node_time(node, old_config_II))
+ if(!check_node_time(c, node, old_config_II))
{
- remove_events_attributes(attributed_events);
- attributed_events.clear();
+ c->clear_attributed_events();
return false;
}
}
//checks the ordering of events (by attribute which was set at check_node(node, membership,b))
- if (!check_node(node, receive_ordering, old_config_I))
+ if (!check_node(c, node, receive_ordering, old_config_I))
{
- remove_events_attributes(attributed_events);
- attributed_events.clear();
+ c->clear_attributed_events();
return false;
}
@@ -536,8 +424,7 @@
if(!b->compare(old_config_I))
return false;
- remove_events_attributes(attributed_events);
- attributed_events.clear();
+ c->clear_attributed_events();
NodeRelationPtrVector successors = node->get_successors();
NodeRelationPtrVector::iterator it;
@@ -554,7 +441,7 @@
{
ConfigurationPtr back_up = new Configuration(b);
- if (check_branch(hmsc_succ, b))
+ if (check_branch(c, hmsc_succ, b))
return true;
else
b = back_up;
@@ -568,7 +455,7 @@
/*
* Compare StrictOrderArea in bMSC from HMSC node and StrictOrderArea in bMSC from defined events
*/
-bool strict_strict(std::vector<Event*>& node_events, std::vector<Event*>& b_events, enum check_type type)
+bool strict_strict(MembershipContext* c, std::vector<Event*>& node_events, std::vector<Event*>& b_events, enum check_type type)
{
if (node_events.size() != 1 || b_events.size() != 1)
return false;
@@ -583,11 +470,11 @@
if (!compare_events(node_e, b_e))
return false;
- set_identification(node_e, b_e);
+ set_identification(c, node_e, b_e);
}
else
{
- if (!compare_events_attribute(node_e, b_e))
+ if (!compare_events_attribute(c, node_e, b_e))
return false;
}
@@ -614,75 +501,18 @@
*
* DEVELOPMENT WAS STOPPED
*/
-bool strict_coregion(StrictOrderAreaPtr node_strict, std::vector<Event*>& node_events,
+bool strict_coregion(MembershipContext* c, StrictOrderAreaPtr node_strict, std::vector<Event*>& node_events,
CoregionAreaPtr b_coregion, std::vector<Event*>& b_events)
{
- mem->print_report(RS_ERROR, L"unsuported function: finded bMSC cannot contain coregion");
+ c->get_mem()->print_report(RS_ERROR, L"unsuported function: finded bMSC cannot contain coregion");
return false;
-
- /* if(b_events.size() > 1)
- {
- //neni su rovnake
- }
- else
- Event* b_event = b_events.front();
- Event* node_event = node_events.front();
-
- while(node_e != NULL && b_e != NULL)
- {
- if(compare_events(node_e, b_e))
- {
- node_e = node_e->get_successor();
- b_e = node_e->get_successor();
- }
- else
- {
- //neni su rovnake
- }
- }
-
- if(node_e == NULL)
- node_events.clear();
- else
- b_events.clear();
- */
- // return true;
-
- /*
- Event* node_e = node_events.front();
- std::vector<Event*>::iterator it;
- bool stop = false;
-
- while(node_e != NULL || b_events.empty())
- {
- for(it = b_events.begin(); it! = b_events.end(); it++)
- {
- if(compare_events(node_e, *it))
- {
- node_e = node_e->get_successor();
- *it = (*it)->get_successor();
-
- if(*it == NULL)
- b_events.remove(it);
-
- stop = true;
- break;
- }
- }
-
- if(!stop)
- //neni su rovnake
-
- }
- */
}
/*
* checks attributes in guessed coregion message ordering
*/
-bool check_coregion_attributes(std::vector<Event*>& node_events, std::vector<Event*>& b_events)
+bool check_coregion_attributes(MembershipContext* c, std::vector<Event*>& node_events, std::vector<Event*>& b_events)
{
- std::map<CoregionAreaPtr, CoregionOrderingPtr>::iterator map_it;
EventAreaPtr node_e_a;
if(!node_events.empty())
@@ -694,28 +524,27 @@
if(cor == NULL)
{
- mem->print_report(RS_ERROR, L"Error: Unexpected behaviour 98");
+ c->get_mem()->print_report(RS_ERROR, L"Error: Unexpected behaviour 98");
return false;
}
- map_it = coregion_ordering.find(cor);
+ CoregionOrderingPtr ordering = c->find_coregion_ordering(cor);
- if(map_it == coregion_ordering.end())
+ if(ordering == NULL)
{
- std::cerr << "Error: Unexpected behaviour 100" << std::endl;
+ throw std::runtime_error("Unexpected behaviour");
return false;
}
- CoregionOrderingPtr ordering = map_it->second;
CoregionOrderingPtr back_up = new CoregionOrdering(ordering);
Event* node_e = ordering->getFirst().get();
StrictEvent* b_e = dynamic_cast<StrictEvent*> (b_events.front());
while (node_e != NULL && b_e != NULL)
{
- if (!compare_events_attribute(node_e, b_e))
+ if (!compare_events_attribute(c, node_e, b_e))
{
- checked_orderings[cor].push_back(new CoregionOrdering(back_up));
+ c->add_checked_ordering(cor, new CoregionOrdering(back_up));
return false;
}
ordering->removeFirst();
@@ -742,36 +571,40 @@
/*
* coretion_strict for receive_ordering type
*/
-bool coregion_strict_receive_ordering(std::vector<Event*>& node_events, std::vector<Event*>& b_events)
+bool coregion_strict_receive_ordering(MembershipContext* c, std::vector<Event*>& node_events, std::vector<Event*>& b_events)
{
- if(!check_coregion_attributes(node_events, b_events))
+ if(!check_coregion_attributes(c, node_events, b_events))
{
Event* e = node_events.front();
if(e == NULL)
{
- std::cerr << "Error: Unexpected behaviour 101" << std::endl;
+ throw std::runtime_error("Unexpected behaviour");
return false;
}
EventAreaPtr a = e->get_general_area();
CoregionAreaPtr cor = boost::dynamic_pointer_cast<CoregionArea>(a);
- std::map<CoregionAreaPtr, SnapshotContextPtr>::iterator snap_it;
+ SnapshotContextPtr snap = c->find_snapshot(cor);
- snap_it = snapshots.find(cor);
-
- if(snap_it == snapshots.end())
+ if(snap == NULL)
{
- std::cerr << "Error: Unexpected behaviour 102" << std::endl;
+ throw std::runtime_error("Unexpected behaviour");
return false;
}
- std::vector<Event*> snap_node_events = snap_it->second->getNodeEvents();
- std::vector<Event*> snap_b_events = snap_it->second->getBMSCEvents();
+ std::vector<Event*> snap_node_events = snap->getNodeEvents();
+ std::vector<Event*> snap_b_events = snap->getBMSCEvents();
- coregion_ordering[cor]->deleteOrdering();
+ if(c->find_coregion_ordering(cor) == NULL)
+ {
+ throw std::runtime_error("Unexpected behaviour");
+ return false;
+ }
- return coregion_strict(snap_node_events, snap_b_events, membership);
+ c->find_coregion_ordering(cor)->deleteOrdering();
+
+ return coregion_strict(c, snap_node_events, snap_b_events, membership);
}
//check_coregion_attributes is OK
@@ -785,11 +618,11 @@
* b_events - event in bmsc
* type - type of searching
*/
-bool coregion_strict(std::vector<Event*>& node_events, std::vector<Event*>& b_events,
+bool coregion_strict(MembershipContext* c, std::vector<Event*>& node_events, std::vector<Event*>& b_events,
enum check_type type)
{
if(type == receive_ordering)
- return coregion_strict_receive_ordering(node_events, b_events);
+ return coregion_strict_receive_ordering(c, node_events, b_events);
StrictEvent* b_e = dynamic_cast<StrictEvent*> (b_events.front());
std::vector<Event*> acceptable_events;
@@ -801,16 +634,15 @@
if (node_events.empty())
return true;
- std::map<CoregionAreaPtr, SnapshotContextPtr>::iterator snap_it;
Event* e = node_events.front();
EventAreaPtr e_a = e->get_general_area();
CoregionAreaPtr cor = boost::dynamic_pointer_cast<CoregionArea>(e_a);
- snap_it = snapshots.find(cor);
+ SnapshotContextPtr snap = c->find_snapshot(cor);
- if(snap_it == snapshots.end())
+ if(snap == NULL)
{
SnapshotContextPtr snap = new SnapshotContext(node_events, b_events);
- snapshots.insert(std::make_pair(cor, snap));
+ c->add_snapshot(cor, snap);
}
//it is supposed that the bMSC contains just one strict event area on one instance
@@ -840,30 +672,18 @@
for (accept_it = acceptable_events.begin(); accept_it != acceptable_events.end(); accept_it++)
{
- std::map<CoregionAreaPtr, CoregionOrderingPtr>::iterator map_it;
EventAreaPtr node_e_a = (*accept_it)->get_general_area();
CoregionAreaPtr cor = boost::dynamic_pointer_cast<CoregionArea> (node_e_a);
if(cor == NULL)
{
- std::cerr << "Error: Unexpected behaviour 98" << std::endl;
+ throw std::runtime_error("Unexpected behaviour");
return false;
}
- map_it = coregion_ordering.find(cor);
+ CoregionAreaPtr map_first = cor;
+ CoregionOrderingPtr map_second = c->find_coregion_ordering(cor);
- CoregionAreaPtr map_first;
- CoregionOrderingPtr map_second;
-
- if (map_it != coregion_ordering.end()){
- map_first = map_it->first;
- map_second = map_it->second;
- }
- else{
- map_first = cor;
- map_second = NULL;
- }
-
bool result = false;
result = compare_events(*accept_it, b_e);
@@ -871,27 +691,27 @@
if(result)
{
//set identification to events
- set_identification(*accept_it, b_e);
+ set_identification(c, *accept_it, b_e);
CoregionEvent* cor_e = dynamic_cast<CoregionEvent*> (*accept_it);
//save current coregion ordering
- if(map_it == coregion_ordering.end())
+ if(map_second == NULL)
{
std::vector<CoregionEventPtr> cor_vec;
if(cor_e == NULL)
{
- std::cerr << "Error: Unexpected behaviour 99" << std::endl;
+ throw std::runtime_error("Unexpected behaviour");
return false;
}
cor_vec.push_back(cor_e);
- coregion_ordering.insert(std::make_pair(cor, new CoregionOrdering(cor_vec)));
+ c->add_coregion_ordering(cor, new CoregionOrdering(cor_vec));
}
else
{
- map_it->second->addLast(cor_e);
+ map_second->addLast(cor_e);
}
node_e = dynamic_cast<CoregionEvent*> (*accept_it);
@@ -934,29 +754,28 @@
b_events.clear();
b_events.push_back(b_e);
- if (coregion_strict(node_events, b_events, type))
+ if (coregion_strict(c, node_events, b_events, type))
{
if (b_events.size() == 1 && *(b_events.begin()) == NULL)
b_events.clear();
- std::map<CoregionAreaPtr, std::vector<CoregionOrderingPtr> >::iterator checked_it;
- checked_it = checked_orderings.find(map_first);
+ std::vector<CoregionOrderingPtr> checked_orderings = c->find_checked_ordering(map_first);
CoregionOrderingPtr current_ordering = map_second;
//when it tries first ordering
- if(checked_it == checked_orderings.end())
+ if(checked_orderings.empty())
return true;
if(current_ordering == NULL)
{
- std::cerr << "Error: unexpected behaviour 102" << std::endl;
+ throw std::runtime_error("Unexpected behaviour");
return false;
}
//checks whether the ordering was not consider in previous computation
- for(unsigned int i = 0; i < checked_it->second.size(); i++)
+ for(unsigned int i = 0; i < checked_orderings.size(); i++)
{
- if(current_ordering->compare(checked_it->second.at(i)))
+ if(current_ordering->compare(checked_orderings[i]))
{
current_ordering->deleteOrdering();
return false;
@@ -972,14 +791,13 @@
node_events.clear();
- std::map<CoregionAreaPtr, CoregionOrderingPtr>::iterator map_it;
EventAreaPtr e_a = (*accept_it)->get_general_area();
CoregionAreaPtr cor = boost::dynamic_pointer_cast<CoregionArea> (e_a);
- map_it = coregion_ordering.find(cor);
+ CoregionOrderingPtr map_ordering = c->find_coregion_ordering(cor);
- if(map_it != coregion_ordering.end())
- map_it->second->removeLast();
+ if(map_ordering != NULL )
+ map_ordering->removeLast();
for (it_o = old_node_events.begin(); it_o != old_node_events.end(); it_o++)
node_events.push_back(*it_o);
@@ -995,62 +813,11 @@
*
* DEVELOPMENT WAS STOPPED
*/
-bool coregion_coretion(CoregionAreaPtr node_coregion, std::vector<Event*>& node_events,
+bool coregion_coregion(MembershipContext* c, CoregionAreaPtr node_coregion, std::vector<Event*>& node_events,
CoregionAreaPtr b_coregion, std::vector<Event*>& b_events)
{
- mem->print_report(RS_ERROR, L"Error: unsuported function (bMSC flow cannot contain coregion");
+ c->get_mem()->print_report(RS_ERROR, L"Error: unsuported function (bMSC flow cannot contain coregion");
return false;
-
- /*
- std::vector<Event*>::iterator node_it, b_it;
- CoregionEvent* node_e = NULL;
- CoregionEvent* b_e = NULL;
-
- for (node_it = node_events.begin(); node_it != node_events.end(); node_it++)
- {
- for (b_it = b_events.begin(); b_it != b_events.end();)
- {
- if (compare_events(*node_it, *b_it))
- {
- while (node_e != NULL && b_e != NULL)
- {
- if (compare_events(node_e, b_e))
- {
- // node_e = node_e->get_successors();
- // b_e = node_e->get_successors();
- }
- else
- {
- //neni su rovnake
- }
- }
-
- if ((node_e == NULL) == (b_e == NULL))
- {
- ...
[truncated message content] |
|
From: <lko...@us...> - 2010-09-16 23:33:49
|
Revision: 953
http://scstudio.svn.sourceforge.net/scstudio/?rev=953&view=rev
Author: lkorenciak
Date: 2010-09-16 23:33:43 +0000 (Thu, 16 Sep 2010)
Log Message:
-----------
fixed time consistency checker
Modified Paths:
--------------
trunk/src/check/time/time_consistency.h
trunk/tests/time/consistency/CMakeLists.txt
Modified: trunk/src/check/time/time_consistency.h
===================================================================
--- trunk/src/check/time/time_consistency.h 2010-09-16 21:53:03 UTC (rev 952)
+++ trunk/src/check/time/time_consistency.h 2010-09-16 23:33:43 UTC (rev 953)
@@ -561,15 +561,14 @@
// std::cout<<"list size: "<<std::endl;
HMscPtr ce_hmsc = duplicator2.duplicate_path(list3);
// std::cout<<"duplicated, marking: "<< it->first<< " what is "<< inter <<std::endl;
- //TODO update duplicator do duplicate also time relations, then use: duplicator2.get_copy(it->first)->set_marked();
- TimeRelationRefNodePtr rel(new TimeRelationRefNode(inter));
-// std::cout<<"relation created"<<std::endl;
- rel->glue_ref_nodes(it->first->is_bottom_node_a(),
- dynamic_cast<ReferenceNode*>(duplicator2.get_copy(it->first->get_ref_node_a())),
- it->first->is_bottom_node_b(),
- dynamic_cast<ReferenceNode*>(duplicator2.get_copy(it->first->get_ref_node_b())));
-// std::cout<<"relation glued"<<std::endl;
- rel->set_marked();
+ //TODO update duplicator do duplicate also time relations, then use:
+ duplicator2.get_copy(it->first)->set_marked();
+// TimeRelationRefNodePtr rel(new TimeRelationRefNode(inter));
+// rel->glue_ref_nodes(it->first->is_bottom_node_a(),
+// dynamic_cast<ReferenceNode*>(duplicator2.get_copy(it->first->get_ref_node_a())),
+// it->first->is_bottom_node_b(),
+// dynamic_cast<ReferenceNode*>(duplicator2.get_copy(it->first->get_ref_node_b())));
+// rel->set_marked();
m_final_result.push_back(ce_hmsc);
// std::cout<<"counterexample created. number of counterexmaples: "<< m_final_result.size()<<std::endl;
}
@@ -793,7 +792,6 @@
return ;
}
-//TODO nekopiruje sa dobre report, asi budem
HMscPtr make_counterexample(BMscIntervalSetMatrix b_matrix, MscSolveTCSPReport* report,std::list<MscElement*> path)
{
HMscPtr example;
@@ -807,11 +805,6 @@
std::cout << path_list.back().size()<<std::endl;
//concatenate paths and then duplicate
path.insert(path.begin(),path_list.back().begin(),path_list.back().end());
-/* MscElementPList::iterator it;
- for(it=path_list.back().end();it!=path_list.back().begin();it--)
- {
- path.push_front(*it);
- }*/
std::cout<<"XXXXXXXXXXXXXX 2"<<std::endl;
//set the last time constraint marked
Modified: trunk/tests/time/consistency/CMakeLists.txt
===================================================================
--- trunk/tests/time/consistency/CMakeLists.txt 2010-09-16 21:53:03 UTC (rev 952)
+++ trunk/tests/time/consistency/CMakeLists.txt 2010-09-16 23:33:43 UTC (rev 953)
@@ -13,6 +13,7 @@
ADD_CHECKER_TEST(sctime "Time Consistent" cons_pos_13.mpr 1)
ADD_CHECKER_TEST(sctime "Time Consistent" cons_pos_14.mpr 1)
ADD_CHECKER_TEST(sctime "Time Consistent" cons_pos_15.mpr 1)
+ADD_CHECKER_TEST(sctime "Time Consistent" cons_pos_16.mpr 1)
ADD_CHECKER_TEST(sctime "Time Consistent" cons_neg_1.mpr 0)
ADD_CHECKER_TEST(sctime "Time Consistent" cons_neg_2.mpr 0)
@@ -34,7 +35,7 @@
# ADD_CHECKER_TEST(sctime "Time Consistent" cons_neg_20.mpr 0)
# ADD_CHECKER_TEST(sctime "Time Consistent" cons_neg_21.mpr 0)
# ADD_CHECKER_TEST(sctime "Time Consistent" cons_neg_22.mpr 0)
-ADD_CHECKER_TEST(sctime "Time Consistent" cons_neg_23.mpr 0)
+# ADD_CHECKER_TEST(sctime "Time Consistent" cons_neg_23.mpr 0)
# ADD_CHECKER_TEST(sctime "Time Consistent" cons_neg_24.mpr 0)
# ADD_CHECKER_TEST(sctime "Time Consistent" cons_neg_25.mpr 0)
# ADD_CHECKER_TEST(sctime "Time Consistent" cons_neg_26.mpr 0)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2010-09-17 21:20:44
|
Revision: 967
http://scstudio.svn.sourceforge.net/scstudio/?rev=967&view=rev
Author: gotthardp
Date: 2010-09-17 21:20:37 +0000 (Fri, 17 Sep 2010)
Log Message:
-----------
Interval numbers now support exponential form and correctly report invalid numbers.
Modified Paths:
--------------
trunk/src/data/time.cpp
trunk/src/data/time.h
trunk/tests/interval_string.cpp
Modified: trunk/src/data/time.cpp
===================================================================
--- trunk/src/data/time.cpp 2010-09-17 21:11:32 UTC (rev 966)
+++ trunk/src/data/time.cpp 2010-09-17 21:20:37 UTC (rev 967)
@@ -53,29 +53,27 @@
template <>
MscIntervalCouple<double>::MscIntervalCouple(const std::string& number, const bool& closed):
- m_closed(closed)
- ,m_value(0)
+ m_closed(closed),
+ m_value(0)
{
- int position=0;
- int neg = 1;
- if(number[0]=='-')
- {
- neg = -1;
- position=1;
- }
+ std::string lowcase_value;
+ lowcase_value.reserve(number.length());
+ // transform new_value to lowercase for case insensitive comparison
+ std::transform(number.begin(), number.end(),
+ std::back_inserter(lowcase_value), ::tolower);
- if(number[position]=='i')
- {
+ if(lowcase_value == "inf" || lowcase_value == "+inf")
m_value = std::numeric_limits<double>::infinity();
- if(neg<0)
- m_value = -m_value;
- }
+ else if(lowcase_value == "-inf")
+ m_value = -std::numeric_limits<double>::infinity();
else
{
- const char* pos = number.c_str();
- m_value = atof(pos);
- }
+ char* endptr;
+ m_value = strtod(number.c_str(), &endptr);
+ if(endptr != NULL && *endptr != 0)
+ throw MscIntervalStringConversionError(number + std::string(" is not a valid number."));
+ }
}
template <>
Modified: trunk/src/data/time.h
===================================================================
--- trunk/src/data/time.h 2010-09-17 21:11:32 UTC (rev 966)
+++ trunk/src/data/time.h 2010-09-17 21:20:37 UTC (rev 967)
@@ -127,49 +127,6 @@
}
/**
- * \brief Check whether string is correct format of number - number or "inf"
- * Correct format of number in interval is plain number
- * \param word string to be check
- * \return true if the word is correct interval number
- */
-inline bool check_number(const std::string& word)
-{
- const std::string inf="inf";
- const std::string ninf="-inf";
-
- // its number
- int position=0;
- if(word[0]=='-')
- position=1;
- if(isdigit(word[position]))
- {
- // only one separator is allowed, false - separator has been used
- bool separator=true;
- for(unsigned i=position+1;i<word.length();i++)
- {
- if(isdigit(word[i]))
- continue;
- else if(word[i]=='.' && separator && i<word.length()-1)
- {
- separator=false;
- continue;
- }
- else
- return false;
- }
- return true;
- }
- else if(isalpha(word[position]))
- {
- if(word!=inf&&word!=ninf)
- return false;
- return true;
- }
- else
- return false;
-}
-
-/**
* Decimal scaling structure, stands for:
* m_mant*10^m_exp;
*/
@@ -588,8 +545,6 @@
// ok, start bracket is not there, what about end one?
if(!char_in_string(tmp[tmp.length()-1],")]"))
{
- if(!check_number(tmp))
- throw MscIntervalStringConversionError(tmp + std::string(" is not a valid number."));
MscIntervalCouple<T> begin(tmp,b_closed);
MscIntervalCouple<T> end(tmp,e_closed);
@@ -597,9 +552,8 @@
m_end = end;
if(!is_valid())
- {
throw MscIntervalStringConversionError(this->to_string()+std::string(" is not valid interval."));
- }
+
return;
}
else
@@ -631,11 +585,6 @@
tmp.erase(comma_pos); // erase all from comma including comma
b = std::string(tmp);
}
- // checking numbers
- if(!check_number(b))
- throw MscIntervalStringConversionError(b + std::string(" is not a valid number."));
- if(!check_number(e))
- throw MscIntervalStringConversionError(e + std::string(" is not a valid number."));
// Create MscIntervalCouples
MscIntervalCouple<T> begin(b,b_closed);
@@ -1034,10 +983,17 @@
void assign(const std::string& s_interval)
{
+ int inside = 0;
std::string tmp;
+
for(size_t i=0;i<s_interval.length();i++)
{
- if(s_interval[i]=='+')
+ if(s_interval[i]=='[' || s_interval[i]=='(')
+ inside++;
+ else if(s_interval[i]==']' || s_interval[i]==')')
+ inside--;
+
+ if(inside == 0 && s_interval[i]=='+')
{
MscTimeInterval<T> interval(tmp);
insert(interval);
Modified: trunk/tests/interval_string.cpp
===================================================================
--- trunk/tests/interval_string.cpp 2010-09-17 21:11:32 UTC (rev 966)
+++ trunk/tests/interval_string.cpp 2010-09-17 21:20:37 UTC (rev 967)
@@ -82,6 +82,8 @@
ret+=test_interval_set("10+[10]+50+[30,40)",true);
ret+=test_interval_set("(1,2) + (1.2,13]",true);
+ ret+=test_interval_set("[-1e+10,+2e-2]",true);
+ ret+=test_interval_set("(-inf,+inf)",true);
ret+=test_interval_set(" ( inf, 3.23) + [4,6543]",false);
ret+=test_interval_set("(5.431,4.876)+(1,2)",false);
ret+=test_interval_set("(0.123,inf]",false);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-09-18 19:47:03
|
Revision: 975
http://scstudio.svn.sourceforge.net/scstudio/?rev=975&view=rev
Author: madzin
Date: 2010-09-18 19:46:56 +0000 (Sat, 18 Sep 2010)
Log Message:
-----------
add path returning to membership algorithm
Modified Paths:
--------------
trunk/src/membership/membership_alg.cpp
trunk/src/membership/membership_alg.h
trunk/src/membership/membership_base.h
trunk/src/membership/membership_time.cpp
trunk/tests/membership/CMakeLists.txt
Modified: trunk/src/membership/membership_alg.cpp
===================================================================
--- trunk/src/membership/membership_alg.cpp 2010-09-18 18:06:18 UTC (rev 974)
+++ trunk/src/membership/membership_alg.cpp 2010-09-18 19:46:56 UTC (rev 975)
@@ -83,6 +83,7 @@
BMscGraphDuplicator duplicator;
HMscPtr dup_hmsc;
+ //TODO it is necessary to copy MSC because of path returning.
//dup_hmsc should be MSC graph. Due to that duplicatior throws exception during copying time intervals, membership workes just with MSC graphs.
dup_hmsc = hmsc;
// dup_hmsc = dup_hmsc = duplicator.duplicate(hmsc);
@@ -102,10 +103,10 @@
if(c->get_not_covered_intervals().size() > 0)
{
c->get_mem()->print_report(RS_ERROR, L"Some time interval in the specification is not full covered");
- return NULL;
+ return color_path(c, color_intervals(c, dup_hmsc));
}
- return new HMsc(); //TODO return path in hmsc
+ return color_path(c, dup_hmsc);
}
else
return NULL;
@@ -127,6 +128,9 @@
c->clear_attributed_events();
}
+ //add node to the path which will be printed if the flow meets specification
+ c->push_path(hmsc_node);
+
//checks end node
EndNodePtr end = boost::dynamic_pointer_cast<EndNode > (hmsc_node);
@@ -135,7 +139,10 @@
if (b->is_null(c))
return true;
else
+ {
+ c->top_pop_path();
return false;
+ }
}
ReferenceNodePtr node = boost::dynamic_pointer_cast<ReferenceNode > (hmsc_node);
@@ -147,11 +154,17 @@
{
//when deosn't exist empty path to EndNode
if (b->is_null(c) && !is_node_null(c, node))
+ {
+ c->top_pop_path();
return false;
+ }
//checks if this node with this configuration was checked
if (!look_at_checked_conf(c, node, b))
+ {
+ c->top_pop_path();
return false;
+ }
ConfigurationPtr old_config_I, old_config_II;
@@ -162,6 +175,7 @@
if (!check_node(c, node, membership, b))
{
c->clear_attributed_events();
+ c->top_pop_path();
return false;
}
@@ -171,6 +185,7 @@
if(!check_node_time(c, node, old_config_II))
{
c->clear_attributed_events();
+ c->top_pop_path();
return false;
}
}
@@ -179,6 +194,7 @@
if (!check_node(c, node, receive_ordering, old_config_I))
{
c->clear_attributed_events();
+ c->top_pop_path();
return false;
}
@@ -189,7 +205,10 @@
during the time checking the algorithm has not to travers all events*/
if(!b->compare(old_config_I))
+ {
+ c->top_pop_path();
return false;
+ }
c->clear_attributed_events();
@@ -216,6 +235,7 @@
}
}
+ c->top_pop_path();
return false;
}
@@ -602,6 +622,8 @@
*/
HMscPtr search_bmsc(MembershipContext* c, BMscPtr bmsc, BMscPtr bmsc_f)
{
+ c->print_msc_path(false);
+
//creates HMSC
HMscPtr hmsc = new HMsc(L"membership");
@@ -881,3 +903,24 @@
return false;
}
+
+HMscPtr color_path(MembershipContext* c, HMscPtr msc)
+{
+ if(!c->get_print_path())
+ return msc;
+
+ while(c->get_path_size() > 0)
+ c->top_pop_path()->set_marked();
+
+ return msc;
+}
+
+HMscPtr color_intervals(MembershipContext* c, HMscPtr msc)
+{
+ std::vector<TimeRelationPtr> relations = c->get_not_covered_intervals();
+
+ for(unsigned int i = 0; i < relations.size(); i++)
+ relations[i]->set_marked();
+
+ return msc;
+}
Modified: trunk/src/membership/membership_alg.h
===================================================================
--- trunk/src/membership/membership_alg.h 2010-09-18 18:06:18 UTC (rev 974)
+++ trunk/src/membership/membership_alg.h 2010-09-18 19:46:56 UTC (rev 975)
@@ -96,4 +96,10 @@
//! check each successor of hmsc_node
bool check_next(MembershipContext* c, HMscNodePtr hmsc_node, ConfigurationPtr b);
+//! makes path colored
+HMscPtr color_path(MembershipContext* c, HMscPtr msc);
+
+//! makes not full covered intervals colored
+HMscPtr color_intervals(MembershipContext* c, HMscPtr msc);
+
#endif
Modified: trunk/src/membership/membership_base.h
===================================================================
--- trunk/src/membership/membership_base.h 2010-09-18 18:06:18 UTC (rev 974)
+++ trunk/src/membership/membership_base.h 2010-09-18 19:46:56 UTC (rev 975)
@@ -58,12 +58,15 @@
std::map<CoregionAreaPtr, std::vector<CoregionOrderingPtr> > checked_orderings; //! checked possibilities of coregion ordering
std::map<CoregionAreaPtr, CoregionOrderingPtr> coregion_ordering; //! save ordering of coregion events in appropriate coregion
BMscIntervalSetMatrix* time_matrix; //! matrix of all time intervals among events in bmsc
- std::vector<MscTimeIntervalSetD> not_full_covered_intervals; //! intervals in specification which are not full covered
+ std::vector<TimeRelationPtr> not_full_covered_intervals; //! intervals in specification which are not full covered
+ std::stack<HMscNodePtr> path; //! store information about the path if the flow meets the specification
+ bool print_path; //! store whether the path will be printed
public:
MembershipContext()
{
max_id = 0;
+ print_path = true;
}
void set_mem(MembershipAlg* m)
@@ -235,15 +238,42 @@
return time_matrix;
}
- void add_not_covered_interval(MscTimeIntervalSetD hmsc_inter)
+ void add_not_covered_interval(TimeRelationPtr hmsc_inter)
{
not_full_covered_intervals.push_back(hmsc_inter);
}
- const std::vector<MscTimeIntervalSetD> get_not_covered_intervals()
+ const std::vector<TimeRelationPtr> get_not_covered_intervals()
{
return not_full_covered_intervals;
}
+
+ void push_path(HMscNodePtr node)
+ {
+ path.push(node);
+ }
+
+ HMscNodePtr top_pop_path()
+ {
+ HMscNodePtr node = path.top();
+ path.pop();
+ return node;
+ }
+
+ int get_path_size()
+ {
+ return path.size();
+ }
+
+ void print_msc_path(bool value)
+ {
+ print_path = value;
+ }
+
+ bool get_print_path()
+ {
+ return print_path;
+ }
};
//! store information about the position of checking algorithm on instance
Modified: trunk/src/membership/membership_time.cpp
===================================================================
--- trunk/src/membership/membership_time.cpp 2010-09-18 18:06:18 UTC (rev 974)
+++ trunk/src/membership/membership_time.cpp 2010-09-18 19:46:56 UTC (rev 975)
@@ -126,7 +126,7 @@
return false;
else
if(result != bmsc_inter)
- c->add_not_covered_interval(hmsc_inter);
+ c->add_not_covered_interval(relation);
return true;
}
@@ -373,7 +373,7 @@
return false;
else
if(result != bmsc_inter)
- c->add_not_covered_interval(hmsc_inter);
+ c->add_not_covered_interval(*it);
}
}
@@ -485,7 +485,7 @@
return false;
else
if(result != bmsc_inter)
- c->add_not_covered_interval(hmsc_inter);
+ c->add_not_covered_interval(*it_vec);
}
map_bottom_conf = c->find_bottom_time_ref(*it_vec);
@@ -502,7 +502,7 @@
return false;
else
if(result != bmsc_inter)
- c->add_not_covered_interval(hmsc_inter);
+ c->add_not_covered_interval(*it_vec);
}
}
@@ -536,7 +536,7 @@
return false;
else
if(result != bmsc_inter)
- c->add_not_covered_interval(hmsc_inter);
+ c->add_not_covered_interval(*it_vec);
}
map_top_conf = c->find_top_time_ref(*it_vec);
@@ -553,7 +553,7 @@
return false;
else
if(result != bmsc_inter)
- c->add_not_covered_interval(hmsc_inter);
+ c->add_not_covered_interval(*it_vec);
}
}
Modified: trunk/tests/membership/CMakeLists.txt
===================================================================
--- trunk/tests/membership/CMakeLists.txt 2010-09-18 18:06:18 UTC (rev 974)
+++ trunk/tests/membership/CMakeLists.txt 2010-09-18 19:46:56 UTC (rev 975)
@@ -189,28 +189,28 @@
ADD_TEST(membership_test-80 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28_2.mpr 1)
-ADD_TEST(membership_test-81 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28_3.mpr 0) # + warning
+ADD_TEST(membership_test-81 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28_3.mpr 1) # + warning
-ADD_TEST(membership_test-82 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28_4.mpr 0) # + warning
+ADD_TEST(membership_test-82 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc28_4.mpr 1) # + warning
#tests for new time algorithm
ADD_TEST(membership_test-83 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_hmsc29.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc29_1.mpr 1)
-ADD_TEST(membership_test-84 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_hmsc29.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc29_2.mpr 0) # + warning
+ADD_TEST(membership_test-84 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_hmsc29.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc29_2.mpr 1) # + warning
ADD_TEST(membership_test-85 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_hmsc30.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc30_1.mpr 1)
-ADD_TEST(membership_test-86 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_hmsc30.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc30_2.mpr 0) # + warning
+ADD_TEST(membership_test-86 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_hmsc30.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc30_2.mpr 1) # + warning
ADD_TEST(membership_test-87 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_hmsc31.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc31_1.mpr 1)
ADD_TEST(membership_test-88 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/time_hard_bmsc01.mpr ${CMAKE_CURRENT_SOURCE_DIR}/time_hard_bmsc_pat01.mpr 1)
-ADD_TEST(membership_test-89 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/time_hard_bmsc02.mpr ${CMAKE_CURRENT_SOURCE_DIR}/time_hard_bmsc_pat01.mpr 0) # + warning
+ADD_TEST(membership_test-89 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/time_hard_bmsc02.mpr ${CMAKE_CURRENT_SOURCE_DIR}/time_hard_bmsc_pat01.mpr 1) # + warning
ADD_TEST(membership_test-90 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/time_hard_bmsc03.mpr ${CMAKE_CURRENT_SOURCE_DIR}/time_hard_bmsc_pat01.mpr 0)
-ADD_TEST(membership_test-91 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/time_hard_bmsc04.mpr ${CMAKE_CURRENT_SOURCE_DIR}/time_hard_bmsc_pat02.mpr 0) # + warning
+ADD_TEST(membership_test-91 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/time_hard_bmsc04.mpr ${CMAKE_CURRENT_SOURCE_DIR}/time_hard_bmsc_pat02.mpr 1) # + warning
ADD_TEST(membership_test-92 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/time_hard_bmsc05.mpr ${CMAKE_CURRENT_SOURCE_DIR}/time_hard_bmsc_pat02.mpr 0)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-10-03 22:11:39
|
Revision: 988
http://scstudio.svn.sourceforge.net/scstudio/?rev=988&view=rev
Author: madzin
Date: 2010-10-03 22:11:32 +0000 (Sun, 03 Oct 2010)
Log Message:
-----------
repair membership bug, add test of this bug and solve some memory leaks
Modified Paths:
--------------
trunk/src/membership/membership_additional.cpp
trunk/src/membership/membership_alg.cpp
trunk/src/membership/membership_time.cpp
trunk/tests/membership/CMakeLists.txt
Added Paths:
-----------
trunk/tests/membership/test_bmsc35.mpr
trunk/tests/membership/test_hmsc35.mpr
Modified: trunk/src/membership/membership_additional.cpp
===================================================================
--- trunk/src/membership/membership_additional.cpp 2010-10-03 19:25:06 UTC (rev 987)
+++ trunk/src/membership/membership_additional.cpp 2010-10-03 22:11:32 UTC (rev 988)
@@ -81,10 +81,16 @@
a_id = a->get_attribute("identification", -1, a_set);
+ if(a_set)
+ c->add_attributed_event(a);
+
bool b_set = true;
b_id = b->get_attribute("identification", -2, b_set);
+ if(b_set)
+ c->add_attributed_event(b);
+
if(c->get_focused_instances().empty()
|| c->contain_focused_instances(a->get_matching_event()->get_instance()->get_label()))
{
Modified: trunk/src/membership/membership_alg.cpp
===================================================================
--- trunk/src/membership/membership_alg.cpp 2010-10-03 19:25:06 UTC (rev 987)
+++ trunk/src/membership/membership_alg.cpp 2010-10-03 22:11:32 UTC (rev 988)
@@ -38,12 +38,7 @@
*/
MscPtr MembershipAlg::find(MscPtr msc, MscPtr bmsc, std::vector<std::wstring> instances)
{
- MembershipContext* c = new MembershipContext();
- c->set_mem(this);
- c->set_focused_instances(instances);
-
HMscPtr hmsc = boost::dynamic_pointer_cast<HMsc > (msc);
-
BMscPtr bmsc_f = boost::dynamic_pointer_cast<BMsc > (bmsc);
if (bmsc_f == NULL)
@@ -52,21 +47,28 @@
return NULL;
}
+ MembershipContext* c = new MembershipContext();
+ c->set_mem(this);
+ c->set_focused_instances(instances);
c->set_bmsc(bmsc_f);
+ MscPtr result = NULL;
if (hmsc != NULL)
- return search_hmsc(c, hmsc, bmsc_f);
+ result = search_hmsc(c, hmsc, bmsc_f);
else
{
BMscPtr bmsc = boost::dynamic_pointer_cast<BMsc > (msc);
if(bmsc != NULL)
- return search_bmsc(c, bmsc, bmsc_f);
+ result = search_bmsc(c, bmsc, bmsc_f);
else
{
print_report(RS_ERROR, L"Membership algorithm cannot recognize a type of browsed MSC");
return NULL;
}
}
+
+ delete c;
+ return result;
}
MscPtr MembershipAlg::find(MscPtr msc, MscPtr bmsc)
@@ -115,11 +117,6 @@
*/
bool check_branch(MembershipContext* c, HMscNodePtr hmsc_node, ConfigurationPtr b)
{
- //remove attributes from previous computation
- if(!c->get_attributed_events().empty()){
- c->clear_attributed_events();
- }
-
//add node to the path which will be printed if the flow meets specification
c->push_path(hmsc_node);
@@ -128,6 +125,11 @@
if (end != NULL)
{
+ //remove attributes from previous computation
+ if(!c->get_attributed_events().empty()){
+ c->clear_attributed_events();
+ }
+
if (b->is_null(c))
return true;
else
@@ -202,8 +204,6 @@
return false;
}
- c->clear_attributed_events();
-
NodeRelationPtrVector successors = node->get_successors();
NodeRelationPtrVector::iterator it;
SuccessorNode* succ;
Modified: trunk/src/membership/membership_time.cpp
===================================================================
--- trunk/src/membership/membership_time.cpp 2010-10-03 19:25:06 UTC (rev 987)
+++ trunk/src/membership/membership_time.cpp 2010-10-03 22:11:32 UTC (rev 988)
@@ -228,6 +228,10 @@
//set of the maximal events (in case more events, the algorithm is not able to decide the maximum one)
std::set<Event*> max;
+
+ if(pos_max.size() == 0)
+ return NULL;
+
max.insert(pos_max[0]);
//try to eliminate pos_min to one event
@@ -438,7 +442,7 @@
start = cor_order->getOrdering().front();
}
-
+
std::vector<int> identifications;
Event* e = get_last_instance_event(c, start.get());
@@ -452,6 +456,8 @@
if(!it_set)
identifications.push_back(it_id);
+ else
+ throw std::runtime_error("Unexpected behaviour");
node_last_events.insert(std::make_pair((*inst_it)->get_label(), identifications));
}
Modified: trunk/tests/membership/CMakeLists.txt
===================================================================
--- trunk/tests/membership/CMakeLists.txt 2010-10-03 19:25:06 UTC (rev 987)
+++ trunk/tests/membership/CMakeLists.txt 2010-10-03 22:11:32 UTC (rev 988)
@@ -265,3 +265,7 @@
#do not meet preconditions
#ADD_TEST(membership_test-118 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc32.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc32_2.mpr 0)
+
+
+ADD_TEST(membership_test-118 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_hmsc35.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc35.mpr 1)
+
Added: trunk/tests/membership/test_bmsc35.mpr
===================================================================
--- trunk/tests/membership/test_bmsc35.mpr (rev 0)
+++ trunk/tests/membership/test_bmsc35.mpr 2010-10-03 22:11:32 UTC (rev 988)
@@ -0,0 +1,19 @@
+mscdocument Membership_help_bmsc.vsd;
+msc Page_1;
+inst A;
+inst B;
+A: instance;
+label e0;
+out request,0 to B;
+time e1 [1], e2 [7];
+label e2;
+in response,1 from B;
+endinstance;
+B: instance;
+label e1;
+in request,0 from A;
+time e3 [2];
+label e3;
+out response,1 to A;
+endinstance;
+endmsc;
Added: trunk/tests/membership/test_hmsc35.mpr
===================================================================
--- trunk/tests/membership/test_hmsc35.mpr (rev 0)
+++ trunk/tests/membership/test_hmsc35.mpr 2010-10-03 22:11:32 UTC (rev 988)
@@ -0,0 +1,46 @@
+mscdocument membership_help_bug.vsd;
+msc Page_1;
+initial connect L0;
+L0: connect L1, L2;
+L1: reference bmsc2 time [0,4);
+ connect L3;
+L2: reference bmsc1 top top L4 [0,12];
+ bottom top L4 [0,3);
+ connect L4;
+L3: connect L5;
+L4: reference bmsc3 connect L3;
+L5: final;
+endmsc;
+msc bmsc1;
+inst A;
+inst B;
+A: instance;
+label e0;
+out request,0 to B;
+time e1 [0,2);
+endinstance;
+B: instance;
+label e1;
+in request,0 from A;
+endinstance;
+endmsc;
+msc bmsc3;
+inst A;
+inst B;
+A: instance;
+in response,0 from B;
+endinstance;
+B: instance;
+out response,0 to A;
+endinstance;
+endmsc;
+msc bmsc2;
+inst A;
+inst B;
+A: instance;
+out Sip,0 to B;
+endinstance;
+B: instance;
+in Sip,0 from A;
+endinstance;
+endmsc;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-10-10 22:38:26
|
Revision: 990
http://scstudio.svn.sourceforge.net/scstudio/?rev=990&view=rev
Author: madzin
Date: 2010-10-10 22:38:19 +0000 (Sun, 10 Oct 2010)
Log Message:
-----------
add absolut time support for membership algorithm (not tested)
Modified Paths:
--------------
trunk/src/membership/membership_additional.cpp
trunk/src/membership/membership_additional.h
trunk/src/membership/membership_alg.cpp
trunk/src/membership/membership_base.h
trunk/src/membership/membership_time.cpp
trunk/src/membership/membership_time.h
trunk/tests/membership/CMakeLists.txt
Added Paths:
-----------
trunk/tests/membership/absolut_time_bmsc01.mpr
trunk/tests/membership/absolut_time_bmsc02_1.mpr
trunk/tests/membership/absolut_time_bmsc02_2.mpr
trunk/tests/membership/absolut_time_hmsc01.mpr
trunk/tests/membership/absolut_time_hmsc02.mpr
Modified: trunk/src/membership/membership_additional.cpp
===================================================================
--- trunk/src/membership/membership_additional.cpp 2010-10-05 12:29:14 UTC (rev 989)
+++ trunk/src/membership/membership_additional.cpp 2010-10-10 22:38:19 UTC (rev 990)
@@ -17,7 +17,9 @@
#include "membership/membership_additional.h"
-bool compare_events(Event* a, Event* b)
+//parameters a - node event
+// b - bmsc event
+bool compare_events(MembershipContext* c, Event* a, Event* b)
{
if (b == NULL || a == NULL)
return false;
@@ -54,12 +56,14 @@
return true;
}
-bool compare_events_attribute(MembershipContext* c, Event* a, Event* b)
+//parameters node_e - node event
+// b_e - bmsc event
+bool compare_events_attribute(MembershipContext* c, Event* node_e, Event* b_e)
{
- IncompleteMessagePtr incom_a = boost::dynamic_pointer_cast<IncompleteMessage > (a->get_message());
- IncompleteMessagePtr incom_b = boost::dynamic_pointer_cast<IncompleteMessage > (b->get_message());
+ IncompleteMessagePtr incom_node = boost::dynamic_pointer_cast<IncompleteMessage > (node_e->get_message());
+ IncompleteMessagePtr incom_b = boost::dynamic_pointer_cast<IncompleteMessage > (b_e->get_message());
- switch ((incom_a != NULL) + (incom_b != NULL))
+ switch ((incom_node != NULL) + (incom_b != NULL))
{
case 2:
return true;
@@ -76,28 +80,41 @@
return false;
}
- int a_id, b_id;
- bool a_set = true;
+ int node_id, b_id;
+ bool node_set = true;
- a_id = a->get_attribute("identification", -1, a_set);
+ node_id = node_e->get_attribute("identification", -1, node_set);
- if(a_set)
- c->add_attributed_event(a);
+ if(node_set)
+ c->add_attributed_event(node_e);
bool b_set = true;
- b_id = b->get_attribute("identification", -2, b_set);
+ b_id = b_e->get_attribute("identification", -2, b_set);
if(b_set)
- c->add_attributed_event(b);
+ c->add_attributed_event(b_e);
+ //check if the partial membership algorithm is not running or the instance is among the focused instances
if(c->get_focused_instances().empty()
- || c->contain_focused_instances(a->get_matching_event()->get_instance()->get_label()))
+ || c->contain_focused_instances(node_e->get_matching_event()->get_instance()->get_label()))
{
- if (a_set || b_set || a_id != b_id)
+ if (node_set || b_set || node_id != b_id)
return false;
- return compare_events_time_relations(c, a,b);
+ bool relative = false;
+ bool absolut = false;
+
+ relative = compare_relative_time_constraints(c, node_e, b_e);
+
+//TODO beginnig for absolut time support in BMSC parts of specification
+// absolut = compare_absolut_time_constraints(c, node_e, b_e);
+ absolut = true;
+
+ if(relative && absolut)
+ return true;
+ else
+ return false;
}
else
return true;
Modified: trunk/src/membership/membership_additional.h
===================================================================
--- trunk/src/membership/membership_additional.h 2010-10-05 12:29:14 UTC (rev 989)
+++ trunk/src/membership/membership_additional.h 2010-10-10 22:38:19 UTC (rev 990)
@@ -24,7 +24,7 @@
#include "check/time/tightening.h"
//! compares two events
-bool compare_events(Event* a, Event* b);
+bool compare_events(MembershipContext* c, Event* a, Event* b);
/**
* \brief compares events attributes
Modified: trunk/src/membership/membership_alg.cpp
===================================================================
--- trunk/src/membership/membership_alg.cpp 2010-10-05 12:29:14 UTC (rev 989)
+++ trunk/src/membership/membership_alg.cpp 2010-10-10 22:38:19 UTC (rev 990)
@@ -173,17 +173,29 @@
return false;
}
- //checks time constraints for this node
- if(c->get_focused_instances().empty())
+ //if there are not time constraints or there are relative and absolut time constraints, skip the time checking
+ if(c->get_absolut_time() != c->get_relative_time())
{
- if(!check_node_time(c, node, old_config_II))
+ //checks time constraints for this node
+ //time constraints are not checked in partial mebership algorithm
+ if(c->get_focused_instances().empty())
{
- c->clear_attributed_events();
- c->top_pop_path();
- return false;
+ if(!check_node_time(c, node, old_config_II))
+ {
+ c->clear_attributed_events();
+ c->top_pop_path();
+ return false;
+ }
}
}
+ //if there are absolut and relative time constraints, print error and warning
+ if(c->get_absolut_time() && c->get_relative_time())
+ {
+ c->get_mem()->print_report(RS_ERROR, L"Error: both time constraints (relative, absolut) are not allowed in the same BMSC flow definition");
+ c->get_mem()->print_report(RS_WARNING, L"Warning: time checking was skipped");
+ }
+
//checks the ordering of events (by attribute which was set at check_node(node, membership,b))
if (!check_node(c, node, receive_ordering, old_config_I))
{
@@ -246,10 +258,13 @@
{
if (type == membership)
{
- if (!compare_events(node_e, b_e))
+ if (!compare_events(c, node_e, b_e))
return false;
+ //set identification to events
set_identification(c, node_e, b_e);
+ //check relative and absolut time constraints
+ analyze_time_constraints(c, b_e);
}
else
{
@@ -419,7 +434,7 @@
for (node_it = node_events.begin(); node_it != node_events.end(); node_it++)
{
- if (compare_events(*node_it, b_e))
+ if (compare_events(c, *node_it, b_e))
{
node_e = dynamic_cast<CoregionEvent*> (*node_it);
@@ -446,12 +461,14 @@
bool result = false;
- result = compare_events(*accept_it, b_e);
+ result = compare_events(c, *accept_it, b_e);
if(result)
{
//set identification to events
set_identification(c, *accept_it, b_e);
+ //check relative and absolut time constraints
+ analyze_time_constraints(c, b_e);
CoregionEvent* cor_e = dynamic_cast<CoregionEvent*> (*accept_it);
Modified: trunk/src/membership/membership_base.h
===================================================================
--- trunk/src/membership/membership_base.h 2010-10-05 12:29:14 UTC (rev 989)
+++ trunk/src/membership/membership_base.h 2010-10-10 22:38:19 UTC (rev 990)
@@ -61,12 +61,16 @@
std::vector<TimeRelationPtr> not_full_covered_intervals; //! intervals in specification which are not full covered
std::stack<HMscNodePtr> path; //! store information about the path if the flow meets the specification
bool print_path; //! store whether the path will be printed
+ bool relative_time;
+ bool absolut_time;
public:
MembershipContext()
{
max_id = 0;
print_path = true;
+ relative_time = false;
+ absolut_time = false;
}
void set_mem(MembershipAlg* m)
@@ -279,6 +283,26 @@
{
return print_path;
}
+
+ void found_relative_time()
+ {
+ relative_time = true;
+ }
+
+ bool get_relative_time()
+ {
+ return relative_time;
+ }
+
+ void found_absolut_time()
+ {
+ absolut_time = true;
+ }
+
+ bool get_absolut_time()
+ {
+ return absolut_time;
+ }
};
//! store information about the position of checking algorithm on instance
Modified: trunk/src/membership/membership_time.cpp
===================================================================
--- trunk/src/membership/membership_time.cpp 2010-10-05 12:29:14 UTC (rev 989)
+++ trunk/src/membership/membership_time.cpp 2010-10-10 22:38:19 UTC (rev 990)
@@ -19,6 +19,12 @@
bool check_node_time(MembershipContext* c, ReferenceNodePtr node, ConfigurationPtr conf)
{
+ if(c->get_relative_time())
+ std::cout << "relative time" << std::endl;
+
+// if(c->get_absolut_time())
+// return check_absolut_time(c, node, conf);
+
TimeRelationRefNodePtrSet top = node->get_time_relations_top();
TimeRelationRefNodePtrSet bottom = node->get_time_relations_bottom();
TimeRelationRefNodePtrSet::iterator it;
@@ -66,7 +72,7 @@
if(!bottom_vec.empty())
max_b = get_max_event(c, node, conf);
- // found bottom time relation and decided the maximal event
+ //! found bottom time relation and decided the maximal event
if(max_b != NULL)
{
if(!check_bottom_time_relations(c, bottom_vec, max_b))
@@ -118,8 +124,18 @@
MscTimeIntervalSetD result, hmsc_inter, bmsc_inter;
hmsc_inter = relation->get_interval_set();
- bmsc_inter = c->get_time_matrix()->operator()(min_a, max_b);
+ if(c->get_absolut_time())
+ {
+//TODO to nemoze byt list intervalov v evente pri absolutnom case, to nedava zmysel
+ MscTimeIntervalSetD a = *(min_a->get_absolut_times().begin());
+ MscTimeIntervalSetD b = *(max_b->get_absolut_times().begin());
+std::cout << "see 1 a " << a << " b " << b << std::endl;
+ bmsc_inter = get_continous_interval(c, a, b);
+ }
+ else
+ bmsc_inter = c->get_time_matrix()->operator()(min_a, max_b);
+
result = MscTimeIntervalSetD::set_intersection(hmsc_inter, bmsc_inter);
if(result.is_empty())
@@ -162,25 +178,14 @@
}
//set of the minimal events (in case more events, the algorithm is not able to decide the minimum one)
- std::set<Event*> min;
- min.insert(pos_min[0]);
+ std::set<Event*> result;
- //try to eliminate pos_min to one event
- for(unsigned int i = 0; i < pos_min.size(); i++)
- {
- switch (compare_absolut_position(c, (*min.begin()), pos_min[i]))
- {
- case 0: min.insert(pos_min[i]); break;
- case 1: break;
- case 2: update_minimum_set(c, min, pos_min[i]); break;
- default: throw std::runtime_error("Unexpected behaviour");
- }
- }
+ result = eliminate_posible_minimal(c, pos_min);
- if(min.size() != 1)
+ if(result.size() != 1)
return NULL;
else
- return *(min.begin());
+ return *(result.begin());
}
Event* get_max_event(MembershipContext* c, ReferenceNodePtr node, ConfigurationPtr conf)
@@ -227,29 +232,14 @@
}
//set of the maximal events (in case more events, the algorithm is not able to decide the maximum one)
- std::set<Event*> max;
+ std::set<Event*> result;
- if(pos_max.size() == 0)
- return NULL;
+ result = eliminate_posible_maximal(c, pos_max);
- max.insert(pos_max[0]);
-
- //try to eliminate pos_min to one event
- for(unsigned int i = 0; i < pos_max.size(); i++)
- {
- switch (compare_absolut_position(c, pos_max[i], (*max.begin())))
- {
- case 0: max.insert(pos_max[i]); break;
- case 1: break;
- case 2: update_maximum_set(c, max, pos_max[i]); break;
- default: throw std::runtime_error("Unexpected behaviour");
- }
- }
-
- if(max.size() != 1)
+ if(result.size() != 1)
return NULL;
else
- return *(max.begin());
+ return *(result.begin());
}
void update_maximum_set(MembershipContext* c, std::set<Event*>& max, Event* new_element)
@@ -300,10 +290,75 @@
min.insert(new_element);
}
+std::set<Event*> eliminate_posible_minimal(MembershipContext* c, std::vector<Event*> pos_min)
+{
+ std::set<Event*> min;
+
+ if(pos_min.size() == 0)
+ return min;
+
+ min.insert(pos_min[0]);
+
+ //try to eliminate pos_min to one event
+ for(unsigned int i = 0; i < pos_min.size(); i++)
+ {
+ switch (compare_absolut_position(c, (*min.begin()), pos_min[i]))
+ {
+ case 0: min.insert(pos_min[i]); break;
+ case 1: break;
+ case 2: update_minimum_set(c, min, pos_min[i]); break;
+ default: throw std::runtime_error("Unexpected behaviour");
+ }
+ }
+
+ return min;
+}
+
+std::set<Event*> eliminate_posible_maximal(MembershipContext* c, std::vector<Event*> pos_max)
+{
+ std::set<Event*> max;
+
+ if(pos_max.size() == 0)
+ return max;
+
+ max.insert(pos_max[0]);
+
+ //try to eliminate pos_min to one event
+ for(unsigned int i = 0; i < pos_max.size(); i++)
+ {
+ switch (compare_absolut_position(c, pos_max[i], (*max.begin())))
+ {
+ case 0: max.insert(pos_max[i]); break;
+ case 1: break;
+ case 2: update_maximum_set(c, max, pos_max[i]); break;
+ default: throw std::runtime_error("Unexpected behaviour");
+ }
+ }
+
+ return max;
+}
+
int compare_absolut_position(MembershipContext* c, Event* first, Event* second)
{
- MscTimeIntervalSetD inter = c->get_time_matrix()->operator()(first, second);
+//TODO There can be checking for first == second
+ MscTimeIntervalSetD inter;
+
+ //in case the absolut time constraints, it is necessary to compute interval
+//TODO event has not to have list of the absolut times just one time constraints
+ if(c->get_absolut_time())
+{
+ MscTimeIntervalSetD a = *(first->get_absolut_times().begin());
+ MscTimeIntervalSetD b = *(second->get_absolut_times().begin());
+
+ inter = get_continous_interval(c, a, b);
+// inter = get_continous_interval(c, *(first->get_absolut_times().begin()), *(second->get_absolut_times().begin()));
+std::cout << "time interval inter " << inter << std::endl;
+}
+ else
+ inter = c->get_time_matrix()->operator()(first, second);
+
+ //compute which event is before
const IntervalList intervals = inter.get_set();
bool positive = false;
bool negative = false;
@@ -345,7 +400,7 @@
return 3;
}
-bool compare_events_time_relations(MembershipContext* c, Event* node_a, Event* bmsc_a)
+bool compare_relative_time_constraints(MembershipContext* c, Event* node_a, Event* bmsc_a)
{
TimeRelationEventPtrList node_intervals = node_a->get_time_relations();
TimeRelationEventPtrList::iterator it;
@@ -357,6 +412,7 @@
{
bool time_node_b_id_set = true;
+//TODO i don't like it, probably better would be is_attribute_set or something similar
time_node_b_id = (*it)->get_event_b()->get_attribute("identification", -1, time_node_b_id_set);
if(time_node_b_id_set)
@@ -370,7 +426,16 @@
MscTimeIntervalSetD result, hmsc_inter, bmsc_inter;
hmsc_inter = (*it)->get_interval_set();
- bmsc_inter = c->get_time_matrix()->operator()(bmsc_a, bmsc_b);
+
+ if(c->get_absolut_time())
+ {
+ MscTimeIntervalSetD a = *(bmsc_a->get_absolut_times().begin());
+ MscTimeIntervalSetD b = *(bmsc_b->get_absolut_times().begin());
+ bmsc_inter = get_continous_interval(c, a, b);
+ }
+ else
+ bmsc_inter = c->get_time_matrix()->operator()(bmsc_a, bmsc_b);
+
result = MscTimeIntervalSetD::set_intersection(hmsc_inter, bmsc_inter);
if(result.is_empty())
@@ -484,7 +549,18 @@
MscTimeIntervalSetD bmsc_inter, result;
min_a = get_min_event(c, map_top_conf);
- bmsc_inter = c->get_time_matrix()->operator()(min_a, max_b);
+
+ if(c->get_absolut_time())
+ {
+ MscTimeIntervalSetD a = *(min_a->get_absolut_times().begin());
+ MscTimeIntervalSetD b = *(max_b->get_absolut_times().begin());
+//TODO to nemoze byt list intervalov v evente pri absolutnom case, to nedava zmysel
+std::cout << "see 2" << std::endl;
+ bmsc_inter = get_continous_interval(c, a, b);
+ }
+ else
+ bmsc_inter = c->get_time_matrix()->operator()(min_a, max_b);
+
result = MscTimeIntervalSetD::set_intersection(hmsc_inter, bmsc_inter);
if(result.is_empty())
@@ -501,7 +577,18 @@
MscTimeIntervalSetD bmsc_inter, result;
max_a = get_max_event(c, (*it_vec)->get_ref_node_a(), map_bottom_conf);
- bmsc_inter = c->get_time_matrix()->operator()(max_a, max_b);
+
+ if(c->get_absolut_time())
+ {
+ MscTimeIntervalSetD a = *(min_a->get_absolut_times().begin());
+ MscTimeIntervalSetD b = *(max_b->get_absolut_times().begin());
+//TODO to nemoze byt list intervalov v evente pri absolutnom case, to nedava zmysel
+std::cout << "see 3" << std::endl;
+ bmsc_inter = get_continous_interval(c, a, b);
+ }
+ else
+ bmsc_inter = c->get_time_matrix()->operator()(max_a, max_b);
+
result = MscTimeIntervalSetD::set_intersection(hmsc_inter, bmsc_inter);
if(result.is_empty())
@@ -535,7 +622,18 @@
MscTimeIntervalSetD result, bmsc_inter;
max_a = get_max_event(c, (*it_vec)->get_ref_node_a(), map_bottom_conf);
- bmsc_inter = c->get_time_matrix()->operator()(max_a, min_b);
+
+ if(c->get_absolut_time())
+ {
+ MscTimeIntervalSetD a = *(min_a->get_absolut_times().begin());
+ MscTimeIntervalSetD b = *(min_b->get_absolut_times().begin());
+//TODO to nemoze byt list intervalov v evente pri absolutnom case, to nedava zmysel
+std::cout << "see 4" << std::endl;
+ bmsc_inter = get_continous_interval(c, a, b);
+ }
+ else
+ bmsc_inter = c->get_time_matrix()->operator()(max_a, min_b);
+
result = MscTimeIntervalSetD::set_intersection(hmsc_inter, bmsc_inter);
if(result.is_empty())
@@ -565,3 +663,44 @@
return true;
}
+
+void analyze_time_constraints(MembershipContext* c, Event* b_e)
+{
+ if(b_e->get_absolut_times().size() > 0)
+ c->found_absolut_time();
+
+ if(b_e->get_time_relations().size() > 0)
+ c->found_relative_time();
+}
+
+MscTimeIntervalSetD get_continous_interval(MembershipContext* c, MscTimeIntervalSetD& a, MscTimeIntervalSetD& b)
+{
+ std::list< MscTimeInterval<double> > a_set = a.get_set();
+ std::list< MscTimeInterval<double> > b_set = b.get_set();
+
+ std::list< MscTimeInterval<double> >::iterator a_it, b_it;
+
+ MscTimeIntervalSet<double> new_set;
+ MscTimeInterval<double> new_interval;
+ MscIntervalCouple<double> start;
+ MscIntervalCouple<double> end;
+
+ for(a_it = a_set.begin(); a_it != a_set.end(); a_it++)
+ {
+ for(b_it = b_set.begin(); b_it != b_set.end(); b_it++)
+ {
+ //compute beginning of the interval
+ start = MscIntervalCouple<double> (b_it->get_begin().get_closed() && a_it->get_end().get_closed(),
+ b_it->get_begin().get_value() - a_it->get_end().get_value());
+
+ //compute ending of the interval
+ end = MscIntervalCouple<double> (b_it->get_end().get_closed() && a_it->get_begin().get_closed(),
+ b_it->get_end().get_value() - a_it->get_begin().get_value());
+
+ new_interval = MscTimeInterval<double>(start, end);
+ new_set = MscTimeIntervalSetD::set_union(new_set, new_interval);
+ }
+ }
+
+ return new_set;
+}
Modified: trunk/src/membership/membership_time.h
===================================================================
--- trunk/src/membership/membership_time.h 2010-10-05 12:29:14 UTC (rev 989)
+++ trunk/src/membership/membership_time.h 2010-10-10 22:38:19 UTC (rev 990)
@@ -30,7 +30,6 @@
//! finds the minimum event of HMSC node and returns time interval value of matching event in bMSC
Event* get_min_event(MembershipContext* c, ConfigurationPtr conf);
-
//! finds the maximum event of HMSC node and returns time interval value of matching event in bMSC
Event* get_max_event(MembershipContext* c, ReferenceNodePtr node, ConfigurationPtr conf);
@@ -40,6 +39,12 @@
//! compares each event from the set with new_elemetn and updates the set of minimal events (second parameter)
void update_minimum_set(MembershipContext* c, std::set<Event*>& min, Event* new_element);
+//! eliminates set of possible minimal events
+std::set<Event*> eliminate_posible_minimal(MembershipContext* c, std::vector<Event*> pos_min);
+
+//! eliminates set of possible maximal events
+std::set<Event*> eliminate_posible_maximal(MembershipContext* c, std::vector<Event*> pos_max);
+
/**
* \brief compares absolut position of two events
*
@@ -61,7 +66,7 @@
* a - HMSC node
* b - bMSC node
*/
-bool compare_events_time_relations(MembershipContext* c, Event* a, Event* b);
+bool compare_relative_time_constraints(MembershipContext* c, Event* a, Event* b);
//! returns matrix of time intervals among each nodes
BMscIntervalSetMatrix get_bmsc_matrix(BMscPtr bmsc_f);
@@ -80,4 +85,8 @@
//! checks top time relations
bool check_top_time_relations(MembershipContext* c, std::vector<TimeRelationRefNodePtr> top_vec, Event* min_b);
+//! checks relative and absolut time constraints
+void analyze_time_constraints(MembershipContext* c, Event* b_e);
+
+MscTimeIntervalSetD get_continous_interval(MembershipContext* c, MscTimeIntervalSetD& a, MscTimeIntervalSetD& b);
#endif
Modified: trunk/tests/membership/CMakeLists.txt
===================================================================
--- trunk/tests/membership/CMakeLists.txt 2010-10-05 12:29:14 UTC (rev 989)
+++ trunk/tests/membership/CMakeLists.txt 2010-10-10 22:38:19 UTC (rev 990)
@@ -267,5 +267,10 @@
#ADD_TEST(membership_test-118 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc32.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc32_2.mpr 0)
-ADD_TEST(membership_test-118 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_hmsc35.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc35.mpr 1)
+ADD_TEST(membership_test-119 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_hmsc35.mpr ${CMAKE_CURRENT_SOURCE_DIR}/test_bmsc35.mpr 1)
+ADD_TEST(membership_test-120 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/absolut_time_hmsc01.mpr ${CMAKE_CURRENT_SOURCE_DIR}/absolut_time_bmsc01.mpr 1)
+
+ADD_TEST(membership_test-121 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/absolut_time_hmsc02.mpr ${CMAKE_CURRENT_SOURCE_DIR}/absolut_time_bmsc02_1.mpr 1)
+
+ADD_TEST(membership_test-122 ${MEMBERSHIP_TEST_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/absolut_time_hmsc02.mpr ${CMAKE_CURRENT_SOURCE_DIR}/absolut_time_bmsc02_1.mpr 0)
Added: trunk/tests/membership/absolut_time_bmsc01.mpr
===================================================================
--- trunk/tests/membership/absolut_time_bmsc01.mpr (rev 0)
+++ trunk/tests/membership/absolut_time_bmsc01.mpr 2010-10-10 22:38:19 UTC (rev 990)
@@ -0,0 +1,12 @@
+msc bbb;
+inst A;
+inst B;
+A: instance;
+in no,0 from B;
+time [@4, @5];
+endinstance;
+B: instance;
+out no,0 to A;
+time [@2, @3];
+endinstance;
+endmsc;
Added: trunk/tests/membership/absolut_time_bmsc02_1.mpr
===================================================================
--- trunk/tests/membership/absolut_time_bmsc02_1.mpr (rev 0)
+++ trunk/tests/membership/absolut_time_bmsc02_1.mpr 2010-10-10 22:38:19 UTC (rev 990)
@@ -0,0 +1,12 @@
+msc bbb;
+inst A;
+inst B;
+A: instance;
+in no,0 from B;
+time [@4, @5];
+endinstance;
+B: instance;
+out no,0 to A;
+time @[3];
+endinstance;
+endmsc;
Added: trunk/tests/membership/absolut_time_bmsc02_2.mpr
===================================================================
--- trunk/tests/membership/absolut_time_bmsc02_2.mpr (rev 0)
+++ trunk/tests/membership/absolut_time_bmsc02_2.mpr 2010-10-10 22:38:19 UTC (rev 990)
@@ -0,0 +1,12 @@
+msc bbb;
+inst A;
+inst B;
+A: instance;
+in no,0 from B;
+time [@4, @5];
+endinstance;
+B: instance;
+out no,0 to A;
+time [@2, @3];
+endinstance;
+endmsc;
Added: trunk/tests/membership/absolut_time_hmsc01.mpr
===================================================================
--- trunk/tests/membership/absolut_time_hmsc01.mpr (rev 0)
+++ trunk/tests/membership/absolut_time_hmsc01.mpr 2010-10-10 22:38:19 UTC (rev 990)
@@ -0,0 +1,18 @@
+mscdocument Ola;
+msc iha;
+initial connect L1;
+L1: reference aaa time [1,4]; connect L2;
+L2: final;
+endmsc;
+
+msc aaa;
+inst A;
+inst B;
+A: instance;
+in no,0 from B;
+endinstance;
+B: instance;
+out no,0 to A;
+endinstance;
+endmsc;
+
Added: trunk/tests/membership/absolut_time_hmsc02.mpr
===================================================================
--- trunk/tests/membership/absolut_time_hmsc02.mpr (rev 0)
+++ trunk/tests/membership/absolut_time_hmsc02.mpr 2010-10-10 22:38:19 UTC (rev 990)
@@ -0,0 +1,19 @@
+mscdocument Ola;
+msc iha;
+initial connect L1;
+L1: reference aaa time [1,4]; connect L2;
+L2: final;
+endmsc;
+
+msc aaa;
+inst A;
+inst B;
+A: instance;
+in no,0 from B;
+endinstance;
+B: instance;
+out no,0 to A;
+time e1 [1,2];
+endinstance;
+endmsc;
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|