Finish fasterWrap: really a lot of code cleanup (yes, you!) and one change that eliminates argument and overload checking for non-overloaded methods with zero or all scalar arguments
commit
d8235d0c2a
422
.cproject
422
.cproject
|
@ -1,17 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||
<?fileVersion 4.0.0?>
|
||||
|
||||
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="cdt.managedbuild.toolchain.gnu.macosx.base.1359703544">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.macosx.base.1359703544" moduleId="org.eclipse.cdt.core.settings" name="MacOSX GCC">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
|
@ -60,13 +62,13 @@
|
|||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.macosx.base.1359703544.1441575890" moduleId="org.eclipse.cdt.core.settings" name="Timing">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
|
@ -116,13 +118,13 @@
|
|||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.macosx.base.1359703544.127261216" moduleId="org.eclipse.cdt.core.settings" name="fast">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
|
@ -540,14 +542,6 @@
|
|||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testGaussianFactor.run" path="linear/tests" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>testGaussianFactor.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="all" path="inference" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
|
@ -574,6 +568,7 @@
|
|||
</target>
|
||||
<target name="tests/testBayesTree.run" path="inference" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>tests/testBayesTree.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
|
@ -581,6 +576,7 @@
|
|||
</target>
|
||||
<target name="testBinaryBayesNet.run" path="inference" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>testBinaryBayesNet.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
|
@ -628,6 +624,7 @@
|
|||
</target>
|
||||
<target name="testSymbolicBayesNet.run" path="inference" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>testSymbolicBayesNet.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
|
@ -635,6 +632,7 @@
|
|||
</target>
|
||||
<target name="tests/testSymbolicFactor.run" path="inference" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>tests/testSymbolicFactor.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
|
@ -642,6 +640,7 @@
|
|||
</target>
|
||||
<target name="testSymbolicFactorGraph.run" path="inference" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>testSymbolicFactorGraph.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
|
@ -657,11 +656,20 @@
|
|||
</target>
|
||||
<target name="tests/testBayesTree" path="inference" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>tests/testBayesTree</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testGaussianFactor.run" path="linear/tests" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>testGaussianFactor.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testPoseRTV.run" path="build/gtsam_unstable/dynamics" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j5</buildArguments>
|
||||
|
@ -886,22 +894,6 @@
|
|||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="all" path="CppUnitLite" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>all</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="clean" path="CppUnitLite" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>clean</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="tests/testPose2.run" path="build_retract/gtsam/geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
|
@ -918,6 +910,22 @@
|
|||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="all" path="CppUnitLite" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>all</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="clean" path="CppUnitLite" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>clean</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="all" path="spqr_mini" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
|
@ -942,6 +950,30 @@
|
|||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="all" path="build_wrap" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>all</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="check" path="build_wrap" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>check</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="clean" path="build_wrap" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>clean</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testGeneralSFMFactor.run" path="build/gtsam/slam" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j5</buildArguments>
|
||||
|
@ -1006,30 +1038,6 @@
|
|||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="all" path="build_wrap" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>all</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="check" path="build_wrap" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>check</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="clean" path="build_wrap" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>clean</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testValues.run" path="build/gtsam/nonlinear" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j5</buildArguments>
|
||||
|
@ -1118,10 +1126,10 @@
|
|||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testSmartProjectionPoseFactor.run" path="build/gtsam_unstable/slam/tests" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<target name="testWrap.run" path="build/wrap/tests" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j5</buildArguments>
|
||||
<buildTarget>testSmartProjectionPoseFactor.run</buildTarget>
|
||||
<buildTarget>testWrap.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
|
@ -1254,14 +1262,6 @@
|
|||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testAttitudeFactor.run" path="build/gtsam/navigation/tests" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j5</buildArguments>
|
||||
<buildTarget>testAttitudeFactor.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testInvDepthFactor3.run" path="build/gtsam_unstable/slam" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j5</buildArguments>
|
||||
|
@ -1318,6 +1318,14 @@
|
|||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testSmartProjectionFactor.run" path="build/gtsam_unstable/slam" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j5</buildArguments>
|
||||
<buildTarget>testSmartProjectionFactor.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testTSAMFactors.run" path="build/gtsam_unstable/slam" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j5</buildArguments>
|
||||
|
@ -1536,6 +1544,7 @@
|
|||
</target>
|
||||
<target name="testGraph.run" path="build/tests" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>testGraph.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
|
@ -1543,6 +1552,7 @@
|
|||
</target>
|
||||
<target name="testJunctionTree.run" path="build/tests" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>testJunctionTree.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
|
@ -1550,6 +1560,7 @@
|
|||
</target>
|
||||
<target name="testSymbolicBayesNetB.run" path="build/tests" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>testSymbolicBayesNetB.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
|
@ -1717,6 +1728,7 @@
|
|||
</target>
|
||||
<target name="testErrors.run" path="linear" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>testErrors.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
|
@ -1762,22 +1774,6 @@
|
|||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testGaussianFactor.run" path="build/linear/tests" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>testGaussianFactor.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testParticleFactor.run" path="build/gtsam_unstable/nonlinear" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j5</buildArguments>
|
||||
<buildTarget>testParticleFactor.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="check" path="base" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
|
@ -1858,6 +1854,22 @@
|
|||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testParticleFactor.run" path="build/gtsam_unstable/nonlinear" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j5</buildArguments>
|
||||
<buildTarget>testParticleFactor.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testGaussianFactor.run" path="build/linear/tests" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>testGaussianFactor.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="check" path="build/inference" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
|
@ -2010,22 +2022,6 @@
|
|||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testImuFactor.run" path="build/gtsam/navigation" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j5</buildArguments>
|
||||
<buildTarget>testImuFactor.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testCombinedImuFactor.run" path="build/gtsam/navigation" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j5</buildArguments>
|
||||
<buildTarget>testCombinedImuFactor.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="all" path="slam" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
|
@ -2108,7 +2104,6 @@
|
|||
</target>
|
||||
<target name="testSimulated2DOriented.run" path="slam" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>testSimulated2DOriented.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
|
@ -2148,7 +2143,6 @@
|
|||
</target>
|
||||
<target name="testSimulated2D.run" path="slam" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>testSimulated2D.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
|
@ -2156,7 +2150,6 @@
|
|||
</target>
|
||||
<target name="testSimulated3D.run" path="slam" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>testSimulated3D.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
|
@ -2170,6 +2163,22 @@
|
|||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testImuFactor.run" path="build/gtsam/navigation" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j5</buildArguments>
|
||||
<buildTarget>testImuFactor.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testCombinedImuFactor.run" path="build/gtsam/navigation" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j5</buildArguments>
|
||||
<buildTarget>testCombinedImuFactor.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testVector.run" path="build/gtsam/base" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j5</buildArguments>
|
||||
|
@ -2396,7 +2405,6 @@
|
|||
</target>
|
||||
<target name="tests/testGaussianISAM2" path="build/slam" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>tests/testGaussianISAM2</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
|
@ -2418,102 +2426,6 @@
|
|||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testRot3.run" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>testRot3.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testRot2.run" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>testRot2.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testPose3.run" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>testPose3.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="timeRot3.run" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>timeRot3.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testPose2.run" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>testPose2.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testCal3_S2.run" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>testCal3_S2.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testSimpleCamera.run" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>testSimpleCamera.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testHomography2.run" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>testHomography2.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testCalibratedCamera.run" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>testCalibratedCamera.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="check" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>check</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="clean" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>clean</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testPoint2.run" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>testPoint2.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="install" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j3</buildArguments>
|
||||
|
@ -2715,6 +2627,7 @@
|
|||
</target>
|
||||
<target name="Generate DEB Package" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>cpack</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>-G DEB</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
|
@ -2722,6 +2635,7 @@
|
|||
</target>
|
||||
<target name="Generate RPM Package" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>cpack</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>-G RPM</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
|
@ -2729,6 +2643,7 @@
|
|||
</target>
|
||||
<target name="Generate TGZ Package" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>cpack</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>-G TGZ</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
|
@ -2736,6 +2651,7 @@
|
|||
</target>
|
||||
<target name="Generate TGZ Source Package" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>cpack</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>--config CPackSourceConfig.cmake</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>false</useDefaultCommand>
|
||||
|
@ -2909,34 +2825,98 @@
|
|||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testSpirit.run" path="build/wrap" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<target name="testRot3.run" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j5</buildArguments>
|
||||
<buildTarget>testSpirit.run</buildTarget>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>testRot3.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testWrap.run" path="build/wrap" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<target name="testRot2.run" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j5</buildArguments>
|
||||
<buildTarget>testWrap.run</buildTarget>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>testRot2.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="check.wrap" path="build/wrap" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<target name="testPose3.run" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j5</buildArguments>
|
||||
<buildTarget>check.wrap</buildTarget>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>testPose3.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="wrap" path="build/wrap" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<target name="timeRot3.run" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j5</buildArguments>
|
||||
<buildTarget>wrap</buildTarget>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>timeRot3.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testPose2.run" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>testPose2.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testCal3_S2.run" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>testCal3_S2.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testSimpleCamera.run" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>testSimpleCamera.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testHomography2.run" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>testHomography2.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testCalibratedCamera.run" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>testCalibratedCamera.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="check" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>check</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="clean" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>clean</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testPoint2.run" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j2</buildArguments>
|
||||
<buildTarget>testPoint2.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
|
@ -2980,6 +2960,30 @@
|
|||
<useDefaultCommand>false</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="testSpirit.run" path="build/wrap" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j5</buildArguments>
|
||||
<buildTarget>testSpirit.run</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="check.wrap" path="build/wrap" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j5</buildArguments>
|
||||
<buildTarget>check.wrap</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
<target name="wrap" path="build/wrap" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments>-j5</buildArguments>
|
||||
<buildTarget>wrap</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
</buildTargets>
|
||||
</storageModule>
|
||||
</cproject>
|
||||
|
|
|
@ -16,13 +16,14 @@
|
|||
* @author Richard Roberts
|
||||
**/
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include "Argument.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
#include "Argument.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
using namespace std;
|
||||
using namespace wrap;
|
||||
|
@ -31,18 +32,24 @@ using namespace wrap;
|
|||
string Argument::matlabClass(const string& delim) const {
|
||||
string result;
|
||||
BOOST_FOREACH(const string& ns, namespaces)
|
||||
result += ns + delim;
|
||||
if (type=="string" || type=="unsigned char" || type=="char")
|
||||
result += ns + delim;
|
||||
if (type == "string" || type == "unsigned char" || type == "char")
|
||||
return result + "char";
|
||||
if (type=="Vector" || type=="Matrix")
|
||||
if (type == "Vector" || type == "Matrix")
|
||||
return result + "double";
|
||||
if (type=="int" || type=="size_t")
|
||||
if (type == "int" || type == "size_t")
|
||||
return result + "numeric";
|
||||
if (type=="bool")
|
||||
if (type == "bool")
|
||||
return result + "logical";
|
||||
return result + type;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
bool Argument::isScalar() const {
|
||||
return (type == "bool" || type == "char" || type == "unsigned char"
|
||||
|| type == "int" || type == "size_t" || type == "double");
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
void Argument::matlab_unwrap(FileWriter& file, const string& matlabName) const {
|
||||
file.oss << " ";
|
||||
|
@ -52,7 +59,8 @@ void Argument::matlab_unwrap(FileWriter& file, const string& matlabName) const {
|
|||
|
||||
if (is_ptr)
|
||||
// A pointer: emit an "unwrap_shared_ptr" call which returns a pointer
|
||||
file.oss << "boost::shared_ptr<" << cppType << "> " << name << " = unwrap_shared_ptr< ";
|
||||
file.oss << "boost::shared_ptr<" << cppType << "> " << name
|
||||
<< " = unwrap_shared_ptr< ";
|
||||
else if (is_ref)
|
||||
// A reference: emit an "unwrap_shared_ptr" call and de-reference the pointer
|
||||
file.oss << cppType << "& " << name << " = *unwrap_shared_ptr< ";
|
||||
|
@ -65,23 +73,28 @@ void Argument::matlab_unwrap(FileWriter& file, const string& matlabName) const {
|
|||
file.oss << cppType << " " << name << " = unwrap< ";
|
||||
|
||||
file.oss << cppType << " >(" << matlabName;
|
||||
if (is_ptr || is_ref) file.oss << ", \"ptr_" << matlabUniqueType << "\"";
|
||||
if (is_ptr || is_ref)
|
||||
file.oss << ", \"ptr_" << matlabUniqueType << "\"";
|
||||
file.oss << ");" << endl;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
string Argument::qualifiedType(const string& delim) const {
|
||||
string result;
|
||||
BOOST_FOREACH(const string& ns, namespaces) result += ns + delim;
|
||||
BOOST_FOREACH(const string& ns, namespaces)
|
||||
result += ns + delim;
|
||||
return result + type;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
string ArgumentList::types() const {
|
||||
string str;
|
||||
bool first=true;
|
||||
bool first = true;
|
||||
BOOST_FOREACH(Argument arg, *this) {
|
||||
if (!first) str += ","; str += arg.type; first=false;
|
||||
if (!first)
|
||||
str += ",";
|
||||
str += arg.type;
|
||||
first = false;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
@ -89,16 +102,17 @@ string ArgumentList::types() const {
|
|||
/* ************************************************************************* */
|
||||
string ArgumentList::signature() const {
|
||||
string sig;
|
||||
bool cap=false;
|
||||
bool cap = false;
|
||||
|
||||
BOOST_FOREACH(Argument arg, *this) {
|
||||
BOOST_FOREACH(char ch, arg.type)
|
||||
if(isupper(ch)) {
|
||||
sig += ch;
|
||||
//If there is a capital letter, we don't want to read it below
|
||||
cap=true;
|
||||
}
|
||||
if(!cap) sig += arg.type[0];
|
||||
if (isupper(ch)) {
|
||||
sig += ch;
|
||||
//If there is a capital letter, we don't want to read it below
|
||||
cap = true;
|
||||
}
|
||||
if (!cap)
|
||||
sig += arg.type[0];
|
||||
//Reset to default
|
||||
cap = false;
|
||||
}
|
||||
|
@ -109,23 +123,77 @@ string ArgumentList::signature() const {
|
|||
/* ************************************************************************* */
|
||||
string ArgumentList::names() const {
|
||||
string str;
|
||||
bool first=true;
|
||||
bool first = true;
|
||||
BOOST_FOREACH(Argument arg, *this) {
|
||||
if (!first) str += ","; str += arg.name; first=false;
|
||||
if (!first)
|
||||
str += ",";
|
||||
str += arg.name;
|
||||
first = false;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
bool ArgumentList::allScalar() const {
|
||||
BOOST_FOREACH(Argument arg, *this)
|
||||
if (!arg.isScalar()) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
void ArgumentList::matlab_unwrap(FileWriter& file, int start) const {
|
||||
int index = start;
|
||||
BOOST_FOREACH(Argument arg, *this) {
|
||||
stringstream buf;
|
||||
buf << "in[" << index << "]";
|
||||
arg.matlab_unwrap(file,buf.str());
|
||||
arg.matlab_unwrap(file, buf.str());
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
void ArgumentList::emit_prototype(FileWriter& file, const string& name) const {
|
||||
file.oss << name << "(";
|
||||
bool first = true;
|
||||
BOOST_FOREACH(Argument arg, *this) {
|
||||
if (!first)
|
||||
file.oss << ", ";
|
||||
file.oss << arg.type << " " << arg.name;
|
||||
first = false;
|
||||
}
|
||||
file.oss << ")";
|
||||
}
|
||||
/* ************************************************************************* */
|
||||
void ArgumentList::emit_call(FileWriter& file, const ReturnValue& returnVal,
|
||||
const string& wrapperName, int id, bool staticMethod) const {
|
||||
returnVal.emit_matlab(file);
|
||||
file.oss << wrapperName << "(" << id;
|
||||
if (!staticMethod)
|
||||
file.oss << ", this";
|
||||
file.oss << ", varargin{:});\n";
|
||||
}
|
||||
/* ************************************************************************* */
|
||||
void ArgumentList::emit_conditional_call(FileWriter& file,
|
||||
const ReturnValue& returnVal, const string& wrapperName, int id,
|
||||
bool staticMethod) const {
|
||||
// Check nr of arguments
|
||||
file.oss << "if length(varargin) == " << size();
|
||||
if (size() > 0)
|
||||
file.oss << " && ";
|
||||
// ...and their types
|
||||
bool first = true;
|
||||
for (size_t i = 0; i < size(); i++) {
|
||||
if (!first)
|
||||
file.oss << " && ";
|
||||
file.oss << "isa(varargin{" << i + 1 << "},'" << (*this)[i].matlabClass(".")
|
||||
<< "')";
|
||||
first = false;
|
||||
}
|
||||
file.oss << "\n";
|
||||
|
||||
// output call to C++ wrapper
|
||||
file.oss << " ";
|
||||
emit_call(file, returnVal, wrapperName, id, staticMethod);
|
||||
}
|
||||
/* ************************************************************************* */
|
||||
|
||||
|
|
|
@ -19,11 +19,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "FileWriter.h"
|
||||
#include "ReturnValue.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "FileWriter.h"
|
||||
|
||||
namespace wrap {
|
||||
|
||||
/// Argument class
|
||||
|
@ -40,6 +41,9 @@ struct Argument {
|
|||
/// return MATLAB class for use in isa(x,class)
|
||||
std::string matlabClass(const std::string& delim = "") const;
|
||||
|
||||
/// Check if will be unwrapped using scalar login in wrap/matlab.h
|
||||
bool isScalar() const;
|
||||
|
||||
/// adds namespaces to type
|
||||
std::string qualifiedType(const std::string& delim = "") const;
|
||||
|
||||
|
@ -59,6 +63,9 @@ struct ArgumentList: public std::vector<Argument> {
|
|||
/// create a comma-separated string listing all argument names, used in m-files
|
||||
std::string names() const;
|
||||
|
||||
/// Check if all arguments scalar
|
||||
bool allScalar() const;
|
||||
|
||||
// MATLAB code generation:
|
||||
|
||||
/**
|
||||
|
@ -68,6 +75,32 @@ struct ArgumentList: public std::vector<Argument> {
|
|||
*/
|
||||
void matlab_unwrap(FileWriter& file, int start = 0) const; // MATLAB to C++
|
||||
|
||||
/**
|
||||
* emit MATLAB prototype
|
||||
* @param file output stream
|
||||
* @param name of method or function
|
||||
*/
|
||||
void emit_prototype(FileWriter& file, const std::string& name) const;
|
||||
|
||||
/**
|
||||
* emit emit MATLAB call to wrapper
|
||||
* @param file output stream
|
||||
* @param returnVal the return value
|
||||
* @param wrapperName of method or function
|
||||
* @param staticMethod flag to emit "this" in call
|
||||
*/
|
||||
void emit_call(FileWriter& file, const ReturnValue& returnVal,
|
||||
const std::string& wrapperName, int id, bool staticMethod = false) const;
|
||||
|
||||
/**
|
||||
* emit conditional MATLAB call to wrapper (checking arguments first)
|
||||
* @param file output stream
|
||||
* @param returnVal the return value
|
||||
* @param wrapperName of method or function
|
||||
* @param staticMethod flag to emit "this" in call
|
||||
*/
|
||||
void emit_conditional_call(FileWriter& file, const ReturnValue& returnVal,
|
||||
const std::string& wrapperName, int id, bool staticMethod = false) const;
|
||||
};
|
||||
|
||||
} // \namespace wrap
|
||||
|
|
772
wrap/Class.cpp
772
wrap/Class.cpp
|
@ -7,62 +7,62 @@
|
|||
|
||||
* See LICENSE for the license information
|
||||
|
||||
* -------------------------------------------------------------------------- */
|
||||
|
||||
* -------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* @file Class.cpp
|
||||
* @author Frank Dellaert
|
||||
* @author Andrew Melim
|
||||
* @author Richard Roberts
|
||||
**/
|
||||
|
||||
**/
|
||||
|
||||
#include "Class.h"
|
||||
#include "utilities.h"
|
||||
#include "Argument.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
//#include <cstdint> // on Linux GCC: fails with error regarding needing C++0x std flags
|
||||
//#include <cinttypes> // same failure as above
|
||||
#include <stdint.h> // works on Linux GCC
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "Class.h"
|
||||
#include "utilities.h"
|
||||
#include "Argument.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace wrap;
|
||||
|
||||
/* ************************************************************************* */
|
||||
void Class::matlab_proxy(const string& toolboxPath, const string& wrapperName,
|
||||
const TypeAttributesTable& typeAttributes,
|
||||
FileWriter& wrapperFile, vector<string>& functionNames) const {
|
||||
|
||||
using namespace std;
|
||||
using namespace wrap;
|
||||
|
||||
/* ************************************************************************* */
|
||||
void Class::matlab_proxy(const string& toolboxPath, const string& wrapperName,
|
||||
const TypeAttributesTable& typeAttributes, FileWriter& wrapperFile,
|
||||
vector<string>& functionNames) const {
|
||||
|
||||
// Create namespace folders
|
||||
createNamespaceStructure(namespaces, toolboxPath);
|
||||
|
||||
createNamespaceStructure(namespaces, toolboxPath);
|
||||
|
||||
// open destination classFile
|
||||
string classFile = toolboxPath;
|
||||
if(!namespaces.empty())
|
||||
classFile += "/+" + wrap::qualifiedName("/+", namespaces);
|
||||
classFile += "/" + name + ".m";
|
||||
FileWriter proxyFile(classFile, verbose_, "%");
|
||||
|
||||
string classFile = toolboxPath;
|
||||
if (!namespaces.empty())
|
||||
classFile += "/+" + wrap::qualifiedName("/+", namespaces);
|
||||
classFile += "/" + name + ".m";
|
||||
FileWriter proxyFile(classFile, verbose_, "%");
|
||||
|
||||
// get the name of actual matlab object
|
||||
const string matlabQualName = qualifiedName("."), matlabUniqueName = qualifiedName(), cppName = qualifiedName("::");
|
||||
const string matlabBaseName = wrap::qualifiedName(".", qualifiedParent);
|
||||
const string cppBaseName = wrap::qualifiedName("::", qualifiedParent);
|
||||
|
||||
const string matlabQualName = qualifiedName("."), matlabUniqueName =
|
||||
qualifiedName(), cppName = qualifiedName("::");
|
||||
const string matlabBaseName = wrap::qualifiedName(".", qualifiedParent);
|
||||
const string cppBaseName = wrap::qualifiedName("::", qualifiedParent);
|
||||
|
||||
// emit class proxy code
|
||||
// we want our class to inherit the handle class for memory purposes
|
||||
const string parent = qualifiedParent.empty() ? "handle" : matlabBaseName;
|
||||
const string parent = qualifiedParent.empty() ? "handle" : matlabBaseName;
|
||||
comment_fragment(proxyFile);
|
||||
proxyFile.oss << "classdef " << name << " < " << parent << endl;
|
||||
proxyFile.oss << "classdef " << name << " < " << parent << endl;
|
||||
proxyFile.oss << " properties\n";
|
||||
proxyFile.oss << " ptr_" << matlabUniqueName << " = 0\n";
|
||||
proxyFile.oss << " end\n";
|
||||
proxyFile.oss << " methods\n";
|
||||
|
||||
|
||||
// Constructor
|
||||
proxyFile.oss << " function obj = " << name << "(varargin)\n";
|
||||
// Special pointer constructors - one in MATLAB to create an object and
|
||||
|
@ -72,284 +72,325 @@ void Class::matlab_proxy(const string& toolboxPath, const string& wrapperName,
|
|||
// other wrap modules - to add these to their collectors the pointer is
|
||||
// passed from one C++ module into matlab then back into the other C++
|
||||
// module.
|
||||
pointer_constructor_fragments(proxyFile, wrapperFile, wrapperName, functionNames);
|
||||
wrapperFile.oss << "\n";
|
||||
pointer_constructor_fragments(proxyFile, wrapperFile, wrapperName,
|
||||
functionNames);
|
||||
wrapperFile.oss << "\n";
|
||||
// Regular constructors
|
||||
BOOST_FOREACH(ArgumentList a, constructor.args_list)
|
||||
{
|
||||
const int id = (int)functionNames.size();
|
||||
constructor.proxy_fragment(proxyFile, wrapperName, !qualifiedParent.empty(), id, a);
|
||||
const string wrapFunctionName = constructor.wrapper_fragment(wrapperFile,
|
||||
cppName, matlabUniqueName, cppBaseName, id, a);
|
||||
wrapperFile.oss << "\n";
|
||||
functionNames.push_back(wrapFunctionName);
|
||||
}
|
||||
proxyFile.oss << " else\n";
|
||||
proxyFile.oss << " error('Arguments do not match any overload of " << matlabQualName << " constructor');\n";
|
||||
proxyFile.oss << " end\n";
|
||||
if(!qualifiedParent.empty())
|
||||
proxyFile.oss << " obj = obj@" << matlabBaseName << "(uint64(" << ptr_constructor_key << "), base_ptr);\n";
|
||||
proxyFile.oss << " obj.ptr_" << matlabUniqueName << " = my_ptr;\n";
|
||||
proxyFile.oss << " end\n\n";
|
||||
|
||||
BOOST_FOREACH(ArgumentList a, constructor.args_list) {
|
||||
const int id = (int) functionNames.size();
|
||||
constructor.proxy_fragment(proxyFile, wrapperName, !qualifiedParent.empty(),
|
||||
id, a);
|
||||
const string wrapFunctionName = constructor.wrapper_fragment(wrapperFile,
|
||||
cppName, matlabUniqueName, cppBaseName, id, a);
|
||||
wrapperFile.oss << "\n";
|
||||
functionNames.push_back(wrapFunctionName);
|
||||
}
|
||||
proxyFile.oss << " else\n";
|
||||
proxyFile.oss << " error('Arguments do not match any overload of "
|
||||
<< matlabQualName << " constructor');\n";
|
||||
proxyFile.oss << " end\n";
|
||||
if (!qualifiedParent.empty())
|
||||
proxyFile.oss << " obj = obj@" << matlabBaseName << "(uint64("
|
||||
<< ptr_constructor_key << "), base_ptr);\n";
|
||||
proxyFile.oss << " obj.ptr_" << matlabUniqueName << " = my_ptr;\n";
|
||||
proxyFile.oss << " end\n\n";
|
||||
|
||||
// Deconstructor
|
||||
{
|
||||
const int id = (int)functionNames.size();
|
||||
deconstructor.proxy_fragment(proxyFile, wrapperName, matlabUniqueName, id);
|
||||
proxyFile.oss << "\n";
|
||||
const string functionName = deconstructor.wrapper_fragment(wrapperFile, cppName, matlabUniqueName, id);
|
||||
wrapperFile.oss << "\n";
|
||||
functionNames.push_back(functionName);
|
||||
}
|
||||
proxyFile.oss << " function display(obj), obj.print(''); end\n %DISPLAY Calls print on the object\n";
|
||||
proxyFile.oss << " function disp(obj), obj.display; end\n %DISP Calls print on the object\n";
|
||||
|
||||
{
|
||||
const int id = (int) functionNames.size();
|
||||
deconstructor.proxy_fragment(proxyFile, wrapperName, matlabUniqueName, id);
|
||||
proxyFile.oss << "\n";
|
||||
const string functionName = deconstructor.wrapper_fragment(wrapperFile,
|
||||
cppName, matlabUniqueName, id);
|
||||
wrapperFile.oss << "\n";
|
||||
functionNames.push_back(functionName);
|
||||
}
|
||||
proxyFile.oss
|
||||
<< " function display(obj), obj.print(''); end\n %DISPLAY Calls print on the object\n";
|
||||
proxyFile.oss
|
||||
<< " function disp(obj), obj.display; end\n %DISP Calls print on the object\n";
|
||||
|
||||
// Methods
|
||||
BOOST_FOREACH(const Methods::value_type& name_m, methods) {
|
||||
const Method& m = name_m.second;
|
||||
m.proxy_wrapper_fragments(proxyFile, wrapperFile, cppName, matlabQualName, matlabUniqueName, wrapperName, typeAttributes, functionNames);
|
||||
proxyFile.oss << "\n";
|
||||
wrapperFile.oss << "\n";
|
||||
}
|
||||
BOOST_FOREACH(const Methods::value_type& name_m, methods) {
|
||||
const Method& m = name_m.second;
|
||||
m.proxy_wrapper_fragments(proxyFile, wrapperFile, cppName, matlabQualName,
|
||||
matlabUniqueName, wrapperName, typeAttributes, functionNames);
|
||||
proxyFile.oss << "\n";
|
||||
wrapperFile.oss << "\n";
|
||||
}
|
||||
if (hasSerialization)
|
||||
serialization_fragments(proxyFile, wrapperFile, wrapperName, functionNames);
|
||||
|
||||
proxyFile.oss << " end\n";
|
||||
proxyFile.oss << "\n";
|
||||
proxyFile.oss << " methods(Static = true)\n";
|
||||
|
||||
|
||||
proxyFile.oss << " end\n";
|
||||
proxyFile.oss << "\n";
|
||||
proxyFile.oss << " methods(Static = true)\n";
|
||||
|
||||
// Static methods
|
||||
BOOST_FOREACH(const StaticMethods::value_type& name_m, static_methods) {
|
||||
const StaticMethod& m = name_m.second;
|
||||
m.proxy_wrapper_fragments(proxyFile, wrapperFile, cppName, matlabQualName, matlabUniqueName, wrapperName, typeAttributes, functionNames);
|
||||
proxyFile.oss << "\n";
|
||||
wrapperFile.oss << "\n";
|
||||
}
|
||||
BOOST_FOREACH(const StaticMethods::value_type& name_m, static_methods) {
|
||||
const StaticMethod& m = name_m.second;
|
||||
m.proxy_wrapper_fragments(proxyFile, wrapperFile, cppName, matlabQualName,
|
||||
matlabUniqueName, wrapperName, typeAttributes, functionNames);
|
||||
proxyFile.oss << "\n";
|
||||
wrapperFile.oss << "\n";
|
||||
}
|
||||
if (hasSerialization)
|
||||
deserialization_fragments(proxyFile, wrapperFile, wrapperName, functionNames);
|
||||
deserialization_fragments(proxyFile, wrapperFile, wrapperName,
|
||||
functionNames);
|
||||
|
||||
proxyFile.oss << " end\n";
|
||||
proxyFile.oss << "end\n";
|
||||
|
||||
|
||||
// Close file
|
||||
proxyFile.emit(true);
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
string Class::qualifiedName(const string& delim) const {
|
||||
return ::wrap::qualifiedName(delim, namespaces, name);
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
void Class::pointer_constructor_fragments(FileWriter& proxyFile, FileWriter& wrapperFile, const string& wrapperName, vector<string>& functionNames) const {
|
||||
|
||||
const string matlabUniqueName = qualifiedName(), cppName = qualifiedName("::");
|
||||
const string baseCppName = wrap::qualifiedName("::", qualifiedParent);
|
||||
|
||||
const int collectorInsertId = (int)functionNames.size();
|
||||
const string collectorInsertFunctionName = matlabUniqueName + "_collectorInsertAndMakeBase_" + boost::lexical_cast<string>(collectorInsertId);
|
||||
functionNames.push_back(collectorInsertFunctionName);
|
||||
|
||||
int upcastFromVoidId;
|
||||
string upcastFromVoidFunctionName;
|
||||
if(isVirtual) {
|
||||
upcastFromVoidId = (int)functionNames.size();
|
||||
upcastFromVoidFunctionName = matlabUniqueName + "_upcastFromVoid_" + boost::lexical_cast<string>(upcastFromVoidId);
|
||||
functionNames.push_back(upcastFromVoidFunctionName);
|
||||
}
|
||||
|
||||
proxyFile.emit(true);
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
string Class::qualifiedName(const string& delim) const {
|
||||
return ::wrap::qualifiedName(delim, namespaces, name);
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
void Class::pointer_constructor_fragments(FileWriter& proxyFile,
|
||||
FileWriter& wrapperFile, const string& wrapperName,
|
||||
vector<string>& functionNames) const {
|
||||
|
||||
const string matlabUniqueName = qualifiedName(), cppName = qualifiedName(
|
||||
"::");
|
||||
const string baseCppName = wrap::qualifiedName("::", qualifiedParent);
|
||||
|
||||
const int collectorInsertId = (int) functionNames.size();
|
||||
const string collectorInsertFunctionName = matlabUniqueName
|
||||
+ "_collectorInsertAndMakeBase_"
|
||||
+ boost::lexical_cast<string>(collectorInsertId);
|
||||
functionNames.push_back(collectorInsertFunctionName);
|
||||
|
||||
int upcastFromVoidId;
|
||||
string upcastFromVoidFunctionName;
|
||||
if (isVirtual) {
|
||||
upcastFromVoidId = (int) functionNames.size();
|
||||
upcastFromVoidFunctionName = matlabUniqueName + "_upcastFromVoid_"
|
||||
+ boost::lexical_cast<string>(upcastFromVoidId);
|
||||
functionNames.push_back(upcastFromVoidFunctionName);
|
||||
}
|
||||
|
||||
// MATLAB constructor that assigns pointer to matlab object then calls c++
|
||||
// function to add the object to the collector.
|
||||
if(isVirtual) {
|
||||
proxyFile.oss << " if (nargin == 2 || (nargin == 3 && strcmp(varargin{3}, 'void')))";
|
||||
} else {
|
||||
proxyFile.oss << " if nargin == 2";
|
||||
}
|
||||
proxyFile.oss << " && isa(varargin{1}, 'uint64') && varargin{1} == uint64(" << ptr_constructor_key << ")\n";
|
||||
if(isVirtual) {
|
||||
proxyFile.oss << " if nargin == 2\n";
|
||||
proxyFile.oss << " my_ptr = varargin{2};\n";
|
||||
proxyFile.oss << " else\n";
|
||||
proxyFile.oss << " my_ptr = " << wrapperName << "(" << upcastFromVoidId << ", varargin{2});\n";
|
||||
proxyFile.oss << " end\n";
|
||||
} else {
|
||||
proxyFile.oss << " my_ptr = varargin{2};\n";
|
||||
}
|
||||
if(qualifiedParent.empty()) // If this class has a base class, we'll get a base class pointer back
|
||||
proxyFile.oss << " ";
|
||||
else
|
||||
proxyFile.oss << " base_ptr = ";
|
||||
if (isVirtual) {
|
||||
proxyFile.oss
|
||||
<< " if (nargin == 2 || (nargin == 3 && strcmp(varargin{3}, 'void')))";
|
||||
} else {
|
||||
proxyFile.oss << " if nargin == 2";
|
||||
}
|
||||
proxyFile.oss << " && isa(varargin{1}, 'uint64') && varargin{1} == uint64("
|
||||
<< ptr_constructor_key << ")\n";
|
||||
if (isVirtual) {
|
||||
proxyFile.oss << " if nargin == 2\n";
|
||||
proxyFile.oss << " my_ptr = varargin{2};\n";
|
||||
proxyFile.oss << " else\n";
|
||||
proxyFile.oss << " my_ptr = " << wrapperName << "("
|
||||
<< upcastFromVoidId << ", varargin{2});\n";
|
||||
proxyFile.oss << " end\n";
|
||||
} else {
|
||||
proxyFile.oss << " my_ptr = varargin{2};\n";
|
||||
}
|
||||
if (qualifiedParent.empty()) // If this class has a base class, we'll get a base class pointer back
|
||||
proxyFile.oss << " ";
|
||||
else
|
||||
proxyFile.oss << " base_ptr = ";
|
||||
proxyFile.oss << wrapperName << "(" << collectorInsertId << ", my_ptr);\n"; // Call collector insert and get base class ptr
|
||||
|
||||
|
||||
// C++ function to add pointer from MATLAB to collector. The pointer always
|
||||
// comes from a C++ return value; this mechanism allows the object to be added
|
||||
// to a collector in a different wrap module. If this class has a base class,
|
||||
// a new pointer to the base class is allocated and returned.
|
||||
wrapperFile.oss << "void " << collectorInsertFunctionName << "(int nargout, mxArray *out[], int nargin, const mxArray *in[])\n";
|
||||
wrapperFile.oss << "{\n";
|
||||
wrapperFile.oss << " mexAtExit(&_deleteAllObjects);\n";
|
||||
wrapperFile.oss << "void " << collectorInsertFunctionName
|
||||
<< "(int nargout, mxArray *out[], int nargin, const mxArray *in[])\n";
|
||||
wrapperFile.oss << "{\n";
|
||||
wrapperFile.oss << " mexAtExit(&_deleteAllObjects);\n";
|
||||
// Typedef boost::shared_ptr
|
||||
wrapperFile.oss << " typedef boost::shared_ptr<" << cppName << "> Shared;\n";
|
||||
wrapperFile.oss << "\n";
|
||||
wrapperFile.oss << " typedef boost::shared_ptr<" << cppName << "> Shared;\n";
|
||||
wrapperFile.oss << "\n";
|
||||
// Get self pointer passed in
|
||||
wrapperFile.oss << " Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));\n";
|
||||
wrapperFile.oss
|
||||
<< " Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));\n";
|
||||
// Add to collector
|
||||
wrapperFile.oss << " collector_" << matlabUniqueName << ".insert(self);\n";
|
||||
wrapperFile.oss << " collector_" << matlabUniqueName << ".insert(self);\n";
|
||||
// If we have a base class, return the base class pointer (MATLAB will call the base class collectorInsertAndMakeBase to add this to the collector and recurse the heirarchy)
|
||||
if(!qualifiedParent.empty()) {
|
||||
wrapperFile.oss << "\n";
|
||||
wrapperFile.oss << " typedef boost::shared_ptr<" << baseCppName << "> SharedBase;\n";
|
||||
wrapperFile.oss << " out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);\n";
|
||||
wrapperFile.oss << " *reinterpret_cast<SharedBase**>(mxGetData(out[0])) = new SharedBase(*self);\n";
|
||||
}
|
||||
wrapperFile.oss << "}\n";
|
||||
|
||||
if (!qualifiedParent.empty()) {
|
||||
wrapperFile.oss << "\n";
|
||||
wrapperFile.oss << " typedef boost::shared_ptr<" << baseCppName
|
||||
<< "> SharedBase;\n";
|
||||
wrapperFile.oss
|
||||
<< " out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);\n";
|
||||
wrapperFile.oss
|
||||
<< " *reinterpret_cast<SharedBase**>(mxGetData(out[0])) = new SharedBase(*self);\n";
|
||||
}
|
||||
wrapperFile.oss << "}\n";
|
||||
|
||||
// If this is a virtual function, C++ function to dynamic upcast it from a
|
||||
// shared_ptr<void>. This mechanism allows automatic dynamic creation of the
|
||||
// real underlying derived-most class when a C++ method returns a virtual
|
||||
// base class.
|
||||
if(isVirtual)
|
||||
wrapperFile.oss <<
|
||||
"\n"
|
||||
"void " << upcastFromVoidFunctionName << "(int nargout, mxArray *out[], int nargin, const mxArray *in[]) {\n"
|
||||
" mexAtExit(&_deleteAllObjects);\n"
|
||||
" typedef boost::shared_ptr<" << cppName << "> Shared;\n"
|
||||
" boost::shared_ptr<void> *asVoid = *reinterpret_cast<boost::shared_ptr<void>**> (mxGetData(in[0]));\n"
|
||||
" out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);\n"
|
||||
" Shared *self = new Shared(boost::static_pointer_cast<" << cppName << ">(*asVoid));\n"
|
||||
" *reinterpret_cast<Shared**>(mxGetData(out[0])) = self;\n"
|
||||
"}\n";
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
vector<ArgumentList> expandArgumentListsTemplate(const vector<ArgumentList>& argLists, const string& templateArg, const vector<string>& instName, const std::vector<string>& expandedClassNamespace, const string& expandedClassName) {
|
||||
vector<ArgumentList> result;
|
||||
BOOST_FOREACH(const ArgumentList& argList, argLists) {
|
||||
ArgumentList instArgList;
|
||||
BOOST_FOREACH(const Argument& arg, argList) {
|
||||
Argument instArg = arg;
|
||||
if(arg.type == templateArg) {
|
||||
instArg.namespaces.assign(instName.begin(), instName.end()-1);
|
||||
instArg.type = instName.back();
|
||||
} else if(arg.type == "This") {
|
||||
instArg.namespaces.assign(expandedClassNamespace.begin(), expandedClassNamespace.end());
|
||||
instArg.type = expandedClassName;
|
||||
}
|
||||
instArgList.push_back(instArg);
|
||||
}
|
||||
result.push_back(instArgList);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
template<class METHOD>
|
||||
map<string, METHOD> expandMethodTemplate(const map<string, METHOD>& methods, const string& templateArg, const vector<string>& instName, const std::vector<string>& expandedClassNamespace, const string& expandedClassName) {
|
||||
map<string, METHOD> result;
|
||||
typedef pair<const string, METHOD> Name_Method;
|
||||
BOOST_FOREACH(const Name_Method& name_method, methods) {
|
||||
const METHOD& method = name_method.second;
|
||||
METHOD instMethod = method;
|
||||
instMethod.argLists = expandArgumentListsTemplate(method.argLists, templateArg, instName, expandedClassNamespace, expandedClassName);
|
||||
instMethod.returnVals.clear();
|
||||
BOOST_FOREACH(const ReturnValue& retVal, method.returnVals) {
|
||||
ReturnValue instRetVal = retVal;
|
||||
if(retVal.type1 == templateArg) {
|
||||
instRetVal.namespaces1.assign(instName.begin(), instName.end()-1);
|
||||
instRetVal.type1 = instName.back();
|
||||
} else if(retVal.type1 == "This") {
|
||||
instRetVal.namespaces1.assign(expandedClassNamespace.begin(), expandedClassNamespace.end());
|
||||
instRetVal.type1 = expandedClassName;
|
||||
}
|
||||
if(retVal.type2 == templateArg) {
|
||||
instRetVal.namespaces2.assign(instName.begin(), instName.end()-1);
|
||||
instRetVal.type2 = instName.back();
|
||||
} else if(retVal.type1 == "This") {
|
||||
instRetVal.namespaces2.assign(expandedClassNamespace.begin(), expandedClassNamespace.end());
|
||||
instRetVal.type2 = expandedClassName;
|
||||
}
|
||||
instMethod.returnVals.push_back(instRetVal);
|
||||
}
|
||||
result.insert(make_pair(name_method.first, instMethod));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
Class expandClassTemplate(const Class& cls, const string& templateArg, const vector<string>& instName, const std::vector<string>& expandedClassNamespace, const string& expandedClassName) {
|
||||
Class inst;
|
||||
inst.name = cls.name;
|
||||
inst.templateArgs = cls.templateArgs;
|
||||
inst.typedefName = cls.typedefName;
|
||||
inst.isVirtual = cls.isVirtual;
|
||||
if (isVirtual)
|
||||
wrapperFile.oss << "\n"
|
||||
"void " << upcastFromVoidFunctionName
|
||||
<< "(int nargout, mxArray *out[], int nargin, const mxArray *in[]) {\n"
|
||||
" mexAtExit(&_deleteAllObjects);\n"
|
||||
" typedef boost::shared_ptr<" << cppName
|
||||
<< "> Shared;\n"
|
||||
" boost::shared_ptr<void> *asVoid = *reinterpret_cast<boost::shared_ptr<void>**> (mxGetData(in[0]));\n"
|
||||
" out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);\n"
|
||||
" Shared *self = new Shared(boost::static_pointer_cast<" << cppName
|
||||
<< ">(*asVoid));\n"
|
||||
" *reinterpret_cast<Shared**>(mxGetData(out[0])) = self;\n"
|
||||
"}\n";
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
vector<ArgumentList> expandArgumentListsTemplate(
|
||||
const vector<ArgumentList>& argLists, const string& templateArg,
|
||||
const vector<string>& instName,
|
||||
const std::vector<string>& expandedClassNamespace,
|
||||
const string& expandedClassName) {
|
||||
vector<ArgumentList> result;
|
||||
BOOST_FOREACH(const ArgumentList& argList, argLists) {
|
||||
ArgumentList instArgList;
|
||||
BOOST_FOREACH(const Argument& arg, argList) {
|
||||
Argument instArg = arg;
|
||||
if (arg.type == templateArg) {
|
||||
instArg.namespaces.assign(instName.begin(), instName.end() - 1);
|
||||
instArg.type = instName.back();
|
||||
} else if (arg.type == "This") {
|
||||
instArg.namespaces.assign(expandedClassNamespace.begin(),
|
||||
expandedClassNamespace.end());
|
||||
instArg.type = expandedClassName;
|
||||
}
|
||||
instArgList.push_back(instArg);
|
||||
}
|
||||
result.push_back(instArgList);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
template<class METHOD>
|
||||
map<string, METHOD> expandMethodTemplate(const map<string, METHOD>& methods,
|
||||
const string& templateArg, const vector<string>& instName,
|
||||
const std::vector<string>& expandedClassNamespace,
|
||||
const string& expandedClassName) {
|
||||
map<string, METHOD> result;
|
||||
typedef pair<const string, METHOD> Name_Method;
|
||||
BOOST_FOREACH(const Name_Method& name_method, methods) {
|
||||
const METHOD& method = name_method.second;
|
||||
METHOD instMethod = method;
|
||||
instMethod.argLists = expandArgumentListsTemplate(method.argLists,
|
||||
templateArg, instName, expandedClassNamespace, expandedClassName);
|
||||
instMethod.returnVals.clear();
|
||||
BOOST_FOREACH(const ReturnValue& retVal, method.returnVals) {
|
||||
ReturnValue instRetVal = retVal;
|
||||
if (retVal.type1 == templateArg) {
|
||||
instRetVal.namespaces1.assign(instName.begin(), instName.end() - 1);
|
||||
instRetVal.type1 = instName.back();
|
||||
} else if (retVal.type1 == "This") {
|
||||
instRetVal.namespaces1.assign(expandedClassNamespace.begin(),
|
||||
expandedClassNamespace.end());
|
||||
instRetVal.type1 = expandedClassName;
|
||||
}
|
||||
if (retVal.type2 == templateArg) {
|
||||
instRetVal.namespaces2.assign(instName.begin(), instName.end() - 1);
|
||||
instRetVal.type2 = instName.back();
|
||||
} else if (retVal.type1 == "This") {
|
||||
instRetVal.namespaces2.assign(expandedClassNamespace.begin(),
|
||||
expandedClassNamespace.end());
|
||||
instRetVal.type2 = expandedClassName;
|
||||
}
|
||||
instMethod.returnVals.push_back(instRetVal);
|
||||
}
|
||||
result.insert(make_pair(name_method.first, instMethod));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
Class expandClassTemplate(const Class& cls, const string& templateArg,
|
||||
const vector<string>& instName,
|
||||
const std::vector<string>& expandedClassNamespace,
|
||||
const string& expandedClassName) {
|
||||
Class inst;
|
||||
inst.name = cls.name;
|
||||
inst.templateArgs = cls.templateArgs;
|
||||
inst.typedefName = cls.typedefName;
|
||||
inst.isVirtual = cls.isVirtual;
|
||||
inst.isSerializable = cls.isSerializable;
|
||||
inst.qualifiedParent = cls.qualifiedParent;
|
||||
inst.methods = expandMethodTemplate(cls.methods, templateArg, instName, expandedClassNamespace, expandedClassName);
|
||||
inst.static_methods = expandMethodTemplate(cls.static_methods, templateArg, instName, expandedClassNamespace, expandedClassName);
|
||||
inst.namespaces = cls.namespaces;
|
||||
inst.constructor = cls.constructor;
|
||||
inst.constructor.args_list = expandArgumentListsTemplate(cls.constructor.args_list, templateArg, instName, expandedClassNamespace, expandedClassName);
|
||||
inst.constructor.name = inst.name;
|
||||
inst.deconstructor = cls.deconstructor;
|
||||
inst.deconstructor.name = inst.name;
|
||||
inst.verbose_ = cls.verbose_;
|
||||
return inst;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
vector<Class> Class::expandTemplate(const string& templateArg, const vector<vector<string> >& instantiations) const {
|
||||
vector<Class> result;
|
||||
BOOST_FOREACH(const vector<string>& instName, instantiations) {
|
||||
const string expandedName = name + instName.back();
|
||||
Class inst = expandClassTemplate(*this, templateArg, instName, this->namespaces, expandedName);
|
||||
inst.name = expandedName;
|
||||
inst.templateArgs.clear();
|
||||
inst.typedefName = qualifiedName("::") + "<" + wrap::qualifiedName("::", instName) + ">";
|
||||
result.push_back(inst);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
Class Class::expandTemplate(const string& templateArg, const vector<string>& instantiation, const std::vector<string>& expandedClassNamespace, const string& expandedClassName) const {
|
||||
return expandClassTemplate(*this, templateArg, instantiation, expandedClassNamespace, expandedClassName);
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
std::string Class::getTypedef() const {
|
||||
string result;
|
||||
BOOST_FOREACH(const string& namesp, namespaces) {
|
||||
result += ("namespace " + namesp + " { ");
|
||||
}
|
||||
result += ("typedef " + typedefName + " " + name + ";");
|
||||
for (size_t i = 0; i<namespaces.size(); ++i) {
|
||||
result += " }";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
inst.qualifiedParent = cls.qualifiedParent;
|
||||
inst.methods = expandMethodTemplate(cls.methods, templateArg, instName,
|
||||
expandedClassNamespace, expandedClassName);
|
||||
inst.static_methods = expandMethodTemplate(cls.static_methods, templateArg,
|
||||
instName, expandedClassNamespace, expandedClassName);
|
||||
inst.namespaces = cls.namespaces;
|
||||
inst.constructor = cls.constructor;
|
||||
inst.constructor.args_list = expandArgumentListsTemplate(
|
||||
cls.constructor.args_list, templateArg, instName, expandedClassNamespace,
|
||||
expandedClassName);
|
||||
inst.constructor.name = inst.name;
|
||||
inst.deconstructor = cls.deconstructor;
|
||||
inst.deconstructor.name = inst.name;
|
||||
inst.verbose_ = cls.verbose_;
|
||||
return inst;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
vector<Class> Class::expandTemplate(const string& templateArg,
|
||||
const vector<vector<string> >& instantiations) const {
|
||||
vector<Class> result;
|
||||
BOOST_FOREACH(const vector<string>& instName, instantiations) {
|
||||
const string expandedName = name + instName.back();
|
||||
Class inst = expandClassTemplate(*this, templateArg, instName,
|
||||
this->namespaces, expandedName);
|
||||
inst.name = expandedName;
|
||||
inst.templateArgs.clear();
|
||||
inst.typedefName = qualifiedName("::") + "<"
|
||||
+ wrap::qualifiedName("::", instName) + ">";
|
||||
result.push_back(inst);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
Class Class::expandTemplate(const string& templateArg,
|
||||
const vector<string>& instantiation,
|
||||
const std::vector<string>& expandedClassNamespace,
|
||||
const string& expandedClassName) const {
|
||||
return expandClassTemplate(*this, templateArg, instantiation,
|
||||
expandedClassNamespace, expandedClassName);
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
std::string Class::getTypedef() const {
|
||||
string result;
|
||||
BOOST_FOREACH(const string& namesp, namespaces) {
|
||||
result += ("namespace " + namesp + " { ");
|
||||
}
|
||||
result += ("typedef " + typedefName + " " + name + ";");
|
||||
for (size_t i = 0; i < namespaces.size(); ++i) {
|
||||
result += " }";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
||||
void Class::comment_fragment(FileWriter& proxyFile) const {
|
||||
proxyFile.oss << "%class " << name
|
||||
<< ", see Doxygen page for details\n";
|
||||
proxyFile.oss << "%class " << name << ", see Doxygen page for details\n";
|
||||
proxyFile.oss
|
||||
<< "%at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html\n";
|
||||
|
||||
if (!constructor.args_list.empty())
|
||||
proxyFile.oss << "%\n%-------Constructors-------\n";
|
||||
BOOST_FOREACH(ArgumentList argList, constructor.args_list) {
|
||||
string up_name = boost::to_upper_copy(name);
|
||||
proxyFile.oss << "%" << name << "(";
|
||||
unsigned int i = 0;
|
||||
BOOST_FOREACH(const Argument& arg, argList) {
|
||||
if (i != argList.size() - 1)
|
||||
proxyFile.oss << arg.type << " " << arg.name << ", ";
|
||||
else
|
||||
proxyFile.oss << arg.type << " " << arg.name;
|
||||
i++;
|
||||
}
|
||||
proxyFile.oss << ")\n";
|
||||
proxyFile.oss << "%";
|
||||
argList.emit_prototype(proxyFile, name);
|
||||
proxyFile.oss << "\n";
|
||||
}
|
||||
|
||||
if (!methods.empty())
|
||||
|
@ -357,17 +398,9 @@ void Class::comment_fragment(FileWriter& proxyFile) const {
|
|||
BOOST_FOREACH(const Methods::value_type& name_m, methods) {
|
||||
const Method& m = name_m.second;
|
||||
BOOST_FOREACH(ArgumentList argList, m.argLists) {
|
||||
string up_name = boost::to_upper_copy(m.name);
|
||||
proxyFile.oss << "%" << m.name << "(";
|
||||
unsigned int i = 0;
|
||||
BOOST_FOREACH(const Argument& arg, argList) {
|
||||
if (i != argList.size() - 1)
|
||||
proxyFile.oss << arg.type << " " << arg.name << ", ";
|
||||
else
|
||||
proxyFile.oss << arg.type << " " << arg.name;
|
||||
i++;
|
||||
}
|
||||
proxyFile.oss << ") : returns "
|
||||
proxyFile.oss << "%";
|
||||
argList.emit_prototype(proxyFile, m.name);
|
||||
proxyFile.oss << " : returns "
|
||||
<< m.returnVals[0].return_type(false, m.returnVals[0].pair) << endl;
|
||||
}
|
||||
}
|
||||
|
@ -377,18 +410,9 @@ void Class::comment_fragment(FileWriter& proxyFile) const {
|
|||
BOOST_FOREACH(const StaticMethods::value_type& name_m, static_methods) {
|
||||
const StaticMethod& m = name_m.second;
|
||||
BOOST_FOREACH(ArgumentList argList, m.argLists) {
|
||||
string up_name = boost::to_upper_copy(m.name);
|
||||
proxyFile.oss << "%" << m.name << "(";
|
||||
unsigned int i = 0;
|
||||
BOOST_FOREACH(const Argument& arg, argList) {
|
||||
if (i != argList.size() - 1)
|
||||
proxyFile.oss << arg.type << " " << arg.name << ", ";
|
||||
else
|
||||
proxyFile.oss << arg.type << " " << arg.name;
|
||||
i++;
|
||||
}
|
||||
|
||||
proxyFile.oss << ") : returns "
|
||||
proxyFile.oss << "%";
|
||||
argList.emit_prototype(proxyFile, m.name);
|
||||
proxyFile.oss << " : returns "
|
||||
<< m.returnVals[0].return_type(false, m.returnVals[0].pair) << endl;
|
||||
}
|
||||
}
|
||||
|
@ -396,15 +420,17 @@ void Class::comment_fragment(FileWriter& proxyFile) const {
|
|||
if (hasSerialization) {
|
||||
proxyFile.oss << "%\n%-------Serialization Interface-------\n";
|
||||
proxyFile.oss << "%string_serialize() : returns string\n";
|
||||
proxyFile.oss << "%string_deserialize(string serialized) : returns " << this->name << "\n";
|
||||
proxyFile.oss << "%string_deserialize(string serialized) : returns "
|
||||
<< this->name << "\n";
|
||||
}
|
||||
|
||||
proxyFile.oss << "%\n";
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
void Class::serialization_fragments(FileWriter& proxyFile, FileWriter& wrapperFile,
|
||||
const std::string& wrapperName, std::vector<std::string>& functionNames) const {
|
||||
/* ************************************************************************* */
|
||||
void Class::serialization_fragments(FileWriter& proxyFile,
|
||||
FileWriter& wrapperFile, const std::string& wrapperName,
|
||||
std::vector<std::string>& functionNames) const {
|
||||
|
||||
//void Point3_string_serialize_17(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
//{
|
||||
|
@ -418,30 +444,34 @@ void Class::serialization_fragments(FileWriter& proxyFile, FileWriter& wrapperFi
|
|||
//}
|
||||
|
||||
int serialize_id = functionNames.size();
|
||||
const string
|
||||
matlabQualName = qualifiedName("."),
|
||||
matlabUniqueName = qualifiedName(),
|
||||
cppClassName = qualifiedName("::");
|
||||
const string wrapFunctionNameSerialize = matlabUniqueName + "_string_serialize_" + boost::lexical_cast<string>(serialize_id);
|
||||
const string matlabQualName = qualifiedName("."), matlabUniqueName =
|
||||
qualifiedName(), cppClassName = qualifiedName("::");
|
||||
const string wrapFunctionNameSerialize = matlabUniqueName
|
||||
+ "_string_serialize_" + boost::lexical_cast<string>(serialize_id);
|
||||
functionNames.push_back(wrapFunctionNameSerialize);
|
||||
|
||||
// call
|
||||
//void Point3_string_serialize_17(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
wrapperFile.oss << "void " << wrapFunctionNameSerialize << "(int nargout, mxArray *out[], int nargin, const mxArray *in[])\n";
|
||||
wrapperFile.oss << "void " << wrapFunctionNameSerialize
|
||||
<< "(int nargout, mxArray *out[], int nargin, const mxArray *in[])\n";
|
||||
wrapperFile.oss << "{\n";
|
||||
wrapperFile.oss << " typedef boost::shared_ptr<" << cppClassName << "> Shared;" << endl;
|
||||
wrapperFile.oss << " typedef boost::shared_ptr<" << cppClassName
|
||||
<< "> Shared;" << endl;
|
||||
|
||||
// check arguments - for serialize, no arguments
|
||||
// example: checkArguments("string_serialize",nargout,nargin-1,0);
|
||||
wrapperFile.oss << " checkArguments(\"string_serialize\",nargout,nargin-1,0);\n";
|
||||
wrapperFile.oss
|
||||
<< " checkArguments(\"string_serialize\",nargout,nargin-1,0);\n";
|
||||
|
||||
// get class pointer
|
||||
// example: Shared obj = unwrap_shared_ptr<Point3>(in[0], "ptr_Point3");
|
||||
wrapperFile.oss << " Shared obj = unwrap_shared_ptr<" << cppClassName << ">(in[0], \"ptr_" << matlabUniqueName << "\");" << endl;
|
||||
wrapperFile.oss << " Shared obj = unwrap_shared_ptr<" << cppClassName
|
||||
<< ">(in[0], \"ptr_" << matlabUniqueName << "\");" << endl;
|
||||
|
||||
// Serialization boilerplate
|
||||
wrapperFile.oss << " std::ostringstream out_archive_stream;\n";
|
||||
wrapperFile.oss << " boost::archive::text_oarchive out_archive(out_archive_stream);\n";
|
||||
wrapperFile.oss
|
||||
<< " boost::archive::text_oarchive out_archive(out_archive_stream);\n";
|
||||
wrapperFile.oss << " out_archive << *obj;\n";
|
||||
wrapperFile.oss << " out[0] = wrap< string >(out_archive_stream.str());\n";
|
||||
|
||||
|
@ -459,13 +489,19 @@ void Class::serialization_fragments(FileWriter& proxyFile, FileWriter& wrapperFi
|
|||
// end
|
||||
// end
|
||||
|
||||
proxyFile.oss << " function varargout = string_serialize(this, varargin)\n";
|
||||
proxyFile.oss << " % STRING_SERIALIZE usage: string_serialize() : returns string\n";
|
||||
proxyFile.oss << " % Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html\n";
|
||||
proxyFile.oss
|
||||
<< " function varargout = string_serialize(this, varargin)\n";
|
||||
proxyFile.oss
|
||||
<< " % STRING_SERIALIZE usage: string_serialize() : returns string\n";
|
||||
proxyFile.oss
|
||||
<< " % Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html\n";
|
||||
proxyFile.oss << " if length(varargin) == 0\n";
|
||||
proxyFile.oss << " varargout{1} = " << wrapperName << "(" << boost::lexical_cast<string>(serialize_id) << ", this, varargin{:});\n";
|
||||
proxyFile.oss << " varargout{1} = " << wrapperName << "("
|
||||
<< boost::lexical_cast<string>(serialize_id) << ", this, varargin{:});\n";
|
||||
proxyFile.oss << " else\n";
|
||||
proxyFile.oss << " error('Arguments do not match any overload of function " << matlabQualName << ".string_serialize');\n";
|
||||
proxyFile.oss
|
||||
<< " error('Arguments do not match any overload of function "
|
||||
<< matlabQualName << ".string_serialize');\n";
|
||||
proxyFile.oss << " end\n";
|
||||
proxyFile.oss << " end\n\n";
|
||||
|
||||
|
@ -476,14 +512,16 @@ void Class::serialization_fragments(FileWriter& proxyFile, FileWriter& wrapperFi
|
|||
// end
|
||||
|
||||
proxyFile.oss << " function sobj = saveobj(obj)\n";
|
||||
proxyFile.oss << " % SAVEOBJ Saves the object to a matlab-readable format\n";
|
||||
proxyFile.oss
|
||||
<< " % SAVEOBJ Saves the object to a matlab-readable format\n";
|
||||
proxyFile.oss << " sobj = obj.string_serialize();\n";
|
||||
proxyFile.oss << " end\n";
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
void Class::deserialization_fragments(FileWriter& proxyFile, FileWriter& wrapperFile,
|
||||
const std::string& wrapperName, std::vector<std::string>& functionNames) const {
|
||||
void Class::deserialization_fragments(FileWriter& proxyFile,
|
||||
FileWriter& wrapperFile, const std::string& wrapperName,
|
||||
std::vector<std::string>& functionNames) const {
|
||||
//void Point3_string_deserialize_18(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
//{
|
||||
// typedef boost::shared_ptr<Point3> Shared;
|
||||
|
@ -495,32 +533,36 @@ void Class::deserialization_fragments(FileWriter& proxyFile, FileWriter& wrapper
|
|||
// in_archive >> *output;
|
||||
// out[0] = wrap_shared_ptr(output,"Point3", false);
|
||||
//}
|
||||
int deserialize_id = functionNames.size();
|
||||
const string
|
||||
matlabQualName = qualifiedName("."),
|
||||
matlabUniqueName = qualifiedName(),
|
||||
cppClassName = qualifiedName("::");
|
||||
const string wrapFunctionNameDeserialize = matlabUniqueName + "_string_deserialize_" + boost::lexical_cast<string>(deserialize_id);
|
||||
functionNames.push_back(wrapFunctionNameDeserialize);
|
||||
int deserialize_id = functionNames.size();
|
||||
const string matlabQualName = qualifiedName("."), matlabUniqueName =
|
||||
qualifiedName(), cppClassName = qualifiedName("::");
|
||||
const string wrapFunctionNameDeserialize = matlabUniqueName
|
||||
+ "_string_deserialize_" + boost::lexical_cast<string>(deserialize_id);
|
||||
functionNames.push_back(wrapFunctionNameDeserialize);
|
||||
|
||||
// call
|
||||
wrapperFile.oss << "void " << wrapFunctionNameDeserialize << "(int nargout, mxArray *out[], int nargin, const mxArray *in[])\n";
|
||||
wrapperFile.oss << "{\n";
|
||||
wrapperFile.oss << " typedef boost::shared_ptr<" << cppClassName << "> Shared;" << endl;
|
||||
// call
|
||||
wrapperFile.oss << "void " << wrapFunctionNameDeserialize
|
||||
<< "(int nargout, mxArray *out[], int nargin, const mxArray *in[])\n";
|
||||
wrapperFile.oss << "{\n";
|
||||
wrapperFile.oss << " typedef boost::shared_ptr<" << cppClassName
|
||||
<< "> Shared;" << endl;
|
||||
|
||||
// check arguments - for deserialize, 1 string argument
|
||||
wrapperFile.oss << " checkArguments(\"" << matlabUniqueName << ".string_deserialize\",nargout,nargin,1);\n";
|
||||
// check arguments - for deserialize, 1 string argument
|
||||
wrapperFile.oss << " checkArguments(\"" << matlabUniqueName
|
||||
<< ".string_deserialize\",nargout,nargin,1);\n";
|
||||
|
||||
// string argument with deserialization boilerplate
|
||||
wrapperFile.oss << " string serialized = unwrap< string >(in[0]);\n";
|
||||
wrapperFile.oss << " std::istringstream in_archive_stream(serialized);\n";
|
||||
wrapperFile.oss << " boost::archive::text_iarchive in_archive(in_archive_stream);\n";
|
||||
wrapperFile.oss << " Shared output(new " << cppClassName << "());\n";
|
||||
wrapperFile.oss << " in_archive >> *output;\n";
|
||||
wrapperFile.oss << " out[0] = wrap_shared_ptr(output,\"" << matlabQualName << "\", false);\n";
|
||||
wrapperFile.oss << "}\n";
|
||||
// string argument with deserialization boilerplate
|
||||
wrapperFile.oss << " string serialized = unwrap< string >(in[0]);\n";
|
||||
wrapperFile.oss << " std::istringstream in_archive_stream(serialized);\n";
|
||||
wrapperFile.oss
|
||||
<< " boost::archive::text_iarchive in_archive(in_archive_stream);\n";
|
||||
wrapperFile.oss << " Shared output(new " << cppClassName << "());\n";
|
||||
wrapperFile.oss << " in_archive >> *output;\n";
|
||||
wrapperFile.oss << " out[0] = wrap_shared_ptr(output,\"" << matlabQualName
|
||||
<< "\", false);\n";
|
||||
wrapperFile.oss << "}\n";
|
||||
|
||||
// Generate matlab function
|
||||
// Generate matlab function
|
||||
// function varargout = string_deserialize(varargin)
|
||||
// % STRING_DESERIALIZE usage: string_deserialize() : returns Point3
|
||||
// % Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
|
@ -531,32 +573,40 @@ void Class::deserialization_fragments(FileWriter& proxyFile, FileWriter& wrapper
|
|||
// end
|
||||
// end
|
||||
|
||||
proxyFile.oss << " function varargout = string_deserialize(varargin)\n";
|
||||
proxyFile.oss << " % STRING_DESERIALIZE usage: string_deserialize() : returns " << matlabQualName << "\n";
|
||||
proxyFile.oss << " % Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html\n";
|
||||
proxyFile.oss << " if length(varargin) == 1\n";
|
||||
proxyFile.oss << " varargout{1} = " << wrapperName << "(" << boost::lexical_cast<string>(deserialize_id) << ", varargin{:});\n";
|
||||
proxyFile.oss << " else\n";
|
||||
proxyFile.oss << " error('Arguments do not match any overload of function " << matlabQualName << ".string_deserialize');\n";
|
||||
proxyFile.oss << " end\n";
|
||||
proxyFile.oss << " end\n\n";
|
||||
proxyFile.oss << " function varargout = string_deserialize(varargin)\n";
|
||||
proxyFile.oss
|
||||
<< " % STRING_DESERIALIZE usage: string_deserialize() : returns "
|
||||
<< matlabQualName << "\n";
|
||||
proxyFile.oss
|
||||
<< " % Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html\n";
|
||||
proxyFile.oss << " if length(varargin) == 1\n";
|
||||
proxyFile.oss << " varargout{1} = " << wrapperName << "("
|
||||
<< boost::lexical_cast<string>(deserialize_id) << ", varargin{:});\n";
|
||||
proxyFile.oss << " else\n";
|
||||
proxyFile.oss
|
||||
<< " error('Arguments do not match any overload of function "
|
||||
<< matlabQualName << ".string_deserialize');\n";
|
||||
proxyFile.oss << " end\n";
|
||||
proxyFile.oss << " end\n\n";
|
||||
|
||||
|
||||
// Generate matlab load function
|
||||
// Generate matlab load function
|
||||
// function obj = loadobj(sobj)
|
||||
// % LOADOBJ Saves the object to a matlab-readable format
|
||||
// obj = Point3.string_deserialize(sobj);
|
||||
// end
|
||||
|
||||
proxyFile.oss << " function obj = loadobj(sobj)\n";
|
||||
proxyFile.oss << " % LOADOBJ Saves the object to a matlab-readable format\n";
|
||||
proxyFile.oss << " obj = " << matlabQualName << ".string_deserialize(sobj);\n";
|
||||
proxyFile.oss << " end" << endl;
|
||||
proxyFile.oss << " function obj = loadobj(sobj)\n";
|
||||
proxyFile.oss
|
||||
<< " % LOADOBJ Saves the object to a matlab-readable format\n";
|
||||
proxyFile.oss << " obj = " << matlabQualName
|
||||
<< ".string_deserialize(sobj);\n";
|
||||
proxyFile.oss << " end" << endl;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
std::string Class::getSerializationExport() const {
|
||||
//BOOST_CLASS_EXPORT_GUID(gtsam::SharedDiagonal, "gtsamSharedDiagonal");
|
||||
return "BOOST_CLASS_EXPORT_GUID(" + qualifiedName("::") + ", \"" + qualifiedName() + "\");";
|
||||
return "BOOST_CLASS_EXPORT_GUID(" + qualifiedName("::") + ", \""
|
||||
+ qualifiedName() + "\");";
|
||||
}
|
||||
/* ************************************************************************* */
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "Method.h"
|
||||
#include "StaticMethod.h"
|
||||
#include "TypeAttributesTable.h"
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
namespace wrap {
|
||||
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Argument.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Argument.h"
|
||||
|
||||
namespace wrap {
|
||||
|
||||
// Constructor class
|
||||
|
@ -34,7 +34,7 @@ struct Constructor {
|
|||
}
|
||||
|
||||
// Then the instance variables are set directly by the Module constructor
|
||||
std::vector<ArgumentList> args_list;
|
||||
std::vector<ArgumentList> args_list;
|
||||
std::string name;
|
||||
bool verbose_;
|
||||
|
||||
|
@ -50,21 +50,18 @@ struct Constructor {
|
|||
* if nargin == 2, obj.self = new_Pose3_RP(varargin{1},varargin{2}); end
|
||||
*/
|
||||
void proxy_fragment(FileWriter& file, const std::string& wrapperName,
|
||||
bool hasParent, const int id, const ArgumentList args) const;
|
||||
bool hasParent, const int id, const ArgumentList args) const;
|
||||
|
||||
/// cpp wrapper
|
||||
std::string wrapper_fragment(FileWriter& file,
|
||||
const std::string& cppClassName,
|
||||
const std::string& matlabUniqueName,
|
||||
const std::string& cppBaseClassName,
|
||||
int id,
|
||||
const ArgumentList& al) const;
|
||||
const std::string& cppClassName, const std::string& matlabUniqueName,
|
||||
const std::string& cppBaseClassName, int id,
|
||||
const ArgumentList& al) const;
|
||||
|
||||
/// constructor function
|
||||
void generate_construct(FileWriter& file, const std::string& cppClassName,
|
||||
std::vector<ArgumentList>& args_list) const;
|
||||
|
||||
std::vector<ArgumentList>& args_list) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // \namespace wrap
|
||||
|
|
|
@ -103,14 +103,9 @@ void GlobalFunction::generateSingleFunction(const std::string& toolboxPath, cons
|
|||
mfunctionFile.oss << "\n";
|
||||
|
||||
// output call to C++ wrapper
|
||||
string output;
|
||||
if(returnVal.isPair)
|
||||
output = "[ varargout{1} varargout{2} ] = ";
|
||||
else if(returnVal.category1 == ReturnValue::VOID)
|
||||
output = "";
|
||||
else
|
||||
output = "varargout{1} = ";
|
||||
mfunctionFile.oss << " " << output << wrapperName << "(" << id << ", varargin{:});\n";
|
||||
mfunctionFile.oss << " ";
|
||||
returnVal.emit_matlab(mfunctionFile);
|
||||
mfunctionFile.oss << wrapperName << "(" << id << ", varargin{:});\n";
|
||||
|
||||
// Output C++ wrapper code
|
||||
|
||||
|
|
216
wrap/Method.cpp
216
wrap/Method.cpp
|
@ -15,14 +15,15 @@
|
|||
* @author Richard Roberts
|
||||
**/
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include "Method.h"
|
||||
#include "utilities.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include "Method.h"
|
||||
#include "utilities.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
using namespace std;
|
||||
using namespace wrap;
|
||||
|
@ -38,155 +39,140 @@ void Method::addOverload(bool verbose, bool is_const, const std::string& name,
|
|||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
void Method::proxy_wrapper_fragments(FileWriter& proxyFile, FileWriter& wrapperFile,
|
||||
const string& cppClassName,
|
||||
const std::string& matlabQualName,
|
||||
const std::string& matlabUniqueName,
|
||||
const string& wrapperName,
|
||||
const TypeAttributesTable& typeAttributes,
|
||||
vector<string>& functionNames) const {
|
||||
void Method::proxy_wrapper_fragments(FileWriter& file, FileWriter& wrapperFile,
|
||||
const string& cppClassName, const std::string& matlabQualName,
|
||||
const std::string& matlabUniqueName, const string& wrapperName,
|
||||
const TypeAttributesTable& typeAttributes,
|
||||
vector<string>& functionNames) const {
|
||||
|
||||
proxyFile.oss << " function varargout = " << name << "(this, varargin)\n";
|
||||
//Comments for documentation
|
||||
string up_name = boost::to_upper_copy(name);
|
||||
proxyFile.oss << " % " << up_name << " usage:";
|
||||
// Create function header
|
||||
file.oss << " function varargout = " << name << "(this, varargin)\n";
|
||||
|
||||
// Emit comments for documentation
|
||||
string up_name = boost::to_upper_copy(name);
|
||||
file.oss << " % " << up_name << " usage: ";
|
||||
unsigned int argLCount = 0;
|
||||
BOOST_FOREACH(ArgumentList argList, argLists)
|
||||
{
|
||||
proxyFile.oss << " " << name << "(";
|
||||
unsigned int i = 0;
|
||||
BOOST_FOREACH(const Argument& arg, argList)
|
||||
{
|
||||
if(i != argList.size()-1)
|
||||
proxyFile.oss << arg.type << " " << arg.name << ", ";
|
||||
else
|
||||
proxyFile.oss << arg.type << " " << arg.name;
|
||||
i++;
|
||||
}
|
||||
if(argLCount != argLists.size()-1)
|
||||
proxyFile.oss << "), ";
|
||||
else
|
||||
proxyFile.oss << ") : returns " << returnVals[0].return_type(false, returnVals[0].pair) << endl;
|
||||
argLCount++;
|
||||
}
|
||||
|
||||
proxyFile.oss << " % " << "Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html" << endl;
|
||||
proxyFile.oss << " % " << "" << endl;
|
||||
proxyFile.oss << " % " << "Method Overloads" << endl;
|
||||
BOOST_FOREACH(ArgumentList argList, argLists)
|
||||
{
|
||||
proxyFile.oss << " % " << name << "(";
|
||||
unsigned int i = 0;
|
||||
BOOST_FOREACH(const Argument& arg, argList)
|
||||
{
|
||||
if(i != argList.size()-1)
|
||||
proxyFile.oss << arg.type << " " << arg.name << ", ";
|
||||
else
|
||||
proxyFile.oss << arg.type << " " << arg.name;
|
||||
i++;
|
||||
}
|
||||
proxyFile.oss << ")" << endl;
|
||||
}
|
||||
|
||||
for(size_t overload = 0; overload < argLists.size(); ++overload) {
|
||||
const ArgumentList& args = argLists[overload];
|
||||
const ReturnValue& returnVal = returnVals[overload];
|
||||
size_t nrArgs = args.size();
|
||||
|
||||
const int id = functionNames.size();
|
||||
|
||||
// Output proxy matlab code
|
||||
|
||||
// check for number of arguments...
|
||||
proxyFile.oss << " " << (overload==0?"":"else") << "if length(varargin) == " << nrArgs;
|
||||
if (nrArgs>0) proxyFile.oss << " && ";
|
||||
// ...and their types
|
||||
bool first = true;
|
||||
for(size_t i=0;i<nrArgs;i++) {
|
||||
if (!first) proxyFile.oss << " && ";
|
||||
proxyFile.oss << "isa(varargin{" << i+1 << "},'" << args[i].matlabClass(".") << "')";
|
||||
first=false;
|
||||
}
|
||||
proxyFile.oss << "\n";
|
||||
|
||||
// output call to C++ wrapper
|
||||
string output;
|
||||
if(returnVal.isPair)
|
||||
output = "[ varargout{1} varargout{2} ] = ";
|
||||
else if(returnVal.category1 == ReturnValue::VOID)
|
||||
output = "";
|
||||
BOOST_FOREACH(ArgumentList argList, argLists) {
|
||||
argList.emit_prototype(file, name);
|
||||
if (argLCount != argLists.size() - 1)
|
||||
file.oss << ", ";
|
||||
else
|
||||
output = "varargout{1} = ";
|
||||
proxyFile.oss << " " << output << wrapperName << "(" << id << ", this, varargin{:});\n";
|
||||
file.oss << " : returns "
|
||||
<< returnVals[0].return_type(false, returnVals[0].pair) << endl;
|
||||
argLCount++;
|
||||
}
|
||||
|
||||
// Emit URL to Doxygen page
|
||||
file.oss << " % "
|
||||
<< "Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html"
|
||||
<< endl;
|
||||
|
||||
// Document all overloads, if any
|
||||
if (argLists.size() > 1) {
|
||||
file.oss << " % " << "" << endl;
|
||||
file.oss << " % " << "Method Overloads" << endl;
|
||||
BOOST_FOREACH(ArgumentList argList, argLists) {
|
||||
file.oss << " % ";
|
||||
argList.emit_prototype(file, name);
|
||||
file.oss << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle special case of single overload with all numeric arguments
|
||||
if (argLists.size() == 1 && argLists[0].allScalar()) {
|
||||
// Output proxy matlab code
|
||||
file.oss << " ";
|
||||
const int id = (int) functionNames.size();
|
||||
argLists[0].emit_call(file, returnVals[0], wrapperName, id);
|
||||
|
||||
// Output C++ wrapper code
|
||||
|
||||
const string wrapFunctionName = wrapper_fragment(
|
||||
wrapperFile, cppClassName, matlabUniqueName, overload, id, typeAttributes);
|
||||
const string wrapFunctionName = wrapper_fragment(wrapperFile, cppClassName,
|
||||
matlabUniqueName, 0, id, typeAttributes);
|
||||
|
||||
// Add to function list
|
||||
functionNames.push_back(wrapFunctionName);
|
||||
} else {
|
||||
// Check arguments for all overloads
|
||||
for (size_t overload = 0; overload < argLists.size(); ++overload) {
|
||||
|
||||
// Output proxy matlab code
|
||||
file.oss << " " << (overload == 0 ? "" : "else");
|
||||
const int id = (int) functionNames.size();
|
||||
argLists[overload].emit_conditional_call(file, returnVals[overload],
|
||||
wrapperName, id);
|
||||
|
||||
// Output C++ wrapper code
|
||||
const string wrapFunctionName = wrapper_fragment(wrapperFile,
|
||||
cppClassName, matlabUniqueName, overload, id, typeAttributes);
|
||||
|
||||
// Add to function list
|
||||
functionNames.push_back(wrapFunctionName);
|
||||
}
|
||||
file.oss << " else\n";
|
||||
file.oss
|
||||
<< " error('Arguments do not match any overload of function "
|
||||
<< matlabQualName << "." << name << "');" << endl;
|
||||
file.oss << " end\n";
|
||||
}
|
||||
|
||||
proxyFile.oss << " else\n";
|
||||
proxyFile.oss << " error('Arguments do not match any overload of function " <<
|
||||
matlabQualName << "." << name << "');" << endl;
|
||||
|
||||
proxyFile.oss << " end\n";
|
||||
proxyFile.oss << " end\n";
|
||||
file.oss << " end\n";
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
string Method::wrapper_fragment(FileWriter& file,
|
||||
const string& cppClassName,
|
||||
const string& matlabUniqueName,
|
||||
int overload,
|
||||
int id,
|
||||
const TypeAttributesTable& typeAttributes) const {
|
||||
string Method::wrapper_fragment(FileWriter& file, const string& cppClassName,
|
||||
const string& matlabUniqueName, int overload, int id,
|
||||
const TypeAttributesTable& typeAttributes) const {
|
||||
|
||||
// generate code
|
||||
|
||||
const string wrapFunctionName = matlabUniqueName + "_" + name + "_" + boost::lexical_cast<string>(id);
|
||||
const string wrapFunctionName = matlabUniqueName + "_" + name + "_"
|
||||
+ boost::lexical_cast<string>(id);
|
||||
|
||||
const ArgumentList& args = argLists[overload];
|
||||
const ReturnValue& returnVal = returnVals[overload];
|
||||
|
||||
// call
|
||||
file.oss << "void " << wrapFunctionName << "(int nargout, mxArray *out[], int nargin, const mxArray *in[])\n";
|
||||
file.oss << "void " << wrapFunctionName
|
||||
<< "(int nargout, mxArray *out[], int nargin, const mxArray *in[])\n";
|
||||
// start
|
||||
file.oss << "{\n";
|
||||
|
||||
if(returnVal.isPair)
|
||||
{
|
||||
if(returnVal.category1 == ReturnValue::CLASS)
|
||||
file.oss << " typedef boost::shared_ptr<" << returnVal.qualifiedType1("::") << "> Shared" << returnVal.type1 << ";"<< endl;
|
||||
if(returnVal.category2 == ReturnValue::CLASS)
|
||||
file.oss << " typedef boost::shared_ptr<" << returnVal.qualifiedType2("::") << "> Shared" << returnVal.type2 << ";"<< endl;
|
||||
}
|
||||
else
|
||||
if(returnVal.category1 == ReturnValue::CLASS)
|
||||
file.oss << " typedef boost::shared_ptr<" << returnVal.qualifiedType1("::") << "> Shared" << returnVal.type1 << ";"<< endl;
|
||||
if (returnVal.isPair) {
|
||||
if (returnVal.category1 == ReturnValue::CLASS)
|
||||
file.oss << " typedef boost::shared_ptr<"
|
||||
<< returnVal.qualifiedType1("::") << "> Shared" << returnVal.type1
|
||||
<< ";" << endl;
|
||||
if (returnVal.category2 == ReturnValue::CLASS)
|
||||
file.oss << " typedef boost::shared_ptr<"
|
||||
<< returnVal.qualifiedType2("::") << "> Shared" << returnVal.type2
|
||||
<< ";" << endl;
|
||||
} else if (returnVal.category1 == ReturnValue::CLASS)
|
||||
file.oss << " typedef boost::shared_ptr<" << returnVal.qualifiedType1("::")
|
||||
<< "> Shared" << returnVal.type1 << ";" << endl;
|
||||
|
||||
file.oss << " typedef boost::shared_ptr<" << cppClassName << "> Shared;" << endl;
|
||||
file.oss << " typedef boost::shared_ptr<" << cppClassName << "> Shared;"
|
||||
<< endl;
|
||||
|
||||
// check arguments
|
||||
// extra argument obj -> nargin-1 is passed !
|
||||
// example: checkArguments("equals",nargout,nargin-1,2);
|
||||
file.oss << " checkArguments(\"" << name << "\",nargout,nargin-1," << args.size() << ");\n";
|
||||
file.oss << " checkArguments(\"" << name << "\",nargout,nargin-1,"
|
||||
<< args.size() << ");\n";
|
||||
|
||||
// get class pointer
|
||||
// example: shared_ptr<Test> = unwrap_shared_ptr< Test >(in[0], "Test");
|
||||
file.oss << " Shared obj = unwrap_shared_ptr<" << cppClassName << ">(in[0], \"ptr_" << matlabUniqueName << "\");" << endl;
|
||||
file.oss << " Shared obj = unwrap_shared_ptr<" << cppClassName
|
||||
<< ">(in[0], \"ptr_" << matlabUniqueName << "\");" << endl;
|
||||
// unwrap arguments, see Argument.cpp
|
||||
args.matlab_unwrap(file,1);
|
||||
args.matlab_unwrap(file, 1);
|
||||
|
||||
// call method and wrap result
|
||||
// example: out[0]=wrap<bool>(self->return_field(t));
|
||||
if (returnVal.type1!="void")
|
||||
returnVal.wrap_result("obj->"+name+"("+args.names()+")", file, typeAttributes);
|
||||
if (returnVal.type1 != "void")
|
||||
returnVal.wrap_result("obj->" + name + "(" + args.names() + ")", file,
|
||||
typeAttributes);
|
||||
else
|
||||
file.oss << " obj->"+name+"("+args.names()+");\n";
|
||||
file.oss << " obj->" + name + "(" + args.names() + ");\n";
|
||||
|
||||
// finish
|
||||
file.oss << "}\n";
|
||||
|
|
|
@ -18,13 +18,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
#include "Argument.h"
|
||||
#include "ReturnValue.h"
|
||||
#include "TypeAttributesTable.h"
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
namespace wrap {
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ void Module::parseMarkup(const std::string& data) {
|
|||
// The one with postfix 0 are used to reset the variables after parse.
|
||||
string methodName, methodName0;
|
||||
bool isConst, isConst0 = false;
|
||||
ReturnValue retVal0(verbose), retVal(verbose);
|
||||
ReturnValue retVal0, retVal;
|
||||
Argument arg0, arg;
|
||||
ArgumentList args0, args;
|
||||
vector<string> arg_dup; ///keep track of duplicates
|
||||
|
|
|
@ -141,5 +141,13 @@ void ReturnValue::wrapTypeUnwrap(FileWriter& wrapperFile) const {
|
|||
}
|
||||
}
|
||||
/* ************************************************************************* */
|
||||
void ReturnValue::emit_matlab(FileWriter& file) const {
|
||||
string output;
|
||||
if (isPair)
|
||||
file.oss << "[ varargout{1} varargout{2} ] = ";
|
||||
else if (category1 != ReturnValue::VOID)
|
||||
file.oss << "varargout{1} = ";
|
||||
}
|
||||
/* ************************************************************************* */
|
||||
|
||||
|
||||
|
|
|
@ -8,36 +8,36 @@
|
|||
* @author Richard Roberts
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "FileWriter.h"
|
||||
#include "TypeAttributesTable.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace wrap {
|
||||
|
||||
/**
|
||||
* Encapsulates return value of a method or function
|
||||
*/
|
||||
struct ReturnValue {
|
||||
|
||||
/// the different supported return value categories
|
||||
typedef enum {
|
||||
CLASS = 1,
|
||||
EIGEN = 2,
|
||||
BASIS = 3,
|
||||
VOID = 4
|
||||
CLASS = 1, EIGEN = 2, BASIS = 3, VOID = 4
|
||||
} return_category;
|
||||
|
||||
ReturnValue(bool enable_verbosity = true)
|
||||
: verbose(enable_verbosity), isPtr1(false), isPtr2(false),
|
||||
isPair(false), category1(CLASS), category2(CLASS)
|
||||
{}
|
||||
|
||||
bool verbose;
|
||||
bool isPtr1, isPtr2, isPair;
|
||||
return_category category1, category2;
|
||||
std::string type1, type2;
|
||||
std::vector<std::string> namespaces1, namespaces2;
|
||||
|
||||
/// Constructor
|
||||
ReturnValue() :
|
||||
isPtr1(false), isPtr2(false), isPair(false), category1(CLASS), category2(
|
||||
CLASS) {
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
arg1, arg2, pair
|
||||
} pairing;
|
||||
|
@ -49,10 +49,12 @@ struct ReturnValue {
|
|||
|
||||
std::string matlab_returnType() const;
|
||||
|
||||
void wrap_result(const std::string& result, FileWriter& file, const TypeAttributesTable& typeAttributes) const;
|
||||
void wrap_result(const std::string& result, FileWriter& file,
|
||||
const TypeAttributesTable& typeAttributes) const;
|
||||
|
||||
void wrapTypeUnwrap(FileWriter& wrapperFile) const;
|
||||
|
||||
void emit_matlab(FileWriter& file) const;
|
||||
};
|
||||
|
||||
} // \namespace wrap
|
||||
|
|
|
@ -16,19 +16,19 @@
|
|||
* @author Richard Roberts
|
||||
**/
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "StaticMethod.h"
|
||||
#include "utilities.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
using namespace std;
|
||||
using namespace wrap;
|
||||
|
||||
|
||||
/* ************************************************************************* */
|
||||
void StaticMethod::addOverload(bool verbose, const std::string& name,
|
||||
const ArgumentList& args, const ReturnValue& retVal) {
|
||||
|
@ -39,144 +39,103 @@ void StaticMethod::addOverload(bool verbose, const std::string& name,
|
|||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
void StaticMethod::proxy_wrapper_fragments(FileWriter& proxyFile, FileWriter& wrapperFile,
|
||||
const string& cppClassName,
|
||||
const std::string& matlabQualName,
|
||||
const std::string& matlabUniqueName,
|
||||
const string& wrapperName,
|
||||
const TypeAttributesTable& typeAttributes,
|
||||
vector<string>& functionNames) const {
|
||||
void StaticMethod::proxy_wrapper_fragments(FileWriter& file,
|
||||
FileWriter& wrapperFile, const string& cppClassName,
|
||||
const std::string& matlabQualName, const std::string& matlabUniqueName,
|
||||
const string& wrapperName, const TypeAttributesTable& typeAttributes,
|
||||
vector<string>& functionNames) const {
|
||||
|
||||
string upperName = name; upperName[0] = std::toupper(upperName[0], std::locale());
|
||||
string upperName = name;
|
||||
upperName[0] = std::toupper(upperName[0], std::locale());
|
||||
|
||||
proxyFile.oss << " function varargout = " << upperName << "(varargin)\n";
|
||||
file.oss << " function varargout = " << upperName << "(varargin)\n";
|
||||
//Comments for documentation
|
||||
string up_name = boost::to_upper_copy(name);
|
||||
proxyFile.oss << " % " << up_name << " usage:";
|
||||
string up_name = boost::to_upper_copy(name);
|
||||
file.oss << " % " << up_name << " usage: ";
|
||||
unsigned int argLCount = 0;
|
||||
BOOST_FOREACH(ArgumentList argList, argLists)
|
||||
{
|
||||
proxyFile.oss << " " << name << "(";
|
||||
unsigned int i = 0;
|
||||
BOOST_FOREACH(const Argument& arg, argList)
|
||||
{
|
||||
if(i != argList.size()-1)
|
||||
proxyFile.oss << arg.type << " " << arg.name << ", ";
|
||||
else
|
||||
proxyFile.oss << arg.type << " " << arg.name;
|
||||
i++;
|
||||
}
|
||||
if(argLCount != argLists.size()-1)
|
||||
proxyFile.oss << "), ";
|
||||
else
|
||||
proxyFile.oss << ") : returns " << returnVals[0].return_type(false, returnVals[0].pair) << endl;
|
||||
argLCount++;
|
||||
}
|
||||
BOOST_FOREACH(ArgumentList argList, argLists) {
|
||||
argList.emit_prototype(file, name);
|
||||
if (argLCount != argLists.size() - 1)
|
||||
file.oss << ", ";
|
||||
else
|
||||
file.oss << " : returns "
|
||||
<< returnVals[0].return_type(false, returnVals[0].pair) << endl;
|
||||
argLCount++;
|
||||
}
|
||||
|
||||
proxyFile.oss << " % " << "Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html" << endl;
|
||||
proxyFile.oss << " % " << "" << endl;
|
||||
proxyFile.oss << " % " << "Usage" << endl;
|
||||
BOOST_FOREACH(ArgumentList argList, argLists)
|
||||
{
|
||||
proxyFile.oss << " % " << up_name << "(";
|
||||
unsigned int i = 0;
|
||||
BOOST_FOREACH(const Argument& arg, argList)
|
||||
{
|
||||
if(i != argList.size()-1)
|
||||
proxyFile.oss << arg.type << " " << arg.name << ", ";
|
||||
else
|
||||
proxyFile.oss << arg.type << " " << arg.name;
|
||||
i++;
|
||||
}
|
||||
proxyFile.oss << ")" << endl;
|
||||
}
|
||||
file.oss << " % "
|
||||
<< "Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html"
|
||||
<< endl;
|
||||
file.oss << " % " << "" << endl;
|
||||
file.oss << " % " << "Usage" << endl;
|
||||
BOOST_FOREACH(ArgumentList argList, argLists) {
|
||||
file.oss << " % ";
|
||||
argList.emit_prototype(file, up_name);
|
||||
file.oss << endl;
|
||||
}
|
||||
|
||||
|
||||
for(size_t overload = 0; overload < argLists.size(); ++overload) {
|
||||
const ArgumentList& args = argLists[overload];
|
||||
const ReturnValue& returnVal = returnVals[overload];
|
||||
size_t nrArgs = args.size();
|
||||
|
||||
const int id = (int)functionNames.size();
|
||||
// Check arguments for all overloads
|
||||
for (size_t overload = 0; overload < argLists.size(); ++overload) {
|
||||
|
||||
// Output proxy matlab code
|
||||
|
||||
// check for number of arguments...
|
||||
proxyFile.oss << " " << (overload==0?"":"else") << "if length(varargin) == " << nrArgs;
|
||||
if (nrArgs>0) proxyFile.oss << " && ";
|
||||
// ...and their types
|
||||
bool first = true;
|
||||
for(size_t i=0;i<nrArgs;i++) {
|
||||
if (!first) proxyFile.oss << " && ";
|
||||
proxyFile.oss << "isa(varargin{" << i+1 << "},'" << args[i].matlabClass(".") << "')";
|
||||
first=false;
|
||||
}
|
||||
proxyFile.oss << "\n";
|
||||
|
||||
// output call to C++ wrapper
|
||||
string output;
|
||||
if(returnVal.isPair)
|
||||
output = "[ varargout{1} varargout{2} ] = ";
|
||||
else if(returnVal.category1 == ReturnValue::VOID)
|
||||
output = "";
|
||||
else
|
||||
output = "varargout{1} = ";
|
||||
proxyFile.oss << " " << output << wrapperName << "(" << id << ", varargin{:});\n";
|
||||
file.oss << " " << (overload == 0 ? "" : "else");
|
||||
const int id = (int) functionNames.size();
|
||||
argLists[overload].emit_conditional_call(file, returnVals[overload],
|
||||
wrapperName, id, true); // last bool is to indicate static !
|
||||
|
||||
// Output C++ wrapper code
|
||||
|
||||
const string wrapFunctionName = wrapper_fragment(
|
||||
wrapperFile, cppClassName, matlabUniqueName, (int)overload, id, typeAttributes);
|
||||
const string wrapFunctionName = wrapper_fragment(wrapperFile, cppClassName,
|
||||
matlabUniqueName, (int) overload, id, typeAttributes);
|
||||
|
||||
// Add to function list
|
||||
functionNames.push_back(wrapFunctionName);
|
||||
|
||||
}
|
||||
|
||||
proxyFile.oss << " else\n";
|
||||
proxyFile.oss << " error('Arguments do not match any overload of function " <<
|
||||
matlabQualName << "." << upperName << "');" << endl;
|
||||
file.oss << " else\n";
|
||||
file.oss << " error('Arguments do not match any overload of function "
|
||||
<< matlabQualName << "." << upperName << "');" << endl;
|
||||
file.oss << " end\n";
|
||||
|
||||
proxyFile.oss << " end\n";
|
||||
proxyFile.oss << " end\n";
|
||||
file.oss << " end\n";
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
string StaticMethod::wrapper_fragment(FileWriter& file,
|
||||
const string& cppClassName,
|
||||
const string& matlabUniqueName,
|
||||
int overload,
|
||||
int id,
|
||||
const TypeAttributesTable& typeAttributes) const {
|
||||
string StaticMethod::wrapper_fragment(FileWriter& file,
|
||||
const string& cppClassName, const string& matlabUniqueName, int overload,
|
||||
int id, const TypeAttributesTable& typeAttributes) const {
|
||||
|
||||
// generate code
|
||||
|
||||
const string wrapFunctionName = matlabUniqueName + "_" + name + "_" + boost::lexical_cast<string>(id);
|
||||
const string wrapFunctionName = matlabUniqueName + "_" + name + "_"
|
||||
+ boost::lexical_cast<string>(id);
|
||||
|
||||
const ArgumentList& args = argLists[overload];
|
||||
const ReturnValue& returnVal = returnVals[overload];
|
||||
|
||||
// call
|
||||
file.oss << "void " << wrapFunctionName << "(int nargout, mxArray *out[], int nargin, const mxArray *in[])\n";
|
||||
file.oss << "void " << wrapFunctionName
|
||||
<< "(int nargout, mxArray *out[], int nargin, const mxArray *in[])\n";
|
||||
// start
|
||||
file.oss << "{\n";
|
||||
|
||||
returnVal.wrapTypeUnwrap(file);
|
||||
|
||||
file.oss << " typedef boost::shared_ptr<" << cppClassName << "> Shared;" << endl;
|
||||
file.oss << " typedef boost::shared_ptr<" << cppClassName << "> Shared;"
|
||||
<< endl;
|
||||
|
||||
// check arguments
|
||||
// NOTE: for static functions, there is no object passed
|
||||
file.oss << " checkArguments(\"" << matlabUniqueName << "." << name << "\",nargout,nargin," << args.size() << ");\n";
|
||||
file.oss << " checkArguments(\"" << matlabUniqueName << "." << name
|
||||
<< "\",nargout,nargin," << args.size() << ");\n";
|
||||
|
||||
// unwrap arguments, see Argument.cpp
|
||||
args.matlab_unwrap(file,0); // We start at 0 because there is no self object
|
||||
args.matlab_unwrap(file, 0); // We start at 0 because there is no self object
|
||||
|
||||
// call method with default type and wrap result
|
||||
if (returnVal.type1!="void")
|
||||
returnVal.wrap_result(cppClassName+"::"+name+"("+args.names()+")", file, typeAttributes);
|
||||
if (returnVal.type1 != "void")
|
||||
returnVal.wrap_result(cppClassName + "::" + name + "(" + args.names() + ")",
|
||||
file, typeAttributes);
|
||||
else
|
||||
file.oss << cppClassName+"::"+name+"("+args.names()+");\n";
|
||||
file.oss << cppClassName + "::" + name + "(" + args.names() + ");\n";
|
||||
|
||||
// finish
|
||||
file.oss << "}\n";
|
||||
|
|
|
@ -19,13 +19,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
#include "Argument.h"
|
||||
#include "ReturnValue.h"
|
||||
#include "TypeAttributesTable.h"
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
namespace wrap {
|
||||
|
||||
|
@ -34,7 +30,8 @@ struct StaticMethod {
|
|||
|
||||
/// Constructor creates empty object
|
||||
StaticMethod(bool verbosity = true) :
|
||||
verbose(verbosity) {}
|
||||
verbose(verbosity) {
|
||||
}
|
||||
|
||||
// Then the instance variables are set directly by the Module constructor
|
||||
bool verbose;
|
||||
|
@ -46,22 +43,20 @@ struct StaticMethod {
|
|||
// with those in rhs, but in subsequent calls it adds additional argument
|
||||
// lists as function overloads.
|
||||
void addOverload(bool verbose, const std::string& name,
|
||||
const ArgumentList& args, const ReturnValue& retVal);
|
||||
const ArgumentList& args, const ReturnValue& retVal);
|
||||
|
||||
// MATLAB code generation
|
||||
// classPath is class directory, e.g., ../matlab/@Point2
|
||||
void proxy_wrapper_fragments(FileWriter& proxyFile, FileWriter& wrapperFile,
|
||||
const std::string& cppClassName, const std::string& matlabQualName, const std::string& matlabUniqueName,
|
||||
const std::string& wrapperName, const TypeAttributesTable& typeAttributes,
|
||||
std::vector<std::string>& functionNames) const;
|
||||
const std::string& cppClassName, const std::string& matlabQualName,
|
||||
const std::string& matlabUniqueName, const std::string& wrapperName,
|
||||
const TypeAttributesTable& typeAttributes,
|
||||
std::vector<std::string>& functionNames) const;
|
||||
|
||||
private:
|
||||
std::string wrapper_fragment(FileWriter& file,
|
||||
const std::string& cppClassName,
|
||||
const std::string& matlabUniqueName,
|
||||
int overload,
|
||||
int id,
|
||||
const TypeAttributesTable& typeAttributes) const; ///< cpp wrapper
|
||||
const std::string& cppClassName, const std::string& matlabUniqueName,
|
||||
int overload, int id, const TypeAttributesTable& typeAttributes) const; ///< cpp wrapper
|
||||
};
|
||||
|
||||
} // \namespace wrap
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
*.m~
|
|
@ -44,92 +44,43 @@ classdef Point2 < handle
|
|||
function varargout = argChar(this, varargin)
|
||||
% ARGCHAR usage: argChar(char a) : returns void
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% argChar(char a)
|
||||
if length(varargin) == 1 && isa(varargin{1},'char')
|
||||
geometry_wrapper(4, this, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function Point2.argChar');
|
||||
end
|
||||
geometry_wrapper(4, this, varargin{:});
|
||||
end
|
||||
|
||||
function varargout = argUChar(this, varargin)
|
||||
% ARGUCHAR usage: argUChar(unsigned char a) : returns void
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% argUChar(unsigned char a)
|
||||
if length(varargin) == 1 && isa(varargin{1},'char')
|
||||
geometry_wrapper(5, this, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function Point2.argUChar');
|
||||
end
|
||||
geometry_wrapper(5, this, varargin{:});
|
||||
end
|
||||
|
||||
function varargout = dim(this, varargin)
|
||||
% DIM usage: dim() : returns int
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% dim()
|
||||
if length(varargin) == 0
|
||||
varargout{1} = geometry_wrapper(6, this, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function Point2.dim');
|
||||
end
|
||||
varargout{1} = geometry_wrapper(6, this, varargin{:});
|
||||
end
|
||||
|
||||
function varargout = returnChar(this, varargin)
|
||||
% RETURNCHAR usage: returnChar() : returns char
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% returnChar()
|
||||
if length(varargin) == 0
|
||||
varargout{1} = geometry_wrapper(7, this, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function Point2.returnChar');
|
||||
end
|
||||
varargout{1} = geometry_wrapper(7, this, varargin{:});
|
||||
end
|
||||
|
||||
function varargout = vectorConfusion(this, varargin)
|
||||
% VECTORCONFUSION usage: vectorConfusion() : returns VectorNotEigen
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% vectorConfusion()
|
||||
if length(varargin) == 0
|
||||
varargout{1} = geometry_wrapper(8, this, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function Point2.vectorConfusion');
|
||||
end
|
||||
varargout{1} = geometry_wrapper(8, this, varargin{:});
|
||||
end
|
||||
|
||||
function varargout = x(this, varargin)
|
||||
% X usage: x() : returns double
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% x()
|
||||
if length(varargin) == 0
|
||||
varargout{1} = geometry_wrapper(9, this, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function Point2.x');
|
||||
end
|
||||
varargout{1} = geometry_wrapper(9, this, varargin{:});
|
||||
end
|
||||
|
||||
function varargout = y(this, varargin)
|
||||
% Y usage: y() : returns double
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% y()
|
||||
if length(varargin) == 0
|
||||
varargout{1} = geometry_wrapper(10, this, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function Point2.y');
|
||||
end
|
||||
varargout{1} = geometry_wrapper(10, this, varargin{:});
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -43,14 +43,7 @@ classdef Point3 < handle
|
|||
function varargout = norm(this, varargin)
|
||||
% NORM usage: norm() : returns double
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% norm()
|
||||
if length(varargin) == 0
|
||||
varargout{1} = geometry_wrapper(14, this, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function Point3.norm');
|
||||
end
|
||||
varargout{1} = geometry_wrapper(14, this, varargin{:});
|
||||
end
|
||||
|
||||
function varargout = string_serialize(this, varargin)
|
||||
|
|
|
@ -56,9 +56,6 @@ classdef Test < handle
|
|||
function varargout = arg_EigenConstRef(this, varargin)
|
||||
% ARG_EIGENCONSTREF usage: arg_EigenConstRef(Matrix value) : returns void
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% arg_EigenConstRef(Matrix value)
|
||||
if length(varargin) == 1 && isa(varargin{1},'double')
|
||||
geometry_wrapper(23, this, varargin{:});
|
||||
else
|
||||
|
@ -69,61 +66,30 @@ classdef Test < handle
|
|||
function varargout = create_MixedPtrs(this, varargin)
|
||||
% CREATE_MIXEDPTRS usage: create_MixedPtrs() : returns pair< Test, SharedTest >
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% create_MixedPtrs()
|
||||
if length(varargin) == 0
|
||||
[ varargout{1} varargout{2} ] = geometry_wrapper(24, this, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function Test.create_MixedPtrs');
|
||||
end
|
||||
[ varargout{1} varargout{2} ] = geometry_wrapper(24, this, varargin{:});
|
||||
end
|
||||
|
||||
function varargout = create_ptrs(this, varargin)
|
||||
% CREATE_PTRS usage: create_ptrs() : returns pair< SharedTest, SharedTest >
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% create_ptrs()
|
||||
if length(varargin) == 0
|
||||
[ varargout{1} varargout{2} ] = geometry_wrapper(25, this, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function Test.create_ptrs');
|
||||
end
|
||||
[ varargout{1} varargout{2} ] = geometry_wrapper(25, this, varargin{:});
|
||||
end
|
||||
|
||||
function varargout = print(this, varargin)
|
||||
% PRINT usage: print() : returns void
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% print()
|
||||
if length(varargin) == 0
|
||||
geometry_wrapper(26, this, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function Test.print');
|
||||
end
|
||||
geometry_wrapper(26, this, varargin{:});
|
||||
end
|
||||
|
||||
function varargout = return_Point2Ptr(this, varargin)
|
||||
% RETURN_POINT2PTR usage: return_Point2Ptr(bool value) : returns Point2
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% return_Point2Ptr(bool value)
|
||||
if length(varargin) == 1 && isa(varargin{1},'logical')
|
||||
varargout{1} = geometry_wrapper(27, this, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function Test.return_Point2Ptr');
|
||||
end
|
||||
varargout{1} = geometry_wrapper(27, this, varargin{:});
|
||||
end
|
||||
|
||||
function varargout = return_Test(this, varargin)
|
||||
% RETURN_TEST usage: return_Test(Test value) : returns Test
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% return_Test(Test value)
|
||||
if length(varargin) == 1 && isa(varargin{1},'Test')
|
||||
varargout{1} = geometry_wrapper(28, this, varargin{:});
|
||||
else
|
||||
|
@ -134,9 +100,6 @@ classdef Test < handle
|
|||
function varargout = return_TestPtr(this, varargin)
|
||||
% RETURN_TESTPTR usage: return_TestPtr(Test value) : returns Test
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% return_TestPtr(Test value)
|
||||
if length(varargin) == 1 && isa(varargin{1},'Test')
|
||||
varargout{1} = geometry_wrapper(29, this, varargin{:});
|
||||
else
|
||||
|
@ -147,35 +110,18 @@ classdef Test < handle
|
|||
function varargout = return_bool(this, varargin)
|
||||
% RETURN_BOOL usage: return_bool(bool value) : returns bool
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% return_bool(bool value)
|
||||
if length(varargin) == 1 && isa(varargin{1},'logical')
|
||||
varargout{1} = geometry_wrapper(30, this, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function Test.return_bool');
|
||||
end
|
||||
varargout{1} = geometry_wrapper(30, this, varargin{:});
|
||||
end
|
||||
|
||||
function varargout = return_double(this, varargin)
|
||||
% RETURN_DOUBLE usage: return_double(double value) : returns double
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% return_double(double value)
|
||||
if length(varargin) == 1 && isa(varargin{1},'double')
|
||||
varargout{1} = geometry_wrapper(31, this, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function Test.return_double');
|
||||
end
|
||||
varargout{1} = geometry_wrapper(31, this, varargin{:});
|
||||
end
|
||||
|
||||
function varargout = return_field(this, varargin)
|
||||
% RETURN_FIELD usage: return_field(Test t) : returns bool
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% return_field(Test t)
|
||||
if length(varargin) == 1 && isa(varargin{1},'Test')
|
||||
varargout{1} = geometry_wrapper(32, this, varargin{:});
|
||||
else
|
||||
|
@ -186,22 +132,12 @@ classdef Test < handle
|
|||
function varargout = return_int(this, varargin)
|
||||
% RETURN_INT usage: return_int(int value) : returns int
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% return_int(int value)
|
||||
if length(varargin) == 1 && isa(varargin{1},'numeric')
|
||||
varargout{1} = geometry_wrapper(33, this, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function Test.return_int');
|
||||
end
|
||||
varargout{1} = geometry_wrapper(33, this, varargin{:});
|
||||
end
|
||||
|
||||
function varargout = return_matrix1(this, varargin)
|
||||
% RETURN_MATRIX1 usage: return_matrix1(Matrix value) : returns Matrix
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% return_matrix1(Matrix value)
|
||||
if length(varargin) == 1 && isa(varargin{1},'double')
|
||||
varargout{1} = geometry_wrapper(34, this, varargin{:});
|
||||
else
|
||||
|
@ -212,9 +148,6 @@ classdef Test < handle
|
|||
function varargout = return_matrix2(this, varargin)
|
||||
% RETURN_MATRIX2 usage: return_matrix2(Matrix value) : returns Matrix
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% return_matrix2(Matrix value)
|
||||
if length(varargin) == 1 && isa(varargin{1},'double')
|
||||
varargout{1} = geometry_wrapper(35, this, varargin{:});
|
||||
else
|
||||
|
@ -225,9 +158,6 @@ classdef Test < handle
|
|||
function varargout = return_pair(this, varargin)
|
||||
% RETURN_PAIR usage: return_pair(Vector v, Matrix A) : returns pair< Vector, Matrix >
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% return_pair(Vector v, Matrix A)
|
||||
if length(varargin) == 2 && isa(varargin{1},'double') && isa(varargin{2},'double')
|
||||
[ varargout{1} varargout{2} ] = geometry_wrapper(36, this, varargin{:});
|
||||
else
|
||||
|
@ -238,9 +168,6 @@ classdef Test < handle
|
|||
function varargout = return_ptrs(this, varargin)
|
||||
% RETURN_PTRS usage: return_ptrs(Test p1, Test p2) : returns pair< SharedTest, SharedTest >
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% return_ptrs(Test p1, Test p2)
|
||||
if length(varargin) == 2 && isa(varargin{1},'Test') && isa(varargin{2},'Test')
|
||||
[ varargout{1} varargout{2} ] = geometry_wrapper(37, this, varargin{:});
|
||||
else
|
||||
|
@ -251,22 +178,12 @@ classdef Test < handle
|
|||
function varargout = return_size_t(this, varargin)
|
||||
% RETURN_SIZE_T usage: return_size_t(size_t value) : returns size_t
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% return_size_t(size_t value)
|
||||
if length(varargin) == 1 && isa(varargin{1},'numeric')
|
||||
varargout{1} = geometry_wrapper(38, this, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function Test.return_size_t');
|
||||
end
|
||||
varargout{1} = geometry_wrapper(38, this, varargin{:});
|
||||
end
|
||||
|
||||
function varargout = return_string(this, varargin)
|
||||
% RETURN_STRING usage: return_string(string value) : returns string
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% return_string(string value)
|
||||
if length(varargin) == 1 && isa(varargin{1},'char')
|
||||
varargout{1} = geometry_wrapper(39, this, varargin{:});
|
||||
else
|
||||
|
@ -277,9 +194,6 @@ classdef Test < handle
|
|||
function varargout = return_vector1(this, varargin)
|
||||
% RETURN_VECTOR1 usage: return_vector1(Vector value) : returns Vector
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% return_vector1(Vector value)
|
||||
if length(varargin) == 1 && isa(varargin{1},'double')
|
||||
varargout{1} = geometry_wrapper(40, this, varargin{:});
|
||||
else
|
||||
|
@ -290,9 +204,6 @@ classdef Test < handle
|
|||
function varargout = return_vector2(this, varargin)
|
||||
% RETURN_VECTOR2 usage: return_vector2(Vector value) : returns Vector
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% return_vector2(Vector value)
|
||||
if length(varargin) == 1 && isa(varargin{1},'double')
|
||||
varargout{1} = geometry_wrapper(41, this, varargin{:});
|
||||
else
|
||||
|
|
|
@ -40,22 +40,12 @@ classdef ClassA < handle
|
|||
function varargout = memberFunction(this, varargin)
|
||||
% MEMBERFUNCTION usage: memberFunction() : returns double
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% memberFunction()
|
||||
if length(varargin) == 0
|
||||
varargout{1} = testNamespaces_wrapper(9, this, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function ns2.ClassA.memberFunction');
|
||||
end
|
||||
varargout{1} = testNamespaces_wrapper(9, this, varargin{:});
|
||||
end
|
||||
|
||||
function varargout = nsArg(this, varargin)
|
||||
% NSARG usage: nsArg(ClassB arg) : returns int
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% nsArg(ClassB arg)
|
||||
if length(varargin) == 1 && isa(varargin{1},'ns1.ClassB')
|
||||
varargout{1} = testNamespaces_wrapper(10, this, varargin{:});
|
||||
else
|
||||
|
@ -66,14 +56,7 @@ classdef ClassA < handle
|
|||
function varargout = nsReturn(this, varargin)
|
||||
% NSRETURN usage: nsReturn(double q) : returns ns2::ns3::ClassB
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
% Method Overloads
|
||||
% nsReturn(double q)
|
||||
if length(varargin) == 1 && isa(varargin{1},'double')
|
||||
varargout{1} = testNamespaces_wrapper(11, this, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function ns2.ClassA.nsReturn');
|
||||
end
|
||||
varargout{1} = testNamespaces_wrapper(11, this, varargin{:});
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -89,7 +89,7 @@ bool files_equal(const string& expected, const string& actual, bool skipheader)
|
|||
bool equal = actual_contents == expected_contents;
|
||||
if (!equal) {
|
||||
stringstream command;
|
||||
command << "diff " << actual << " " << expected << endl;
|
||||
command << "diff " << expected << " " << actual << endl;
|
||||
system(command.str().c_str());
|
||||
}
|
||||
return equal;
|
||||
|
|
Loading…
Reference in New Issue