[Mobies-commit] [commit] r3789 - in UDM/trunk: Projects/Win32/VC10/src/UdmCliSwig include src/UdmCliSwig
ksmyth at redhat1.isis.vanderbilt.edu
ksmyth at redhat1.isis.vanderbilt.edu
Thu Jul 14 09:48:31 CDT 2011
Author: ksmyth
Date: Thu Jul 14 09:48:31 2011
New Revision: 3789
Log:
Move UdmCliSwig files
Added:
UDM/trunk/src/UdmCliSwig/
UDM/trunk/src/UdmCliSwig/Udm.i
- copied, changed from r3786, UDM/trunk/include/Udm.i
UDM/trunk/src/UdmCliSwig/UdmCli.i
- copied unchanged from r3786, UDM/trunk/include/UdmCli.i
UDM/trunk/src/UdmCliSwig/UdmDom.i
- copied unchanged from r3786, UDM/trunk/include/UdmDom.i
UDM/trunk/src/UdmCliSwig/UdmException.i
- copied unchanged from r3786, UDM/trunk/include/UdmException.i
UDM/trunk/src/UdmCliSwig/UdmGme.i
- copied unchanged from r3786, UDM/trunk/include/UdmGme.i
UDM/trunk/src/UdmCliSwig/UdmStatic.i
- copied unchanged from r3786, UDM/trunk/include/UdmStatic.i
UDM/trunk/src/UdmCliSwig/Uml.i
- copied unchanged from r3786, UDM/trunk/include/Uml.i
UDM/trunk/src/UdmCliSwig/csharp_std_set.i
- copied unchanged from r3786, UDM/trunk/include/csharp_std_set.i
Deleted:
UDM/trunk/include/Udm.i
UDM/trunk/include/UdmCli.i
UDM/trunk/include/UdmDom.i
UDM/trunk/include/UdmException.i
UDM/trunk/include/UdmGme.i
UDM/trunk/include/UdmStatic.i
UDM/trunk/include/Uml.i
UDM/trunk/include/csharp_std_set.i
Modified:
UDM/trunk/Projects/Win32/VC10/src/UdmCliSwig/UdmCliSwig.vcxproj
UDM/trunk/Projects/Win32/VC10/src/UdmCliSwig/UdmCliSwig.vcxproj.filters
Modified: UDM/trunk/Projects/Win32/VC10/src/UdmCliSwig/UdmCliSwig.vcxproj
==============================================================================
--- UDM/trunk/Projects/Win32/VC10/src/UdmCliSwig/UdmCliSwig.vcxproj Wed Jul 13 12:13:56 2011 (r3788)
+++ UDM/trunk/Projects/Win32/VC10/src/UdmCliSwig/UdmCliSwig.vcxproj Thu Jul 14 09:48:31 2011 (r3789)
@@ -71,7 +71,7 @@
<ItemGroup>
</ItemGroup>
<ItemGroup>
- <CustomBuild Include="..\..\..\..\..\include\Udm.i">
+ <CustomBuild Include="..\..\..\..\..\src\UdmCliSwig\Udm.i">
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">swig %(Filename)%(Extension)</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">swig %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">mkdir "$(CliBridgeCppDir)"
@@ -83,6 +83,7 @@
-namespace "Udm.Native" ^
-dllimport "$(UdmCliBridgeDll)" ^
-outdir "$(CliBridgeCsDir)\%(Filename)" ^
+-I"$(UDM_PATH)"\include ^
-c++ ^
-o "%(Filename)"_wrap.cpp ^
"%(FullPath)"
@@ -96,6 +97,7 @@
-namespace "Udm.Native" ^
-dllimport "$(UdmCliBridgeDll)" ^
-outdir "$(CliBridgeCsDir)\%(Filename)" ^
+-I"$(UDM_PATH)"\include ^
-c++ ^
-o "%(Filename)"_wrap.cpp ^
"%(FullPath)"
@@ -108,8 +110,8 @@
<CustomBuild Include="$(CliBridgeCsDir)\UdmGme\UdmGme.cs" />
<CustomBuild Include="$(CliBridgeCsDir)\UdmDom\UdmDom.cs" />
<CustomBuild Include="$(CliBridgeCsDir)\UdmStatic\UdmStatic.cs" />
- <None Include="..\..\..\..\..\include\UdmCli.i" />
- <CustomBuild Include="..\..\..\..\..\include\UdmDom.i">
+ <None Include="..\..\..\..\..\src\UdmCliSwig\UdmCli.i" />
+ <CustomBuild Include="..\..\..\..\..\src\UdmCliSwig\UdmDom.i">
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">swig %(Filename)%(Extension)</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">swig %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">mkdir "$(CliBridgeCppDir)"
@@ -121,6 +123,7 @@
-namespace "Udm.Native.%(Filename)" ^
-dllimport "$(UdmCliBridgeDll)" ^
-outdir "$(CliBridgeCsDir)\%(Filename)" ^
+-I"$(UDM_PATH)"\include ^
-c++ ^
-o "%(Filename)"_wrap.cpp ^
"%(FullPath)"
@@ -134,6 +137,7 @@
-namespace "Udm.Native.%(Filename)" ^
-dllimport "$(UdmCliBridgeDll)" ^
-outdir "$(CliBridgeCsDir)\%(Filename)" ^
+-I"$(UDM_PATH)"\include ^
-c++ ^
-o "%(Filename)"_wrap.cpp ^
"%(FullPath)"
@@ -141,8 +145,8 @@
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(CliBridgeCppDir)\%(Filename)_wrap.cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(CliBridgeCppDir)\%(Filename)_wrap.cpp;%(Outputs)</Outputs>
</CustomBuild>
- <None Include="..\..\..\..\..\include\UdmException.i" />
- <CustomBuild Include="..\..\..\..\..\include\UdmGme.i">
+ <None Include="..\..\..\..\..\src\UdmCliSwig\UdmException.i" />
+ <CustomBuild Include="..\..\..\..\..\src\UdmCliSwig\UdmGme.i">
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">swig %(Filename)%(Extension)</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">swig %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">mkdir "$(CliBridgeCppDir)"
@@ -154,6 +158,7 @@
-namespace "Udm.Native.%(Filename)" ^
-dllimport "$(UdmCliBridgeDll)" ^
-outdir "$(CliBridgeCsDir)\%(Filename)" ^
+-I"$(UDM_PATH)"\include ^
-c++ ^
-o "%(Filename)"_wrap.cpp ^
"%(FullPath)"
@@ -167,6 +172,7 @@
-namespace "Udm.Native.%(Filename)" ^
-dllimport "$(UdmCliBridgeDll)" ^
-outdir "$(CliBridgeCsDir)\%(Filename)" ^
+-I"$(UDM_PATH)"\include ^
-c++ ^
-o "%(Filename)"_wrap.cpp ^
"%(FullPath)"
@@ -174,7 +180,7 @@
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(CliBridgeCppDir)\%(Filename)_wrap.cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(CliBridgeCppDir)\%(Filename)_wrap.cpp;%(Outputs)</Outputs>
</CustomBuild>
- <CustomBuild Include="..\..\..\..\..\include\UdmStatic.i">
+ <CustomBuild Include="..\..\..\..\..\src\UdmCliSwig\UdmStatic.i">
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">swig %(Filename)%(Extension)</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">swig %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">mkdir "$(CliBridgeCppDir)"
@@ -186,6 +192,7 @@
-namespace "Udm.Native.%(Filename)" ^
-dllimport "$(UdmCliBridgeDll)" ^
-outdir "$(CliBridgeCsDir)\%(Filename)" ^
+-I"$(UDM_PATH)"\include ^
-c++ ^
-o "%(Filename)"_wrap.cpp ^
"%(FullPath)"
@@ -199,6 +206,7 @@
-namespace "Udm.Native.%(Filename)" ^
-dllimport "$(UdmCliBridgeDll)" ^
-outdir "$(CliBridgeCsDir)\%(Filename)" ^
+-I"$(UDM_PATH)"\include ^
-c++ ^
-o "%(Filename)"_wrap.cpp ^
"%(FullPath)"
@@ -206,7 +214,7 @@
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(CliBridgeCppDir)\%(Filename)_wrap.cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(CliBridgeCppDir)\%(Filename)_wrap.cpp;%(Outputs)</Outputs>
</CustomBuild>
- <CustomBuild Include="..\..\..\..\..\include\Uml.i">
+ <CustomBuild Include="..\..\..\..\..\src\UdmCliSwig\Uml.i">
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">swig %(Filename)%(Extension)</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">swig %(Filename)%(Extension)</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">mkdir "$(CliBridgeCppDir)"
@@ -218,6 +226,7 @@
-namespace "Udm.Native.%(Filename)" ^
-dllimport "$(UdmCliBridgeDll)" ^
-outdir "$(CliBridgeCsDir)\%(Filename)" ^
+-I"$(UDM_PATH)"\include ^
-c++ ^
-o "%(Filename)"_wrap.cpp ^
"%(FullPath)"
@@ -231,6 +240,7 @@
-namespace "Udm.Native.%(Filename)" ^
-dllimport "$(UdmCliBridgeDll)" ^
-outdir "$(CliBridgeCsDir)\%(Filename)" ^
+-I"$(UDM_PATH)"\include ^
-c++ ^
-o "%(Filename)"_wrap.cpp ^
"%(FullPath)"
Modified: UDM/trunk/Projects/Win32/VC10/src/UdmCliSwig/UdmCliSwig.vcxproj.filters
==============================================================================
--- UDM/trunk/Projects/Win32/VC10/src/UdmCliSwig/UdmCliSwig.vcxproj.filters Wed Jul 13 12:13:56 2011 (r3788)
+++ UDM/trunk/Projects/Win32/VC10/src/UdmCliSwig/UdmCliSwig.vcxproj.filters Thu Jul 14 09:48:31 2011 (r3789)
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
- <None Include="..\..\..\..\..\include\UdmCli.i" />
- <None Include="..\..\..\..\..\include\UdmException.i" />
+ <None Include="..\..\..\..\..\src\UdmCliSwig\UdmCli.i" />
+ <None Include="..\..\..\..\..\src\UdmCliSwig\UdmException.i" />
</ItemGroup>
<ItemGroup>
- <CustomBuild Include="..\..\..\..\..\include\Udm.i" />
- <CustomBuild Include="..\..\..\..\..\include\UdmDom.i" />
- <CustomBuild Include="..\..\..\..\..\include\UdmGme.i" />
- <CustomBuild Include="..\..\..\..\..\include\UdmStatic.i" />
- <CustomBuild Include="..\..\..\..\..\include\Uml.i" />
+ <CustomBuild Include="..\..\..\..\..\src\UdmCliSwig\Udm.i" />
+ <CustomBuild Include="..\..\..\..\..\src\UdmCliSwig\UdmDom.i" />
+ <CustomBuild Include="..\..\..\..\..\src\UdmCliSwig\UdmGme.i" />
+ <CustomBuild Include="..\..\..\..\..\src\UdmCliSwig\UdmStatic.i" />
+ <CustomBuild Include="..\..\..\..\..\src\UdmCliSwig\Uml.i" />
<CustomBuild Include="$(CliBridgeCsDir)\Udm\Udm.cs" />
<CustomBuild Include="$(CliBridgeCsDir)\Uml\Uml.cs" />
<CustomBuild Include="$(CliBridgeCsDir)\UdmGme\UdmGme.cs" />
Copied and modified: UDM/trunk/src/UdmCliSwig/Udm.i (from r3786, UDM/trunk/include/Udm.i)
==============================================================================
--- UDM/trunk/include/Udm.i Wed Jul 13 11:50:56 2011 (r3786, copy source)
+++ UDM/trunk/src/UdmCliSwig/Udm.i Thu Jul 14 09:48:31 2011 (r3789)
@@ -122,6 +122,9 @@
%ignore UDM_NAMESPACE::UdmProject::GetPlaceHolder;
%ignore UDM_NAMESPACE::NullObject::e;
+%ignore UdmUtil::stacktrace;
+%ignore UDM_NAMESPACE::ObjectImpl::getPath;
+
// Defined in Uml.i
%ignore Uml::IsDerivedFrom;
@@ -300,5 +303,15 @@
}
}
+// FIXM: KMS: this should be moved into UdmUtil.h
+static int CopyObjectHierarchy(Udm::Object srcRoot, Udm::Object dstRoot) {
+ return UdmUtil::CopyObjectHierarchy(srcRoot.__impl(), dstRoot.__impl(), dstRoot.__impl()->__getdn(), copy_assoc_map());
+}
+%{
+static int CopyObjectHierarchy(Udm::Object srcRoot, Udm::Object dstRoot) {
+ return UdmUtil::CopyObjectHierarchy(srcRoot.__impl(), dstRoot.__impl(), dstRoot.__impl()->__getdn(), copy_assoc_map());
+}
+%}
+
%import "Uml.i"
Copied: UDM/trunk/src/UdmCliSwig/UdmCli.i (from r3786, UDM/trunk/include/UdmCli.i)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ UDM/trunk/src/UdmCliSwig/UdmCli.i Thu Jul 14 09:48:31 2011 (r3789, copy of r3786, UDM/trunk/include/UdmCli.i)
@@ -0,0 +1,48 @@
+
+%include "UdmException.i"
+%import "Udm.i"
+%import "Uml.i"
+%include "std_vector.i"
+%include "csharp_std_set.i"
+
+%pragma(csharp) imclassimports=%{
+
+using System;
+using System.Runtime.InteropServices;
+
+using UdmException = global::Udm.Native.UdmException;
+using Attribute = global::Udm.Native.Uml.Attribute;
+%}
+
+
+%typemap(csimports) SWIGTYPE
+%{
+using System;
+using System.Runtime.InteropServices;
+
+using global::Udm.Native;
+%}
+
+
+%{
+#include <algorithm>
+%}
+
+%define %udm_class(Namespace, Class)
+ %template(Class ## _ArchetypeAttr) UDM_NAMESPACE::ArchetypeAttr<Namespace::Class>;
+ %template(Class ## _AssocAttr) UDM_NAMESPACE::AssocAttr<Namespace::Class>;
+ %template(Class ## _AssocEndAttr) UDM_NAMESPACE::AssocEndAttr<Namespace::Class>;
+ %template(Class ## _CrossAssocAttr) UDM_NAMESPACE::CrossAssocAttr<Namespace::Class>;
+ %template(Class ## _ChildAttr) UDM_NAMESPACE::ChildAttr<Namespace::Class>;
+ %template(Class ## _ChildrenAttr) UDM_NAMESPACE::ChildrenAttr<Namespace::Class>;
+ %template(Class ## _DerivedAttr) UDM_NAMESPACE::DerivedAttr<Namespace::Class>;
+ %template(Class ## _InstantiatedAttr) UDM_NAMESPACE::InstantiatedAttr<Namespace::Class>;
+ %template(Class ## _ParentAttr) UDM_NAMESPACE::ParentAttr<Namespace::Class>;
+ %template(Class ## _PointerAttr) UDM_NAMESPACE::PointerAttr<Namespace::Class>;
+
+ %template(Class ## _vector) std::vector<Namespace::Class>;
+ %template(Class ## _set) std::set<Namespace::Class>;
+ // TODO: any standard extensions?
+ //%extend Class {
+%enddef
+
Copied: UDM/trunk/src/UdmCliSwig/UdmDom.i (from r3786, UDM/trunk/include/UdmDom.i)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ UDM/trunk/src/UdmCliSwig/UdmDom.i Thu Jul 14 09:48:31 2011 (r3789, copy of r3786, UDM/trunk/include/UdmDom.i)
@@ -0,0 +1,37 @@
+%module UdmDom
+
+%include "UdmCli.i"
+
+CSHARP_NAMESPACE3(UdmGme, Udm.Native.UdmGme, DomDataNetwork)
+
+%ignore UdmDom::GetTime;
+%ignore UdmDom::DomDataNetwork::Search;
+%ignore UdmDom::DomDataNetwork::DoMapping;
+%ignore UdmDom::DomDataNetwork::FindFile;
+%ignore UdmDom::isXmi;
+%ignore UdmDom::DomDataNetwork::multiroles;
+%ignore UdmDom::DomDataNetwork::MultiRolesEnabled;
+%ignore UdmDom::DomDataNetwork::EnableMultiRoles;
+
+%ignore UdmDom::DomDataNetwork::meta_class_cache;
+
+%ignore UdmDom::DummyFL;
+%ignore UdmDom::Dummy_For_Linker;
+
+// TODO: support this
+%ignore UdmDom::DomDataNetwork::DTDPath;
+
+%{
+#include "UdmDom.h"
+%}
+
+// FIXME: this should work, but produces an error
+// #define XML_WIN32
+// #define XML_VISUALCPP
+
+#define XERCES_CPP_NAMESPACE_BEGIN
+#define XERCES_CPP_NAMESPACE_END
+#define XERCES_CPP_NAMESPACE_USE
+
+
+%include "UdmDom.h"
Copied: UDM/trunk/src/UdmCliSwig/UdmException.i (from r3786, UDM/trunk/include/UdmException.i)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ UDM/trunk/src/UdmCliSwig/UdmException.i Thu Jul 14 09:48:31 2011 (r3789, copy of r3786, UDM/trunk/include/UdmException.i)
@@ -0,0 +1,488 @@
+#ifndef _UdmException_i_
+#define _UdmException_i_
+
+// swig can get confused with namespace x = y;
+// it doesn't matter if we lie to swig at this point
+#define UDM_NAMESPACE Udm
+
+// #define __int64 long long
+%apply long long { __int64 };
+#typedef long long __int64;
+
+%define UDM_EXCEPTION_HANDLING(SUFFIX)
+%insert(runtime) %{
+ // Code to handle throwing of C# UdmException from C/C++ code.
+ // The equivalent delegate to the callback, CSharpExceptionCallback_t, is CustomExceptionDelegate
+ // and the equivalent customExceptionCallback instance is customDelegate
+ typedef void (SWIGSTDCALL* CSharpExceptionCallback_t)(const char *);
+ static CSharpExceptionCallback_t customExceptionCallback = NULL;
+
+ extern "C" SWIGEXPORT
+ void SWIGSTDCALL UdmExceptionRegisterCallback ## SUFFIX(CSharpExceptionCallback_t customCallback) {
+ customExceptionCallback = customCallback;
+ }
+
+ // Note that SWIG detects any method calls named starting with
+ // SWIG_CSharpSetPendingException for warning 845
+ static void SWIG_CSharpSetPendingExceptionUdm(const char *msg) {
+ customExceptionCallback(msg);
+ }
+%}
+
+%pragma(csharp) imclasscode=%{
+ class UdmExceptionHelper {
+ // C# delegate for the C/C++ customExceptionCallback
+ public delegate void CustomExceptionDelegate(string message);
+ static CustomExceptionDelegate customDelegate =
+ new CustomExceptionDelegate(SetPendingCustomException);
+
+ [DllImport("$dllimport", EntryPoint=("UdmExceptionRegisterCallback" + "SUFFIX"))]
+ public static extern
+ void UdmExceptionRegisterCallback(CustomExceptionDelegate customCallback);
+
+ static void SetPendingCustomException(string message) {
+ SWIGPendingException.Set(new UdmException(message));
+ }
+
+ public UdmExceptionHelper() {
+ UdmExceptionRegisterCallback(customDelegate);
+ }
+ }
+ static UdmExceptionHelper exceptionHelper = new UdmExceptionHelper();
+%}
+
+%exception %{
+try {
+ $action
+} catch (udm_exception &e) {
+ SWIG_CSharpSetPendingExceptionUdm(e.what());
+}
+%}
+%enddef
+
+UDM_EXCEPTION_HANDLING($imclassname)
+
+// Wrap NAMESPACE::SWIGTYPE with csharp namespaces
+// based on csharp.swg
+%define CSHARP_SWIGTYPEMAPS(SWIGTYPE, CNAMESPACE, CSNAMESPACE)
+
+%typemap(cstype) CNAMESPACE ## SWIGTYPE "CSNAMESPACE$&csclassname"
+%typemap(cstype) CNAMESPACE ## SWIGTYPE [] "CSNAMESPACE$csclassname"
+%typemap(cstype) CNAMESPACE ## SWIGTYPE * "CSNAMESPACE$csclassname"
+%typemap(cstype) CNAMESPACE ## SWIGTYPE & "CSNAMESPACE$csclassname"
+%typemap(cstype) CNAMESPACE ## SWIGTYPE (CLASS::*) "CSNAMESPACE$csclassname"
+
+%typemap(csin) CNAMESPACE ## SWIGTYPE "CSNAMESPACE$&csclassname.getCPtr($csinput)"
+%typemap(csin) CNAMESPACE ## SWIGTYPE *, CNAMESPACE ## SWIGTYPE &, CNAMESPACE ## SWIGTYPE [] "CSNAMESPACE$csclassname.getCPtr($csinput)"
+%typemap(csin) CNAMESPACE ## SWIGTYPE (CLASS::*) "CSNAMESPACE$csclassname.getCMemberPtr($csinput)"
+
+%typemap(csout, excode=SWIGEXCODE) CNAMESPACE ## SWIGTYPE {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ CSNAMESPACE$&csclassname ret = new CSNAMESPACE$&csclassname($imcall, true);$excode
+ return ret;
+ }
+ }
+%typemap(csout, excode=SWIGEXCODE) CNAMESPACE ## SWIGTYPE & {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ CSNAMESPACE$csclassname ret = new CSNAMESPACE$csclassname($imcall, $owner);$excode
+ return ret;
+ }
+ }
+%typemap(csout, excode=SWIGEXCODE) CNAMESPACE ## SWIGTYPE *, CNAMESPACE ## SWIGTYPE [] {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ IntPtr cPtr = $imcall;
+ CSNAMESPACE$csclassname ret = (cPtr == IntPtr.Zero) ? null : new CSNAMESPACE$csclassname(cPtr, $owner);$excode
+ return ret;
+ }
+ }
+%typemap(csout, excode=SWIGEXCODE) CNAMESPACE ## SWIGTYPE (CLASS::*) {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ string cMemberPtr = $imcall;
+ CSNAMESPACE$csclassname ret = (cMemberPtr == null) ? null : new CSNAMESPACE$csclassname(cMemberPtr, $owner);$excode
+ return ret;
+ }
+ }
+
+%typemap(csvarout, excode=SWIGEXCODE2) CNAMESPACE ## SWIGTYPE %{
+ get {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ CSNAMESPACE$&csclassname ret = new CSNAMESPACE$&csclassname($imcall, true);$excode
+ return ret;
+ }
+ } %}
+%typemap(csvarout, excode=SWIGEXCODE2) CNAMESPACE ## SWIGTYPE & %{
+ get {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ CSNAMESPACE$csclassname ret = new CSNAMESPACE$csclassname($imcall, $owner);$excode
+ return ret;
+ }
+ } %}
+%typemap(csvarout, excode=SWIGEXCODE2) CNAMESPACE ## SWIGTYPE *, CNAMESPACE ## SWIGTYPE [] %{
+ get {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ IntPtr cPtr = $imcall;
+ CSNAMESPACE$csclassname ret = (cPtr == IntPtr.Zero) ? null : new CSNAMESPACE$csclassname(cPtr, $owner);$excode
+ return ret;
+ }
+ } %}
+
+%typemap(csvarout, excode=SWIGEXCODE2) CNAMESPACE ## SWIGTYPE (CLASS::*) %{
+ get {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ string cMemberPtr = $imcall;
+ CSNAMESPACE$csclassname ret = (cMemberPtr == null) ? null : new CSNAMESPACE$csclassname(cMemberPtr, $owner);$excode
+ return ret;
+ }
+ } %}
+
+%enddef
+
+CSHARP_SWIGTYPEMAPS(SWIGTYPE, ,)
+
+%define CSHARP_NAMESPACE3(CNAMESPACE, CSNAMESPACE, SWIGTYPE)
+CSHARP_SWIGTYPEMAPS(SWIGTYPE, CNAMESPACE::, global::CSNAMESPACE.)
+%enddef
+
+%define CSHARP_NAMESPACE(NAMESPACE, SWIGTYPE)
+CSHARP_NAMESPACE3(NAMESPACE, NAMESPACE, SWIGTYPE)
+// Bug in swig
+// https://sourceforge.net/tracker/?func=detail&aid=2933129&group_id=1645&atid=101645
+CSHARP_NAMESPACE3(::NAMESPACE, NAMESPACE, SWIGTYPE)
+%enddef
+
+%typemap(cscode) UDM_NAMESPACE::Object %{
+ public static readonly Object GlobalLock = new Object();
+ public override bool Equals(object that)
+ {
+ if (that is UdmObject)
+ {
+ return this.Equals((UdmObject)that);
+ }
+ else
+ {
+ return false;
+ }
+ }
+ public override int GetHashCode()
+ {
+ return uniqueId();
+ }
+%}
+
+// based on csharp.swg
+// Changes: s/internal/public/
+// Proxy classes (base classes, ie, not derived classes)
+%typemap(csbody) SWIGTYPE %{
+ private HandleRef swigCPtr;
+ protected bool swigCMemOwn;
+
+ public $csclassname(IntPtr cPtr, bool cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = new HandleRef(this, cPtr);
+ }
+
+ public static HandleRef getCPtr($csclassname obj) {
+ return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+ }
+%}
+
+// Derived proxy classes
+%typemap(csbody_derived) SWIGTYPE %{
+ private HandleRef swigCPtr;
+
+ public $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGUpcast(cPtr), cMemoryOwn) {
+ swigCPtr = new HandleRef(this, cPtr);
+ }
+
+ public static HandleRef getCPtr($csclassname obj) {
+ return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+ }
+%}
+
+
+%typemap(csout, excode=SWIGEXCODE) bool, const bool & {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ bool ret = $imcall;$excode
+ return ret;
+ }
+ }
+%typemap(csout, excode=SWIGEXCODE) char, const char & {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ char ret = $imcall;$excode
+ return ret;
+ }
+ }
+%typemap(csout, excode=SWIGEXCODE) signed char, const signed char & {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ sbyte ret = $imcall;$excode
+ return ret;
+ }
+ }
+%typemap(csout, excode=SWIGEXCODE) unsigned char, const unsigned char & {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ byte ret = $imcall;$excode
+ return ret;
+ }
+ }
+%typemap(csout, excode=SWIGEXCODE) short, const short & {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ short ret = $imcall;$excode
+ return ret;
+ }
+ }
+%typemap(csout, excode=SWIGEXCODE) unsigned short, const unsigned short & {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ ushort ret = $imcall;$excode
+ return ret;
+ }
+ }
+%typemap(csout, excode=SWIGEXCODE) int, const int & {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ int ret = $imcall;$excode
+ return ret;
+ }
+ }
+%typemap(csout, excode=SWIGEXCODE) unsigned int, const unsigned int & {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ uint ret = $imcall;$excode
+ return ret;
+ }
+ }
+%typemap(csout, excode=SWIGEXCODE) long, const long & {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ int ret = $imcall;$excode
+ return ret;
+ }
+ }
+%typemap(csout, excode=SWIGEXCODE) unsigned long, const unsigned long & {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ uint ret = $imcall;$excode
+ return ret;
+ }
+ }
+%typemap(csout, excode=SWIGEXCODE) long long, const long long & {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ long ret = $imcall;$excode
+ return ret;
+ }
+ }
+%typemap(csout, excode=SWIGEXCODE) unsigned long long, const unsigned long long & {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ ulong ret = $imcall;$excode
+ return ret;
+ }
+ }
+%typemap(csout, excode=SWIGEXCODE) float, const float & {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ float ret = $imcall;$excode
+ return ret;
+ }
+ }
+%typemap(csout, excode=SWIGEXCODE) double, const double & {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ double ret = $imcall;$excode
+ return ret;
+ }
+ }
+%typemap(csout, excode=SWIGEXCODE) char *, char *&, char[ANY], char[] {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ string ret = $imcall;$excode
+ return ret;
+ }
+ }
+%typemap(csout, excode=SWIGEXCODE) void {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ $imcall;$excode
+ }
+ }
+
+%typemap(csvarin, excode=SWIGEXCODE2) char *, char *&, char[ANY], char[] %{
+ set {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ $imcall;$excode
+ }
+ } %}
+
+%typemap(csvarout, excode=SWIGEXCODE2) bool, const bool & %{
+ get {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ bool ret = $imcall;$excode
+ return ret;
+ }
+ } %}
+%typemap(csvarout, excode=SWIGEXCODE2) char, const char & %{
+ get {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ char ret = $imcall;$excode
+ return ret;
+ }
+ } %}
+%typemap(csvarout, excode=SWIGEXCODE2) signed char, const signed char & %{
+ get {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ sbyte ret = $imcall;$excode
+ return ret;
+ }
+ } %}
+%typemap(csvarout, excode=SWIGEXCODE2) unsigned char, const unsigned char & %{
+ get {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ byte ret = $imcall;$excode
+ return ret;
+ }
+ } %}
+%typemap(csvarout, excode=SWIGEXCODE2) short, const short & %{
+ get {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ short ret = $imcall;$excode
+ return ret;
+ }
+ } %}
+%typemap(csvarout, excode=SWIGEXCODE2) unsigned short, const unsigned short & %{
+ get {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ ushort ret = $imcall;$excode
+ return ret;
+ }
+ } %}
+%typemap(csvarout, excode=SWIGEXCODE2) int, const int & %{
+ get {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ int ret = $imcall;$excode
+ return ret;
+ }
+ } %}
+%typemap(csvarout, excode=SWIGEXCODE2) unsigned int, const unsigned int & %{
+ get {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ uint ret = $imcall;$excode
+ return ret;
+ }
+ } %}
+%typemap(csvarout, excode=SWIGEXCODE2) long, const long & %{
+ get {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ int ret = $imcall;$excode
+ return ret;
+ }
+ } %}
+%typemap(csvarout, excode=SWIGEXCODE2) unsigned long, const unsigned long & %{
+ get {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ uint ret = $imcall;$excode
+ return ret;
+ }
+ } %}
+%typemap(csvarout, excode=SWIGEXCODE2) long long, const long long & %{
+ get {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ long ret = $imcall;$excode
+ return ret;
+ }
+ } %}
+%typemap(csvarout, excode=SWIGEXCODE2) unsigned long long, const unsigned long long & %{
+ get {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ ulong ret = $imcall;$excode
+ return ret;
+ }
+ } %}
+%typemap(csvarout, excode=SWIGEXCODE2) float, const float & %{
+ get {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ float ret = $imcall;$excode
+ return ret;
+ }
+ } %}
+%typemap(csvarout, excode=SWIGEXCODE2) double, const double & %{
+ get {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ double ret = $imcall;$excode
+ return ret;
+ }
+ } %}
+
+
+%typemap(csvarout, excode=SWIGEXCODE2) char *, char *&, char[ANY], char[] %{
+ get {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ string ret = $imcall;$excode
+ return ret;
+ }
+ } %}
+%typemap(csvarout, excode=SWIGEXCODE2) void %{
+ get {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ $imcall;$excode
+ }
+ } %}
+%typemap(csvarout, excode=SWIGEXCODE2) SWIGTYPE %{
+ get {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ $&csclassname ret = new $&csclassname($imcall, true);$excode
+ return ret;
+ }
+ } %}
+%typemap(csvarout, excode=SWIGEXCODE2) SWIGTYPE & %{
+ get {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ $csclassname ret = new $csclassname($imcall, $owner);$excode
+ return ret;
+ }
+ } %}
+%typemap(csvarout, excode=SWIGEXCODE2) SWIGTYPE *, SWIGTYPE [] %{
+ get {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ IntPtr cPtr = $imcall;
+ $csclassname ret = (cPtr == IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);$excode
+ return ret;
+ }
+ } %}
+
+%typemap(csvarout, excode=SWIGEXCODE2) SWIGTYPE (CLASS::*) %{
+ get {
+ lock (global::Udm.Native.UdmObject.GlobalLock) {
+ string cMemberPtr = $imcall;
+ $csclassname ret = (cMemberPtr == null) ? null : new $csclassname(cMemberPtr, $owner);$excode
+ return ret;
+ }
+ } %}
+
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") SWIGTYPE {
+ lock(global::Udm.Native.UdmObject.GlobalLock) {
+ if (swigCPtr.Handle != IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ $imcall;
+ }
+ swigCPtr = new HandleRef(null, IntPtr.Zero);
+ }
+ GC.SuppressFinalize(this);
+ }
+ }
+
+%typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") SWIGTYPE {
+ lock(global::Udm.Native.UdmObject.GlobalLock) {
+ if (swigCPtr.Handle != IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ $imcall;
+ }
+ swigCPtr = new HandleRef(null, IntPtr.Zero);
+ }
+ GC.SuppressFinalize(this);
+ base.Dispose();
+ }
+ }
+
+%typemap(directordisconnect, methodname="swigDirectorDisconnect") SWIGTYPE %{
+ protected void $methodname() {
+ lock(global::Udm.Native.UdmObject.GlobalLock) {
+ swigCMemOwn = false;
+ $imcall;
+ }
+ }
+%}
+
+
+#endif
Copied: UDM/trunk/src/UdmCliSwig/UdmGme.i (from r3786, UDM/trunk/include/UdmGme.i)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ UDM/trunk/src/UdmCliSwig/UdmGme.i Thu Jul 14 09:48:31 2011 (r3789, copy of r3786, UDM/trunk/include/UdmGme.i)
@@ -0,0 +1,99 @@
+%module UdmGme
+
+%include "UdmCli.i"
+
+CSHARP_NAMESPACE3(UdmGme, Udm.Native.UdmGme, GmeDataNetwork)
+
+%ignore UdmGme::GmeDataNetwork::semantics;
+%ignore UdmGme::GmeDataNetwork::meta_role_filter_cache;
+%ignore UdmGme::GmeDataNetwork::amapInitialize;
+%ignore UdmGme::GmeDataNetwork::amap;
+%ignore UdmGme::GmeDataNetwork::priv;
+%ignore UdmGme::GmeDataNetwork::CountWriteOps;
+%ignore UdmGme::GmeDataNetwork::meta_class_cache;
+%ignore UdmGme::DummyFL;
+%ignore UdmGme::Dummy_For_Linker;
+
+%{
+#include "UdmGme.h"
+%}
+
+%define %cs_custom_cast(TYPE, CSTYPE)
+%typemap(ctype) TYPE, TYPE& "void*"
+%typemap(in) TYPE %{ $1 = (TYPE)$input; %}
+%typemap(in) TYPE& %{ $1 = (TYPE*)&$input; %}
+%typemap(imtype, out="CSTYPE") TYPE, TYPE& "CSTYPE"
+%typemap(cstype, out="CSTYPE") TYPE, TYPE& "CSTYPE"
+%typemap(csin) TYPE, TYPE& "$csinput"
+%typemap(csdirectorin) TYPE, TYPE& "$iminput"
+%typemap(csout, excode=SWIGEXCODE) TYPE {
+ IntPtr ret = $imcall;$excode
+ return ret;
+ }
+
+%enddef
+
+struct IUnknown;
+typedef IUnknown* LPUNKNOWN;
+%cs_custom_cast(LPUNKNOWN, IntPtr)
+%cs_custom_cast(IUnknown*, IntPtr)
+
+%include "UdmGme.h"
+
+
+%{
+Udm::UdmDiagram UdmDiagram_Wrap(Uml::Diagram* umld);
+namespace UdmGme {
+class GmeDN_Wrapper {
+ Uml::Diagram uml_diagram;
+ Udm::UdmDiagram diagram;
+ public:
+ GmeDataNetwork dn;
+ GmeDN_Wrapper(Uml::Diagram d, LPUNKNOWN pUnknownProject, bool customTransactions) : uml_diagram(d), diagram(UdmDiagram_Wrap(¨_diagram)), dn(diagram) {
+ dn.OpenExisting(pUnknownProject, Udm::CHANGES_LOST_DEFAULT, customTransactions);
+ }
+ GmeDataNetwork& _getDN() { return dn; }
+};
+}
+%}
+namespace UdmGme {
+class GmeDN_Wrapper {
+ Uml::Diagram uml_diagram;
+ Udm::UdmDiagram diagram;
+ GmeDataNetwork& dn;
+ public:
+ GmeDN_Wrapper(Uml::Diagram d, LPUNKNOWN pUnknownProject, bool customTransactions) : uml_diagram(d), diagram(UdmDiagram_Wrap(¨_diagram)), dn(diagram) {
+ dn.OpenExisting(pUnknownProject, Udm::CHANGES_LOST_DEFAULT, customTransactions);
+ }
+ GmeDataNetwork& _getDN() { return dn; }
+};
+ %extend GmeDN_Wrapper {
+ %typemap(cscode) UdmGme::GmeDN_Wrapper %{
+ public global::Udm.Native.UdmGme.GmeDataNetwork dn { get { return _getDN(); } }
+ public global::Udm.Native.UdmObject Gme2Udm(object mgaObject)
+ {
+ IntPtr punkMgaObject = global::System.Runtime.InteropServices.Marshal.GetIUnknownForObject(mgaObject);
+ try
+ {
+ return dn.Gme2Udm(punkMgaObject);
+ }
+ finally
+ {
+ global::System.Runtime.InteropServices.Marshal.Release(punkMgaObject);
+ }
+ }
+ public static GmeDN_Wrapper Create(global::Udm.Native.Uml.Diagram meta, object mgaProject, bool customTransactions)
+ {
+ IntPtr punkMgaProject = global::System.Runtime.InteropServices.Marshal.GetIUnknownForObject(mgaProject);
+ try
+ {
+ return new GmeDN_Wrapper(meta, punkMgaProject, customTransactions);
+ }
+ finally
+ {
+ global::System.Runtime.InteropServices.Marshal.Release(punkMgaProject);
+ }
+ }
+ %}
+ }
+}
Copied: UDM/trunk/src/UdmCliSwig/UdmStatic.i (from r3786, UDM/trunk/include/UdmStatic.i)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ UDM/trunk/src/UdmCliSwig/UdmStatic.i Thu Jul 14 09:48:31 2011 (r3789, copy of r3786, UDM/trunk/include/UdmStatic.i)
@@ -0,0 +1,30 @@
+%module UdmStatic;
+
+%include "UdmCli.i"
+
+CSHARP_NAMESPACE3(UdmStatic, Udm.Native.UdmStatic, StaticDataNetwork)
+CSHARP_NAMESPACE3(UdmStatic, Udm.Native.UdmStatic, StaticObject)
+
+// Not dll exported
+%ignore UdmStatic::StaticObject::e;
+%ignore UdmStatic::GetIdForObject;
+%ignore UdmStatic::GetObjectForId;
+%ignore UdmStatic::InsertObject;
+%ignore UdmStatic::StaticObject::StaticObject;
+%ignore UdmStatic::StaticObject::ValidatePointers;
+%ignore UdmStatic::StaticObject::Destroy;
+%ignore UdmStatic::StaticObject::Serialize;
+%ignore UdmStatic::StaticDataNetwork::DeSerialize;
+%ignore UdmStatic::StaticObject::FindCorrespondingObjectInStOrITree;
+%ignore UdmStatic::StaticObject::FindCorrespondingObjectInStOrI;
+%ignore UdmStatic::CreateComposition;
+%ignore UdmStatic::CreateAssociation;
+%ignore UdmStatic::StaticDataNetwork::SafeObjectById;
+
+%{
+#include "UdmStatic.h"
+#include "Uml.h"
+%}
+
+%include "UdmStatic.h"
+
Copied: UDM/trunk/src/UdmCliSwig/Uml.i (from r3786, UDM/trunk/include/Uml.i)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ UDM/trunk/src/UdmCliSwig/Uml.i Thu Jul 14 09:48:31 2011 (r3789, copy of r3786, UDM/trunk/include/Uml.i)
@@ -0,0 +1,88 @@
+%module Uml
+
+%include "UdmException.i"
+
+CSHARP_NAMESPACE3(Uml, Udm.Native.Uml, CompositionChildRole)
+CSHARP_NAMESPACE3(Uml, Udm.Native.Uml, Diagram)
+CSHARP_NAMESPACE3(Uml, Udm.Native.Uml, CompositionParentRole)
+CSHARP_NAMESPACE3(Uml, Udm.Native.Uml, AssociationRole)
+CSHARP_NAMESPACE3(Uml, Udm.Native.Uml, Association)
+CSHARP_NAMESPACE3(Uml, Udm.Native.Uml, TaggedValue)
+CSHARP_NAMESPACE3(Uml, Udm.Native.Uml, Composition)
+CSHARP_NAMESPACE3(Uml, Udm.Native.Uml, Namespace)
+CSHARP_NAMESPACE3(Uml, Udm.Native.Uml, Class)
+CSHARP_NAMESPACE3(Uml, Udm.Native.Uml, Constraint)
+CSHARP_NAMESPACE3(Uml, Udm.Native.Uml, GenericRole)
+CSHARP_NAMESPACE3(Uml, Udm.Native.Uml, Attribute)
+CSHARP_NAMESPACE3(Uml, Udm.Native.Uml, ConstraintDefinition)
+
+%include "UdmCli.i"
+
+// Not dll exported
+%ignore Uml::CreateCORBADiagram;
+%ignore Uml::CreateCORBANamespace;
+%ignore Uml::CreateCORBAClass;
+%ignore Uml::CreateCORBAAttribute;
+%ignore Uml::CreateCORBAAssociation;
+%ignore Uml::CreateCORBAAssociationRole;
+%ignore Uml::CreateCORBAComposition;
+%ignore Uml::CreateCORBACompositionParentRole;
+%ignore Uml::CreateCORBACompositionChildRole;
+
+%ignore Uml::InitCORBADiagram;
+%ignore Uml::InitCORBANamespace;
+%ignore Uml::InitCORBANamespace;
+%ignore Uml::InitCORBAClass;
+%ignore Uml::InitCORBAClass;
+%ignore Uml::InitCORBAAttribute;
+%ignore Uml::InitCORBAAssociation;
+%ignore Uml::InitCORBAAssociation;
+%ignore Uml::InitCORBAAssociationClass;
+%ignore Uml::InitCORBAAssociationRole;
+%ignore Uml::InitCORBAComposition;
+%ignore Uml::InitCORBAComposition;
+%ignore Uml::InitCORBACompositionParentRole;
+%ignore Uml::InitCORBACompositionChildRole;
+%ignore Uml::AddCORBAInheritance;
+
+%ignore Uml::meta;
+
+%{
+#include "Uml.h"
+#include "UmlExt.h"
+%}
+
+namespace Uml {
+ using namespace std;
+}
+
+%include "Uml.h"
+%include "UmlExt.h"
+
+%udm_class(Uml, CompositionChildRole);
+%udm_class(Uml, Diagram);
+%udm_class(Uml, CompositionParentRole);
+%udm_class(Uml, AssociationRole);
+%udm_class(Uml, Association);
+%udm_class(Uml, TaggedValue);
+%udm_class(Uml, Composition);
+%udm_class(Uml, Namespace);
+%udm_class(Uml, Class);
+%udm_class(Uml, Constraint);
+%udm_class(Uml, GenericRole);
+%udm_class(Uml, Attribute);
+%udm_class(Uml, ConstraintDefinition);
+
+// from UmlExt
+%template() Uml::ElemCollection<Diagram,Association>;
+%template() Uml::ElemCollection<Diagram,Class>;
+%template() Uml::ElemCollection<Diagram,Composition>;
+%template() Uml::ElemCollection<Namespace,Association>;
+%template() Uml::ElemCollection<Namespace,Class>;
+%template() Uml::ElemCollection<Namespace,Composition>;
+%template() Uml::NamespaceCollection<Diagram>;
+%template() Uml::NamespaceCollection<Namespace>;
+
+//%template(ChildRoleChain) std::vector<Uml::CompositionChildRole>;
+//%template() std::vector<ChildRoleChain>;
+%template() std::vector<CompositionChildRole_vector>;
Copied: UDM/trunk/src/UdmCliSwig/csharp_std_set.i (from r3786, UDM/trunk/include/csharp_std_set.i)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ UDM/trunk/src/UdmCliSwig/csharp_std_set.i Thu Jul 14 09:48:31 2011 (r3789, copy of r3786, UDM/trunk/include/csharp_std_set.i)
@@ -0,0 +1,285 @@
+/* -----------------------------------------------------------------------------
+ * See the LICENSE file for information on copyright, usage and redistribution
+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
+ *
+ * std_set.i
+ *
+ * SWIG typemaps for std::set<T>
+ * C# implementation
+ * The C# wrapper is made to look and feel like a C# System.Collections.Generic.List<> collection.
+ * For .NET 1 compatibility, define SWIG_DOTNET_1 when compiling the C# code; then the C# wrapper is
+ * made to look and feel like a typesafe C# System.Collections.ArrayList.
+ *
+ * Note that IEnumerable<> is implemented in the proxy class which is useful for using LINQ with
+ * C++ std::set wrappers. The IList<> interface is also implemented to provide enhanced functionality
+ * whenever we are confident that the required C++ operator== is available. This is the case for when
+ * T is a primitive type or a pointer. If T does define an operator==, then use the SWIG_STD_SET_ENHANCED
+ * macro to obtain this enhanced functionality, for example:
+ *
+ * SWIG_STD_SET_ENHANCED(SomeNamespace::Klass)
+ * %template(VectKlass) std::set<SomeNamespace::Klass>;
+ *
+ * Warning: heavy macro usage in this file. Use swig -E to get a sane view on the real file contents!
+ * ----------------------------------------------------------------------------- */
+
+// Warning: Use the typemaps here in the expectation that the macros they are in will change name.
+
+
+%include <std_common.i>
+
+// MACRO for use within the std::set class body
+%define SWIG_STD_SET_MINIMUM_INTERNAL(CSINTERFACE, CONST_REFERENCE_TYPE, CTYPE...)
+%typemap(csinterfaces) std::set<CTYPE > "IDisposable, System.Collections.IEnumerable\n#if !SWIG_DOTNET_1\n , System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n#endif\n";
+%typemap(cscode) std::set<CTYPE > %{
+ public $csclassname(System.Collections.ICollection c) : this() {
+ if (c == null)
+ throw new ArgumentNullException("c");
+ foreach ($typemap(cstype, CTYPE) element in c) {
+ this.Add(element);
+ }
+ }
+
+ public int Count {
+ get {
+ return (int)size();
+ }
+ }
+
+#if !SWIG_DOTNET_1
+ System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)> System.Collections.Generic.IEnumerable<$typemap(cstype, CTYPE)>.GetEnumerator() {
+ return new $csclassnameEnumerator(this);
+ }
+#endif
+
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
+ return new $csclassnameEnumerator(this);
+ }
+
+ public $csclassnameEnumerator GetEnumerator() {
+ return new $csclassnameEnumerator(this);
+ }
+
+ // Type-safe enumerator
+ /// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown
+ /// whenever the collection is modified. This has been done for changes in the size of the
+ /// collection but not when one of the elements of the collection is modified as it is a bit
+ /// tricky to detect unmanaged code that modifies the collection under our feet.
+ public sealed class $csclassnameEnumerator : System.Collections.IEnumerator
+#if !SWIG_DOTNET_1
+ , System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)>
+#endif
+ {
+ private $csclassname collectionRef;
+ private SWIGTYPE_p_void iterator;
+ private object currentObject;
+ private int currentSize;
+
+ public $csclassnameEnumerator($csclassname collection) {
+ collectionRef = collection;
+ iterator = null;
+ currentObject = null;
+ currentSize = collectionRef.Count;
+ }
+
+ // Type-safe iterator Current
+ public $typemap(cstype, CTYPE) Current {
+ get {
+ if (iterator == null)
+ throw new InvalidOperationException("Enumeration not started.");
+ //if (collectionRef.IteratorAtEnd(iterator))
+ // throw new InvalidOperationException("Enumeration finished.");
+ if (currentObject == null)
+ throw new InvalidOperationException("Collection modified.");
+ return ($typemap(cstype, CTYPE))currentObject;
+ }
+ }
+
+ // Type-unsafe IEnumerator.Current
+ object System.Collections.IEnumerator.Current {
+ get {
+ return Current;
+ }
+ }
+
+ public bool MoveNext() {
+ if (iterator == null)
+ {
+ iterator = collectionRef.IteratorNew();
+ }
+ if (collectionRef.IteratorAtEnd(iterator))
+ {
+ return false;
+ }
+ currentObject = collectionRef.IteratorDeref(iterator);
+ collectionRef.IteratorNext(iterator);
+ return true;
+ }
+
+ public void Reset() {
+ // TODO: delete iterator
+ iterator = null;
+ currentObject = null;
+ if (collectionRef.Count != currentSize) {
+ throw new InvalidOperationException("Collection modified.");
+ }
+ }
+
+#if !SWIG_DOTNET_1
+ public void Dispose() {
+ iterator = null;
+ // TODO: delete iterator
+ currentObject = null;
+ }
+#endif
+ }
+%}
+
+ public:
+ typedef size_t size_type;
+ typedef CTYPE value_type;
+ typedef CONST_REFERENCE_TYPE const_reference;
+ %rename(Clear) clear;
+ void clear();
+ %rename(Add) insert;
+ void insert(const value_type& x);
+ size_type size() const;
+ size_type max_size() const;
+// void reserve(size_type n);
+ %newobject GetRange(int index, int count);
+ %newobject Repeat(const value_type& value, int count);
+ set();
+ set(const set &other);
+
+ class iterator;
+ %extend {
+ void* IteratorNew() {
+ std::set<CTYPE >::iterator* ret = new std::set<CTYPE >::iterator();
+ (*ret) = $self->begin();
+ return ret;
+ }
+ bool IteratorAtEnd(void *it) {
+ return *(std::set<CTYPE >::iterator*)it == $self->end();
+ }
+ void IteratorNext(void *it) {
+ (*(std::set<CTYPE >::iterator*)it)++;
+ }
+ CTYPE IteratorDeref(void *it) {
+ return **(std::set<CTYPE >::iterator*)it;
+ }
+ // Takes a deep copy of the elements unlike ArrayList.AddRange
+ // FIXME: the argument isn't mapped to the same type as this
+ //void AddRange(const std::set<CTYPE >& values) {
+ // $self->insert(values.begin(), values.end());
+ //}
+ }
+%enddef
+
+%define SWIG_STD_SET_MINIMUM(CTYPE...)
+SWIG_STD_SET_MINIMUM_INTERNAL(IEnumerable, const value_type&, CTYPE)
+%enddef
+
+// Extra methods added to the collection class if operator== is defined for the class being wrapped
+// The class will then implement IList<>, which adds extra functionality
+%define SWIG_STD_SET_EXTRA_OP_EQUALS_EQUALS(CTYPE...)
+ %extend {
+ bool Contains(const value_type& value) {
+ return std::find($self->begin(), $self->end(), value) != $self->end();
+ }
+ int IndexOf(const value_type& value) {
+ int index = -1;
+ std::set<CTYPE >::iterator it = std::find($self->begin(), $self->end(), value);
+ if (it != $self->end())
+ index = (int)(it - $self->begin());
+ return index;
+ }
+ int LastIndexOf(const value_type& value) {
+ int index = -1;
+ std::set<CTYPE >::reverse_iterator rit = std::find($self->rbegin(), $self->rend(), value);
+ if (rit != $self->rend())
+ index = (int)($self->rend() - 1 - rit);
+ return index;
+ }
+ bool Remove(const value_type& value) {
+ std::set<CTYPE >::iterator it = std::find($self->begin(), $self->end(), value);
+ if (it != $self->end()) {
+ $self->erase(it);
+ return true;
+ }
+ return false;
+ }
+ }
+%enddef
+
+// Macros for std::set class specializations/enhancements
+%define SWIG_STD_SET_ENHANCED(CTYPE...)
+namespace std {
+ template<> class set<CTYPE > {
+ SWIG_STD_SET_MINIMUM_INTERNAL(IList, const value_type&, CTYPE)
+ SWIG_STD_SET_EXTRA_OP_EQUALS_EQUALS(CTYPE)
+ };
+}
+%enddef
+
+// Legacy macros
+%define SWIG_STD_SET_SPECIALIZE(CSTYPE, CTYPE...)
+#warning SWIG_STD_SET_SPECIALIZE macro deprecated, please see csharp/std_set.i and switch to SWIG_STD_SET_ENHANCED
+SWIG_STD_SET_ENHANCED(CTYPE)
+%enddef
+
+%define SWIG_STD_SET_SPECIALIZE_MINIMUM(CSTYPE, CTYPE...)
+#warning SWIG_STD_SET_SPECIALIZE_MINIMUM macro deprecated, it is no longer required
+%enddef
+
+%{
+#include <set>
+#include <algorithm>
+#include <stdexcept>
+%}
+
+%csmethodmodifiers std::set::getitemcopy "private"
+%csmethodmodifiers std::set::getitem "private"
+%csmethodmodifiers std::set::setitem "private"
+%csmethodmodifiers std::set::size "private"
+%csmethodmodifiers std::set::capacity "private"
+%csmethodmodifiers std::set::reserve "private"
+
+namespace std {
+ // primary (unspecialized) class template for std::set
+ // does not require operator== to be defined
+ template<class T> class less { };
+ template<class T, Comp=less<T> > class set {
+ SWIG_STD_SET_MINIMUM(T)
+ };
+ // specializations for pointers
+// template<class T> class set<T*> {
+// SWIG_STD_SET_MINIMUM_INTERNAL(IList, const value_type&, T*)
+// SWIG_STD_SET_EXTRA_OP_EQUALS_EQUALS(T*)
+// };
+// template<class T> class set<const T*> {
+// SWIG_STD_SET_MINIMUM_INTERNAL(IList, const value_type&, const T*)
+// SWIG_STD_SET_EXTRA_OP_EQUALS_EQUALS(const T*)
+// };
+ // bool is a bit different in the C++ standard
+// template<> class set<bool> {
+// SWIG_STD_SET_MINIMUM_INTERNAL(IList, bool, bool)
+// SWIG_STD_SET_EXTRA_OP_EQUALS_EQUALS(bool)
+// };
+}
+
+// template specializations for std::set
+// these provide extra collections methods as operator== is defined
+SWIG_STD_SET_ENHANCED(char)
+SWIG_STD_SET_ENHANCED(signed char)
+SWIG_STD_SET_ENHANCED(unsigned char)
+SWIG_STD_SET_ENHANCED(short)
+SWIG_STD_SET_ENHANCED(unsigned short)
+SWIG_STD_SET_ENHANCED(int)
+SWIG_STD_SET_ENHANCED(unsigned int)
+SWIG_STD_SET_ENHANCED(long)
+SWIG_STD_SET_ENHANCED(unsigned long)
+SWIG_STD_SET_ENHANCED(long long)
+SWIG_STD_SET_ENHANCED(unsigned long long)
+SWIG_STD_SET_ENHANCED(float)
+SWIG_STD_SET_ENHANCED(double)
+SWIG_STD_SET_ENHANCED(std::string) // also requires a %include <std_string.i>
+
More information about the Mobies-commit
mailing list