[Mobies-commit] [commit] r4288 - in UDM/trunk: . src/UdmUtil
endre at redhat3.isis.vanderbilt.edu
endre at redhat3.isis.vanderbilt.edu
Sun Apr 6 14:20:03 CDT 2014
Author: endre
Date: Sun Apr 6 14:20:03 2014
New Revision: 4288
Log:
JSON serialised (continued)
Added:
UDM/trunk/MACOS_build.txt
Modified:
UDM/trunk/Makefile.OSX.incl
UDM/trunk/src/UdmUtil/UdmUtil.cpp
Added: UDM/trunk/MACOS_build.txt
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ UDM/trunk/MACOS_build.txt Sun Apr 6 14:20:03 2014 (r4288)
@@ -0,0 +1,90 @@
+
+
+General notice:
+===============
+
+- Only 32 bit version of UDM can be compiled on MAC OS X because there is no Xerces 64bit binary available for this platform and the source will not compile with 64bit arhictecture
+- Autoconf/automake are not used; Makefile.OSX will build UDM on MAC OS X platforms after updating the paths in 'section to be configured by the user' in Makefile.OSX.incl. This is a more straightforward approach.
+- XCODE, including the command line tools has to be downloaded from the AppStore, it is freely available.
+- The build procedure was tested on:
+
+ OS X 10.9.1
+
+ uname:
+ 3.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64
+
+ CC --version:
+ Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
+ Target: x86_64-apple-darwin13.0.0
+ Thread model: posix
+
+JAVA 6
+======
+
+OS X 10.9.1 comes with Java 1.7.0-45, which can not run a 32 bit JVM
+Therefore, Java 1.6.0 for MAC OS has to be downloaded from here:
+
+http://support.apple.com/downloads/DL1572/en_US/JavaForOSX2013-05.dmg
+
+open in Finder, double click and install it.
+This should install Java 1.6.0 JVM in: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java
+
+Check and if necessary edit the value of JVMD32 in Makefile.OSX.incl located in the top directory of UDM
+
+ANT
+===
+
+Apache ANT is used for build the Java wrapper of UDM
+
+1. Obtain apache-ant-1.9.3-bin.tar.bz2 from http://www.apache.org/dist/ant/binaries/apache-ant-1.9.3-bin.tar.bz2
+2. Untar it in a directory where developer tools are (for instance: ~/devtools)
+3. Set/change the value of ANT to the directory of ANT binary, located in top directory of UDM (example: ~/devtools/apache-ant-1.9.3/bin/ant)
+
+JUNIT
+=====
+
+JUNIT is used for testing the Java wrapper of UDM
+1. Obtain junit-4.11.jar from http://search.maven.org/remotecontent?filepath=junit/junit/4.11/junit-4.11.jar
+2. Obtain junit-4.11-javadoc.jar from http://search.maven.org/remotecontent?filepath=junit/junit/4.11/junit-4.11-javadoc.jar
+2. Create a junit/ directory where developer tools are (for instance: ~/devtools) and copy the above two files in this directory
+3. Set/change the value of JUNITDIR to the directory of JUNIT, located in top directory of UDM (example: ~/devtools/junit)
+
+CPPUNIT
+=======
+
+1. Obtain cppunit-1.12.1.tar from: http://sourceforge.net/projects/cppunit/files/cppunit/1.12.1/cppunit-1.12.1.tar.gz/download?use_mirror=netcologne
+2. Untar it in a directory where developer tools are (for instance: ~/devtools) and compile using the below commands:
+
+cd cppunit-1.12.1;
+export CFLAGS="-g -O2 -arch i386"
+export CXXFLAGS="$CFLAGS"
+./configure
+make
+3. Set/change the value of CPPUNIT to the directory of CPPUNIT in Makefile.OSX.incl located in top directory of UDM (example:~/devtools/cppunit-1.12.1)
+
+BOOST
+=====
+
+1. Obtain boost_1_55_0.tar.gz from http://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.gz/download
+2. Untar it in a directory where developer tools are (for instance: ~/devtools).
+3. Most of the boost libraries are header only libraries, however we do need boost_python binary module which needs to be compiled.
+ 3.1 build bjam (a tool which is needed to build boost)
+
+ cd boost_1_55_0/tools/build/v2/engine
+ export CFLAGS="-g -O2 -arch i386"
+ export CXXFLAGS="$CFLAGS"
+ ./build.sh cc
+ 3.2 build boost (will be needed for UdmPython). If the Python wrapper for UDM will not be used, you can skip this section
+ cd boost_1_55_0/
+ /tools/build/v2/engine/bin.macosxx86/bjam -sBUILD=release cxxflags="-g -O2 -arch i386" cflags="-g -O2 -arch i386" linkflags="-arch i386"
+
+
+4. If build.sh will report 'operation not permitted', than the file was quarantined by Mac OS because it was downloaded from the internet. You can solve this by issuing xattr -dr com.apple.quarantine . in that directory.
+5. Set/change the value of BOOST to the directory of BOOST in Makefile.OSX.incl located in top directory of UDM (example:~/devtools/boost_1_55_0)
+
+JSON_SPIRIT
+===========
+
+1. Download Json Spirit from: http://www.codeproject.com/Articles/20027/JSON-Spirit-A-C-JSON-Parser-Generator-Implemented
+2. copy the directory json_spirit_v4.06 to a directory where developer tools are (for instance ~/devtools)
+3. set/change the value of JSON_SPIRIT to the directory of json_spirit_v4.06/json_spirit in Makefile.OSX.incl located in top directory of UDM (example: ~/devtools/json_spirit_v4.06/json_spirit)
Modified: UDM/trunk/Makefile.OSX.incl
==============================================================================
--- UDM/trunk/Makefile.OSX.incl Fri Apr 4 15:17:55 2014 (r4287)
+++ UDM/trunk/Makefile.OSX.incl Sun Apr 6 14:20:03 2014 (r4288)
@@ -48,6 +48,7 @@
#JAVA 1.6.0 is needed in order to have a JVM which is capable to load 32bit shared libraries (UdmSwig) (-d32 flag)
#UdmSwig is a shared library compiled with i386
JVMD32=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java
+JSON_SPIRIT=~/devtools/json_spirit_v4.06/json_spirit
#####################################################
# variables and paths needed by the build process #
@@ -63,4 +64,4 @@
DYLDLIBRARYPATH=$(UDMHOME)/lib:$(XERCESCROOT)/lib:$(XALANCROOT)/lib:$(PCRE)/.libs:$(CPPUNITLIBS):$(LIBBOOST_PYTHON_DIR)
SWIGLIB=$(SWIGDIR)/lib
SWIG=$(SWIGDIR)/swig
-INCLUDE=-I $(UDMHOME)/include -I $(UDMHOME)/src -I $(UDMHOME)/src/UdmOclPat/GOCL/Include/ -I $(MINIZIP) -I $(XERCES)/include -I $(BOOST) -I $(XERCESCROOT)/include -I $(XALANCROOT)/src -I $(XALANCROOT)/nls/include
+INCLUDE=-I $(UDMHOME)/include -I $(UDMHOME)/src -I $(UDMHOME)/src/UdmOclPat/GOCL/Include/ -I $(MINIZIP) -I $(XERCES)/include -I $(BOOST) -I $(XERCESCROOT)/include -I $(XALANCROOT)/src -I $(XALANCROOT)/nls/include -I $(JSON_SPIRIT)
Modified: UDM/trunk/src/UdmUtil/UdmUtil.cpp
==============================================================================
--- UDM/trunk/src/UdmUtil/UdmUtil.cpp Fri Apr 4 15:17:55 2014 (r4287)
+++ UDM/trunk/src/UdmUtil/UdmUtil.cpp Sun Apr 6 14:20:03 2014 (r4288)
@@ -1311,18 +1311,19 @@
}
- UDM_DLL json_spirit::Object DiagramToPtree( const ::Udm::Object& obj, bool child_attr_subtree = false);
- UDM_DLL json_spirit::Object DiagramToPtree( const ::Udm::Object& obj, bool child_attr_subtree)
+ UDM_DLL json_spirit::Object DiagramToPtree( const ::Udm::Object& obj, const ::Uml::CompositionChildRole& contained_via_role = &Udm::_null );
+
+ UDM_DLL json_spirit::Object DiagramToPtree( const ::Udm::Object& obj, const ::Uml::CompositionChildRole& contained_via_role)
{
- json_spirit::Object pt, pt_attributes, pt_children;
+ json_spirit::Object pt;
const Udm::ObjectImpl * obj_impl = obj.__impl();
::Udm::ObjectImpl::uniqueId_type id = obj_impl->uniqueId();
to_string< ::Udm::ObjectImpl::uniqueId_type> key = to_string< ::Udm::ObjectImpl::uniqueId_type>(id);
- pt.push_back(json_spirit::Pair ( "_id:", id));
- pt.push_back(json_spirit::Pair( "_type:", (string)(obj.__impl()->type().name() )));
+ pt.push_back(json_spirit::Pair ( "_id:", (__int64 ) id));
+ if (contained_via_role) pt.push_back(json_spirit::Pair( "_childrole:", (string)(contained_via_role.name() )));
set < ::Uml::Attribute> attributes = AncestorAttributes(obj.type());
@@ -1335,14 +1336,10 @@
{
::Uml::Attribute attr = *attr_i;
- if(child_attr_subtree)
- pt_attributes.push_back( AttrToJSPair(obj, attr));
- else
- pt.push_back(AttrToJSPair(obj, attr));
+ pt.push_back(AttrToJSPair(obj, attr));
}
- if (child_attr_subtree) pt.push_back(json_spirit::Pair("_attributes", pt_attributes));
}
@@ -1360,17 +1357,11 @@
for(vector<ObjectImpl*>::iterator p_currImpl=children.begin(); p_currImpl!=children.end();p_currImpl++)
{
Object child= *p_currImpl; //source child
-
- if (child_attr_subtree)
- pt_children.push_back(json_spirit::Pair((string)(o_role.name()), DiagramToPtree(child)));
- else
- pt.push_back(json_spirit::Pair((string)(o_role.name()), DiagramToPtree(child)));
+ pt.push_back(json_spirit::Pair((string)(child.__impl()->type().name()), DiagramToPtree(child, o_role)));
}
- if (child_attr_subtree)
- pt.push_back(json_spirit::Pair("_children", pt_children));
-
+
}
}
@@ -1384,7 +1375,7 @@
unsigned int options = json_spirit::pretty_print | json_spirit::remove_trailing_zeros | json_spirit::single_line_arrays;
ofstream os(FileName.c_str());
- json_spirit::write_stream( json_spirit::Value(DiagramToPtree(obj,child_attr_subtree)) , os, options);
+ json_spirit::write_stream( json_spirit::Value(DiagramToPtree(obj)) , os, options);
}
};
More information about the Mobies-commit
mailing list