|
From: <ma...@us...> - 2012-09-06 08:47:12
|
Revision: 1463
http://scstudio.svn.sourceforge.net/scstudio/?rev=1463&view=rev
Author: madzin
Date: 2012-09-06 08:47:06 +0000 (Thu, 06 Sep 2012)
Log Message:
-----------
Add module and test environment for time relevant environment
Modified Paths:
--------------
trunk/src/data/CMakeLists.txt
trunk/tests/CMakeLists.txt
Added Paths:
-----------
trunk/src/data/time_relevant_ordering/
trunk/src/data/time_relevant_ordering/CMakeLists.txt
trunk/src/data/time_relevant_ordering/export.h
trunk/src/data/time_relevant_ordering/module.cpp
trunk/src/data/time_relevant_ordering/time_relevant_ordering.cpp
trunk/src/data/time_relevant_ordering/time_relevant_ordering.h
trunk/tests/time_relevant_ordering/
trunk/tests/time_relevant_ordering/CMakeLists.txt
trunk/tests/time_relevant_ordering/time_relevant_ordering_test.cpp
Modified: trunk/src/data/CMakeLists.txt
===================================================================
--- trunk/src/data/CMakeLists.txt 2012-09-06 08:46:40 UTC (rev 1462)
+++ trunk/src/data/CMakeLists.txt 2012-09-06 08:47:06 UTC (rev 1463)
@@ -50,6 +50,7 @@
ADD_SUBDIRECTORY(exporttex)
# build transformers
ADD_SUBDIRECTORY(beautify)
+ADD_SUBDIRECTORY(time_relevant_ordering)
OPTION(BUILD_PCAP "Enable to build the PCAP import module" OFF)
IF(BUILD_PCAP)
Added: trunk/src/data/time_relevant_ordering/CMakeLists.txt
===================================================================
--- trunk/src/data/time_relevant_ordering/CMakeLists.txt (rev 0)
+++ trunk/src/data/time_relevant_ordering/CMakeLists.txt 2012-09-06 08:47:06 UTC (rev 1463)
@@ -0,0 +1,12 @@
+ADD_LIBRARY(sctimerelevantordering SHARED
+ export.h
+ module.cpp
+ time_relevant_ordering.h
+ time_relevant_ordering.cpp
+)
+
+TARGET_LINK_LIBRARIES(sctimerelevantordering
+ scmsc
+)
+
+# $Id: CMakeLists.txt 1351 2012-03-21 13:54:31Z lkorenciak $
Added: trunk/src/data/time_relevant_ordering/export.h
===================================================================
--- trunk/src/data/time_relevant_ordering/export.h (rev 0)
+++ trunk/src/data/time_relevant_ordering/export.h 2012-09-06 08:47:06 UTC (rev 1463)
@@ -0,0 +1,37 @@
+/*
+ * 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) 2008 Petr Gotthard <pet...@ce...>
+ *
+ * $Id$
+ */
+
+#ifndef _TIMERELEVANTORDERING_EXPORT_H
+#define _TIMERELEVANTORDERING_EXPORT_H
+
+#if defined(_MSC_VER)
+#pragma warning(disable: 4251)
+
+#if defined(scbeautify_EXPORTS)
+#define SCTIMERELEVANTORDERING_EXPORT __declspec(dllexport)
+#else
+#define SCTIMERELEVANTORDERING_EXPORT __declspec(dllimport)
+#endif
+
+#else
+#define SCTIMERELEVANTORDERING_EXPORT
+#endif
+
+#endif /* _TIMERELEVANTORDERING_EXPORT_H */
+
+// $Id$
Property changes on: trunk/src/data/time_relevant_ordering/export.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/src/data/time_relevant_ordering/module.cpp
===================================================================
--- trunk/src/data/time_relevant_ordering/module.cpp (rev 0)
+++ trunk/src/data/time_relevant_ordering/module.cpp 2012-09-06 08:47:06 UTC (rev 1463)
@@ -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) 2009 Petr Gotthard <pet...@ce...>
+ *
+ * $Id: module.cpp 438 2009-10-25 15:32:55Z gotthardp $
+ */
+
+#include "time_relevant_ordering.h"
+
+// module initialization function
+// note: the Visio add-on searches for a function of this name
+extern "C" SCTIMERELEVANTORDERING_EXPORT
+Transformer** init_transformers()
+{
+ Transformer **result = new Transformer* [2];
+ result[0] = new TimeRelevantOrdering();
+ result[1] = NULL;
+
+ return result;
+}
+
Property changes on: trunk/src/data/time_relevant_ordering/module.cpp
___________________________________________________________________
Added: svn:keywords
+ Id,svn:eol-style=native
Added: trunk/src/data/time_relevant_ordering/time_relevant_ordering.cpp
===================================================================
--- trunk/src/data/time_relevant_ordering/time_relevant_ordering.cpp (rev 0)
+++ trunk/src/data/time_relevant_ordering/time_relevant_ordering.cpp 2012-09-06 08:47:06 UTC (rev 1463)
@@ -0,0 +1,37 @@
+/*
+ * 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) 2009 Petr Gotthard <pet...@ce...>
+ *
+ * $Id: beautify.cpp 1399 2012-06-01 08:33:10Z xmalota $
+ */
+
+#include "data/time_relevant_ordering/time_relevant_ordering.h"
+
+TimeRelevantOrdering::TimeRelevantOrdering()
+{
+}
+
+Transformer::PreconditionList TimeRelevantOrdering::get_preconditions(MscPtr msc) const
+{
+ Transformer::PreconditionList result;
+ // no preconditions
+ return result;
+}
+
+//! Transform a MSC drawing.
+MscPtr TimeRelevantOrdering::transform(MscPtr msc)
+{
+std::cerr << "Success: The Time Relevant Ordering's method \"transform\" invoked this message." << std::endl;
+ return msc; // success
+}
Property changes on: trunk/src/data/time_relevant_ordering/time_relevant_ordering.cpp
___________________________________________________________________
Added: svn:keywords
+ Id,svn:eol-style=native
Added: trunk/src/data/time_relevant_ordering/time_relevant_ordering.h
===================================================================
--- trunk/src/data/time_relevant_ordering/time_relevant_ordering.h (rev 0)
+++ trunk/src/data/time_relevant_ordering/time_relevant_ordering.h 2012-09-06 08:47:06 UTC (rev 1463)
@@ -0,0 +1,46 @@
+/*
+ * 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) 2009 Petr Gotthard <pet...@ce...>
+ *
+ * $Id$
+ */
+
+#ifndef _TIME_RELEVANT_ORDERING_H
+#define _TIME_RELEVANT_ORDERING_H
+
+
+#include "data/msc.h"
+#include "data/transformer.h"
+#include "export.h"
+
+
+class SCTIMERELEVANTORDERING_EXPORT TimeRelevantOrdering : public Transformer
+{
+public:
+ TimeRelevantOrdering();
+ virtual ~TimeRelevantOrdering(){}
+
+ //! Human readable name of the transformation.
+ virtual std::wstring get_name() const
+ { return L"Time Relevant Ordering"; }
+
+ //! Returns a list of preconditions for this transformation.
+ virtual PreconditionList get_preconditions(MscPtr msc) const;
+
+ //! Transform a MSC drawing.
+ virtual MscPtr transform(MscPtr msc);
+};
+
+#endif
+
Property changes on: trunk/src/data/time_relevant_ordering/time_relevant_ordering.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/tests/CMakeLists.txt
===================================================================
--- trunk/tests/CMakeLists.txt 2012-09-06 08:46:40 UTC (rev 1462)
+++ trunk/tests/CMakeLists.txt 2012-09-06 08:47:06 UTC (rev 1463)
@@ -111,6 +111,7 @@
ENDMACRO(ADD_Z120_TEST)
ADD_SUBDIRECTORY(z120_test)
+ADD_SUBDIRECTORY(time_relevant_ordering)
SET(MSCGEN_SEQUENCE 0)
MACRO(ADD_MSCGEN_TEST FILE SATISFIED)
Added: trunk/tests/time_relevant_ordering/CMakeLists.txt
===================================================================
--- trunk/tests/time_relevant_ordering/CMakeLists.txt (rev 0)
+++ trunk/tests/time_relevant_ordering/CMakeLists.txt 2012-09-06 08:47:06 UTC (rev 1463)
@@ -0,0 +1,11 @@
+FIND_PACKAGE(PythonInterp REQUIRED)
+
+ADD_EXECUTABLE(time_relevant_ordering_test
+ time_relevant_ordering_test.cpp
+)
+TARGET_LINK_LIBRARIES(time_relevant_ordering_test
+ sctimerelevantordering
+ scZ120
+)
+
+# $Id: CMakeLists.txt 1439 2012-07-08 21:36:59Z madzin $
Added: trunk/tests/time_relevant_ordering/time_relevant_ordering_test.cpp
===================================================================
--- trunk/tests/time_relevant_ordering/time_relevant_ordering_test.cpp (rev 0)
+++ trunk/tests/time_relevant_ordering/time_relevant_ordering_test.cpp 2012-09-06 08:47:06 UTC (rev 1463)
@@ -0,0 +1,85 @@
+/*
+ * 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) 2009 Petr Gotthard <pet...@ce...>
+ *
+ * $Id: z120_test.cpp 1274 2012-01-10 15:49:30Z lkorenciak $
+ */
+
+#include <string.h>
+#include <iostream>
+
+#include "data/Z120/z120.h"
+#include "data/time_relevant_ordering/time_relevant_ordering.h"
+
+char* extract_filename(char* filename)
+{
+ char *last_name = filename;
+ char *last_dot = NULL;
+
+ for(char *pos = filename; *pos != '\0'; pos++)
+ {
+ if(*pos == '.')
+ last_dot = pos;
+ else if(*pos == '\\' || *pos == '/')
+ last_name = pos+1;
+ }
+
+ if(last_dot != NULL)
+ *last_dot = '\0'; // strip the extension
+
+ return last_name;
+}
+
+int main(int argc, char** argv)
+{
+ if(argc < 2)
+ {
+ std::wcerr << "Usage: " << argv[0] << " <filename>" << std::endl;
+ return 1;
+ }
+
+ Z120 z120;
+
+ StreamReportPrinter printer(std::wcerr);
+ z120.set_printer(&printer);
+
+ char *path = strdup(argv[1]);
+ char *filename = extract_filename(path);
+
+ std::vector<MscPtr> msc = z120.load_msc(argv[1]);
+
+ if(msc.empty())
+ {
+ std::wcerr << "Parser ERROR: \"" << filename << "\" was not corectly recognized" << std::endl;
+ return 1;
+ }
+
+ TimeRelevantOrdering tr_ordering;
+ msc[0] = tr_ordering.transform(msc[0]);
+
+ try
+ {
+ z120.save_msc(std::cout, TOWSTRING(filename), msc[0], msc);
+ }
+ catch(std::exception& exc)
+ {
+ std::wcerr << "EXCEPTION: Cannot save the document: " << exc.what() << std::endl;
+ return 1;
+ }
+
+ free(path);
+ return 0;
+}
+
+// $Id: z120_test.cpp 1274 2012-01-10 15:49:30Z lkorenciak $
Property changes on: trunk/tests/time_relevant_ordering/time_relevant_ordering_test.cpp
___________________________________________________________________
Added: svn:keywords
+ Id,svn:eol-style=native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|