Skip to content

Commit

Permalink
[feature] CDR structures serialization (#257)
Browse files Browse the repository at this point in the history
* [feature] CDR structures serialization

* Test performance

* Transport tunning

* Use pointer for sample info

* Revert "Use pointer for sample info"

This reverts commit 982911b.

* Updated dotnet version

* Updated latency performance test

* Register instance CDR

* RTI register instances

* Prepare for debug

* Added [SuppressGCTransition]

* Changed to CallConvSuppressGCTransition

* Adjusted transport config

* Ensure Release build

* Fixed CXX flags

* Use CXX 17

* Add optimization for msvc

* -DCMAKE_BUILD_TYPE=Release

* Added -DCMAKE_BUILD_TYPE=Release

* Ensure Release when building

* Refactor cmake file

* Increased buffers size

* Allow Debug builds for Windows OS

* Added ToCDR and FromCDR methods

* Complie with CXX 14

* Refactor Benchmark performance test

* Restore/Build before publish benchmark test

* Commented performance test to ensure the cache

* Added LD_LIBRARY_PATH to the unix perf test

* Use bash shell

* Do not run RTI benchmark (no license)

* Use sudo user for the perf test

* Activate all performance tests

* added option -E to sudo calls

* Use sudo env

* Added env variable in the sudo call

* Use pwsh for windows scripts

* Build sequentially

* Removed ToolExe for windows

* Do not use inprocess

* append CMAKE_CXX_FLAGS_RELEASE

* Use /MD for libraries

* Refactored cxx flags

* Use InProcessEmitToolchain

* Added lib folders to the path

* Implemented Nested struct

* Escape paths

* set path on script

* Implemented sequences of structs

* Implemented struct array

* Implemented structs multi-array

* Fixed alignment

* Execute full test in windows

* Added --project parameter to dotnet run

* Only execute once in windows too

* Added continue-on-error: true to latency tests
  • Loading branch information
jmmorato authored Oct 8, 2024
1 parent 39563ac commit 0f7ea8a
Show file tree
Hide file tree
Showing 47 changed files with 1,536 additions and 297 deletions.
66 changes: 65 additions & 1 deletion .github/workflows/ci_standard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,28 @@ jobs:
flag-name: coverage-windows-${{ join(matrix.*, '-') }}
fail-on-error: false

- name: Add OpenDDS lib folders to path
shell: pwsh
run: |
$env:PATH = "${{ github.workspace }}\ext\OpenDDS_${{ matrix.BuildPlatform }}\lib;${{ github.workspace }}\ext\OpenDDS_${{ matrix.BuildPlatform }}\ACE_wrappers\lib;$env:PATH"
echo "PATH=$env:PATH" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Latency Performance Test
shell: cmd
run: |
dotnet clean ${{ github.workspace }}\Tests\TestIdlCdr\TestIdlCdr.csproj
dotnet clean ${{ github.workspace }}\Tests\BenchmarkPerformance\BenchmarkPerformance.csproj
dotnet restore ${{ github.workspace }}\Tests\TestIdlCdr\TestIdlCdr.csproj
dotnet restore ${{ github.workspace }}\Tests\BenchmarkPerformance\BenchmarkPerformance.csproj
dotnet build -m:1 ${{ github.workspace }}\Tests\TestIdlCdr\TestIdlCdr.csproj --configuration Release --runtime win-${{ matrix.BuildPlatform }}
dotnet build -m:1 ${{ github.workspace }}\Tests\BenchmarkPerformance\BenchmarkPerformance.csproj --configuration Release --runtime win-${{ matrix.BuildPlatform }}
dotnet run --project ${{ github.workspace }}\Tests\BenchmarkPerformance\BenchmarkPerformance.csproj "-1" --configuration Release --runtime win-${{ matrix.BuildPlatform }}
env:
DDS_ROOT: "${{ github.workspace }}\\ext\\OpenDDS_${{ matrix.BuildPlatform }}"
ACE_ROOT: "${{ github.workspace }}\\ext\\OpenDDS_${{ matrix.BuildPlatform }}\\ACE_wrappers"
TAO_ROOT: "${{ github.workspace }}\\ext\\OpenDDS_${{ matrix.BuildPlatform }}\\ACE_wrappers\\TAO"
continue-on-error: true

build_linux:
runs-on: ubuntu-20.04

Expand Down Expand Up @@ -185,6 +207,8 @@ jobs:
dotnet restore ${{ github.workspace }}/Tests/TestSupportProcessCore/TestSupportProcessCore.csproj --packages "${{ github.workspace }}/packages" --no-cache --configfile ${{ github.workspace }}/nuget.config
dotnet restore ${{ github.workspace }}/Tests/OpenDDSharp.UnitTest/OpenDDSharp.UnitTest.csproj --packages "${{ github.workspace }}/packages" --no-cache --configfile ${{ github.workspace }}/nuget.config
dotnet restore ${{ github.workspace }}/Tests/TestSupportProcessCore/TestSupportProcessCore.csproj --packages "${{ github.workspace }}/packages" --no-cache --configfile ${{ github.workspace }}/nuget.config
dotnet restore ${{ github.workspace }}/Tests/TestIdlCdr/TestIdlCdr.csproj --packages "${{ github.workspace }}/packages" --no-cache --configfile ${{ github.workspace }}/nuget.config
dotnet restore ${{ github.workspace }}/Tests/BenchmarkPerformance/BenchmarkPerformance.csproj --packages "${{ github.workspace }}/packages" --no-cache --configfile ${{ github.workspace }}/nuget.config
working-directory: ${{ github.workspace }}

- name: Build OpenDDSharp.BuildTasks project
Expand Down Expand Up @@ -243,6 +267,21 @@ jobs:
flag-name: coverage-linux-x64-Release
fail-on-error: false

- name: Latency Performance Test
shell: bash
run: |
dotnet build ${{ github.workspace }}/Tests/TestIdlCdr/TestIdlCdr.csproj --configuration Release --runtime linux-x64
dotnet build ${{ github.workspace }}/Tests/BenchmarkPerformance/BenchmarkPerformance.csproj --configuration Release --runtime linux-x64
dotnet publish ${{ github.workspace }}/Tests/BenchmarkPerformance/BenchmarkPerformance.csproj --configuration Release --runtime linux-x64
cd ${{ github.workspace }}/Tests/BenchmarkPerformance/bin/Release/net8.0/linux-x64/publish
sudo LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH" ${{ github.workspace }}/Tests/BenchmarkPerformance/bin/Release/net8.0/linux-x64/publish/BenchmarkPerformance -1
working-directory: ${{ github.workspace }}
env:
DDS_ROOT: "${{ github.workspace }}/ext/OpenDDS_Linux"
ACE_ROOT: "${{ github.workspace }}/ext/OpenDDS_Linux/ACE_wrappers"
TAO_ROOT: "${{ github.workspace }}/ext/OpenDDS_Linux/ACE_wrappers/TAO"
continue-on-error: true

build_macos_x64:
runs-on: macos-13

Expand Down Expand Up @@ -372,6 +411,19 @@ jobs:
flag-name: coverage-macos-x64-Release
fail-on-error: false

- name: Latency Performance Test
shell: bash
run: |
dotnet build ${{ github.workspace }}/Tests/TestIdlCdr/TestIdlCdr.csproj --configuration Release --runtime osx-x64
dotnet build ${{ github.workspace }}/Tests/BenchmarkPerformance/BenchmarkPerformance.csproj --configuration Release --runtime osx-x64
dotnet publish ${{ github.workspace }}/Tests/BenchmarkPerformance/BenchmarkPerformance.csproj --configuration Release --runtime osx-x64
sudo env DYLD_LIBRARY_PATH="./:$DYLD_LIBRARY_PATH"
sudo env DYLD_FALLBACK_LIBRARY_PATH="./:$DYLD_FALLBACK_LIBRARY_PATH"
cd ${{ github.workspace }}/Tests/BenchmarkPerformance/bin/Release/net8.0/osx-x64/publish
sudo -E ${{ github.workspace }}/Tests/BenchmarkPerformance/bin/Release/net8.0/osx-x64/publish/BenchmarkPerformance -1
working-directory: ${{ github.workspace }}
continue-on-error: true

build_macos_arm64:
runs-on: macos-14

Expand Down Expand Up @@ -501,6 +553,19 @@ jobs:
flag-name: coverage-macos-arm64-Release
fail-on-error: false

- name: Latency Performance Test
shell: bash
run: |
dotnet build ${{ github.workspace }}/Tests/TestIdlCdr/TestIdlCdr.csproj --configuration Release --runtime osx-arm64
dotnet build ${{ github.workspace }}/Tests/BenchmarkPerformance/BenchmarkPerformance.csproj --configuration Release --runtime osx-arm64
dotnet publish ${{ github.workspace }}/Tests/BenchmarkPerformance/BenchmarkPerformance.csproj --configuration Release --runtime osx-arm64
sudo env DYLD_LIBRARY_PATH="./:$DYLD_LIBRARY_PATH"
sudo env DYLD_FALLBACK_LIBRARY_PATH="./:$DYLD_FALLBACK_LIBRARY_PATH"
cd ${{ github.workspace }}/Tests/BenchmarkPerformance/bin/Release/net8.0/osx-arm64/publish
sudo -E ${{ github.workspace }}/Tests/BenchmarkPerformance/bin/Release/net8.0/osx-arm64/publish/BenchmarkPerformance -1
working-directory: ${{ github.workspace }}
continue-on-error: true

publish_coveralls:
runs-on: ubuntu-latest
needs: [build_windows, build_linux, build_macos_x64, build_macos_arm64]
Expand All @@ -512,4 +577,3 @@ jobs:
parallel-finished: true
carryforward: coverage-windows-x64-Release,coverage-windows-x86-Release,coverage-linux-x64-Release,coverage-macos-x64-Release,coverage-macos-arm64-Release
fail-on-error: false

6 changes: 3 additions & 3 deletions Build/OpenDDSharp.Build/OpenDDSharp.Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<ItemGroup>
<!-- Analyzer API for our custom checks. -->
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.10.0">
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.11.0">
<PrivateAssets>all</PrivateAssets>
</PackageReference>

Expand All @@ -35,11 +35,11 @@
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.28.0.94264">
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.32.0.97167">
<PrivateAssets>all</PrivateAssets>
</PackageReference>

<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.10.48">
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.11.20">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand Down
12 changes: 8 additions & 4 deletions Build/OpenDDSharp.Build/Tasks/BuildOpenDDSharpNativeTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,22 @@ public override void Run(BuildContext context)
{
buildFoder += $"_{context.BuildPlatform}";
}
var arguments = $"--no-warn-unused-cli -DCMAKE_PREFIX_PATH={Path.GetFullPath(context.DdsRoot)} -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -A {platform} -H{nativeFolder} -B{buildFoder}";
var arguments = $"--no-warn-unused-cli -DCMAKE_BUILD_TYPE={context.BuildConfiguration} -DCMAKE_PREFIX_PATH={Path.GetFullPath(context.DdsRoot)} -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -A {platform} -H{nativeFolder} -B{buildFoder}";

if (BuildContext.IsLinux)
{
buildFoder += "_Linux";
arguments = $"--no-warn-unused-cli -DCMAKE_PREFIX_PATH={Path.GetFullPath(context.DdsRoot)} -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -H{nativeFolder} -B{buildFoder}";
arguments = $"--no-warn-unused-cli -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH={Path.GetFullPath(context.DdsRoot)} -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -H{nativeFolder} -B{buildFoder}";
}
else if (BuildContext.IsOSX && BuildContext.IsARM64)
{
buildFoder += "_osx-arm64";
arguments = $"--no-warn-unused-cli -DCMAKE_PREFIX_PATH={Path.GetFullPath(context.DdsRoot)} -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -H{nativeFolder} -B{buildFoder}";
arguments = $"--no-warn-unused-cli -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH={Path.GetFullPath(context.DdsRoot)} -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -H{nativeFolder} -B{buildFoder}";
}
else if (BuildContext.IsOSX && !BuildContext.IsARM64)
{
buildFoder += "_osx-x64";
arguments = $"--no-warn-unused-cli -DCMAKE_PREFIX_PATH={Path.GetFullPath(context.DdsRoot)} -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -H{nativeFolder} -B{buildFoder}";
arguments = $"--no-warn-unused-cli -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH={Path.GetFullPath(context.DdsRoot)} -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -H{nativeFolder} -B{buildFoder}";
}

context.CMake(new CMakeSettings
Expand Down Expand Up @@ -94,6 +94,10 @@ public override void Run(BuildContext context)
{
buildSettings.Configuration = context.BuildConfiguration;
}
else
{
buildSettings.Configuration = "Release";
}
context.CMakeBuild(buildSettings);
}
}
Expand Down
15 changes: 6 additions & 9 deletions Build/OpenDDSharp.Build/Tasks/SetupThirdPartyTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,7 @@ public override void Run(BuildContext context)
if (BuildContext.IsLinux || BuildContext.IsOSX)
{
var configurePath = System.IO.Path.Combine(_clonePath.FullPath, "configure");
var arguments = " -v --doc-group3 --no-test --no-debug --optimize --install-origin-relative --prefix=/usr/lib";
if (BuildContext.IsOSX)
{
arguments += " --std=c++11";
}
const string arguments = " -v --doc-group3 --no-test --no-debug --optimize --install-origin-relative --prefix=/usr/lib --std=c++14";
context.Log.Information(arguments);

var exit = context.StartProcess(configurePath, new ProcessSettings
Expand All @@ -148,8 +144,8 @@ public override void Run(BuildContext context)
Version = version,
});

var vcvar = $"\\VC\\Auxiliary\\Build\\vcvarsall.bat\" {context.BuildPlatform}"; // -vcvars_ver=14.36.32532
var arguments = " /c \"" + vsPath.FullPath + vcvar + " && " + configurePath + " -v --doc-group3 --no-test";
var vcvar = $"\\VC\\Auxiliary\\Build\\vcvarsall.bat\" {context.BuildPlatform}";
var arguments = " /c \"" + vsPath.FullPath + vcvar + " && " + configurePath + " -v --doc-group3 --no-test --std=c++14";
if (context.BuildConfiguration == "Release")
{
arguments += " --no-debug --optimize";
Expand All @@ -165,6 +161,7 @@ public override void Run(BuildContext context)
Arguments = arguments,
WorkingDirectory = context.DdsRoot,
});

if (exit != 0)
{
throw new BuildException($"Error calling the OpenDDS configure script. Exit code: {exit}");
Expand Down Expand Up @@ -228,10 +225,10 @@ private string GitDescribe(BuildContext context)
{
try
{
var output = process.GetStandardOutput();
var output = process.GetStandardOutput().ToList();
if (output.Any())
{
return output.First();
return output[0];
}
}
catch
Expand Down
6 changes: 3 additions & 3 deletions Examples/ConsoleDemoCore/ConsoleDemoCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<ProjectReference Include="..\..\Tests\TestIdlJson\TestIdlJson.csproj" />

<!-- Analyzer API for our custom checks. -->
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.10.0">
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.11.0">
<PrivateAssets>all</PrivateAssets>
</PackageReference>

Expand All @@ -26,11 +26,11 @@
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.28.0.94264">
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.32.0.97167">
<PrivateAssets>all</PrivateAssets>
</PackageReference>

<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.10.48">
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.11.20">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Native/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.19.1)
cmake_minimum_required(VERSION 3.19.2)

project(Native)

Expand Down
26 changes: 13 additions & 13 deletions Native/CMakeListsTemplate.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
cmake_minimum_required(VERSION 3.19.1)
cmake_minimum_required(VERSION 3.19.2)
project(${PROJECT_NAME} CXX)

find_package(OpenDDS REQUIRED)

if(MSVC)
add_compile_options(/bigobj)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS)
endif()
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if(APPLE)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
elseif(UNIX)
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
Expand All @@ -22,13 +17,18 @@ endif()
add_library(${PROJECT_NAME} SHARED ${WRAPPER_FILES})

if(MSVC)
target_compile_options(${PROJECT_NAME} PUBLIC /wd4190)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
add_compile_definitions(_WINSOCK_DEPRECATED_NO_WARNINGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj /wd4190")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2 /Oi /D NDEBUG /D NOMINMAX /MD")
elseif(APPLE)
target_compile_options(${PROJECT_NAME} PUBLIC -Wno-switch -Wno-return-type-c-linkage -Wno-tautological-pointer-compare)
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-Wl,-rpath,@executable_path -Wl,-rpath,@loader_path")
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-Wl,-rpath,@executable_path -Wl,-rpath,@loader_path")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpointer-arith -Wno-switch -Wno-return-type-c-linkage -Wno-tautological-pointer-compare -pthread")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -DNDEBUG")
elseif(UNIX)
target_compile_options(${PROJECT_NAME} PUBLIC -Wno-switch -Wno-return-type-c-linkage -Wno-tautological-pointer-compare)
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-Wl,-rpath,$ORIGIN")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpointer-arith -Wno-switch -Wno-return-type-c-linkage -Wno-tautological-pointer-compare -pthread")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -DNDEBUG")
endif()

OPENDDS_TARGET_SOURCES(${PROJECT_NAME}
Expand Down
22 changes: 17 additions & 5 deletions Native/CSharpCDRImplTemplate.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,9 @@
{
InstanceHandle ret = InstanceHandle.HandleNil;

var str = _typeSupport.EncodeToString(instance);
var json_data = MarshalHelper.NativeUtf8FromString(str);
var bytes = _typeSupport.EncodeToBytes(instance);

ret = <%TYPE%>DataWriterNative.RegisterInstance(_native, json_data);
ret = <%TYPE%>DataWriterNative.RegisterInstance(_native, bytes, (UIntPtr)bytes.Length);

return ret;
}
Expand Down Expand Up @@ -302,8 +301,9 @@
internal static partial IntPtr Narrow(IntPtr dw);

[SuppressUnmanagedCodeSecurity]
[SuppressGCTransition]
[LibraryImport(<%TYPE%>.API_DLL, EntryPoint = "<%SCOPED_METHOD%>DataWriter_Write_Cdr")]
[UnmanagedCallConv(CallConvs = new[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })]
[UnmanagedCallConv(CallConvs = new[] { typeof(System.Runtime.CompilerServices.CallConvSuppressGCTransition) })]
internal static partial int Write(IntPtr dw, byte[] cdrData, UIntPtr size, int handle);

[SuppressUnmanagedCodeSecurity]
Expand All @@ -316,6 +316,12 @@
[UnmanagedCallConv(CallConvs = new[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })]
internal static partial int RegisterInstance(IntPtr dw, IntPtr jsonData);

[SuppressUnmanagedCodeSecurity]
[SuppressGCTransition]
[LibraryImport(<%TYPE%>.API_DLL, EntryPoint = "<%SCOPED_METHOD%>DataWriter_RegisterInstance_Cdr")]
[UnmanagedCallConv(CallConvs = new[] { typeof(System.Runtime.CompilerServices.CallConvSuppressGCTransition) })]
internal static partial int RegisterInstance(IntPtr dw, byte[] cdrData, UIntPtr size);

[SuppressUnmanagedCodeSecurity]
[SuppressUnmanagedCodeSecurity]
[DllImport(<%TYPE%>.API_DLL, EntryPoint = "<%SCOPED_METHOD%>DataWriter_RegisterInstanceTimestamp_Json", CallingConvention = CallingConvention.Cdecl)]
Expand Down Expand Up @@ -367,6 +373,10 @@
[DllImport(<%TYPE%>.API_DLL, EntryPoint = "<%SCOPED_METHOD%>DataWriter_RegisterInstance_Json", CallingConvention = CallingConvention.Cdecl)]
internal static extern int RegisterInstance(IntPtr dw, [In] IntPtr jsonData);

[SuppressUnmanagedCodeSecurity]
[DllImport(<%TYPE%>.API_DLL, EntryPoint = "<%SCOPED_METHOD%>DataWriter_RegisterInstance_Cdr", CallingConvention = CallingConvention.Cdecl)]
internal static extern int RegisterInstance(IntPtr dw, byte[] cdrData, UIntPtr size);

[SuppressUnmanagedCodeSecurity]
[DllImport(<%TYPE%>.API_DLL, EntryPoint = "<%SCOPED_METHOD%>DataWriter_RegisterInstanceTimestamp_Json", CallingConvention = CallingConvention.Cdecl)]
internal static extern int RegisterInstanceTimestamp(IntPtr dw, [In] IntPtr jsonData, [MarshalAs(UnmanagedType.Struct), In] Timestamp timestamp);
Expand Down Expand Up @@ -1131,7 +1141,7 @@
ReturnCode ret = ReturnCode.Error;
var ptr = IntPtr.Zero;
var infoWrapper = new SampleInfoWrapper();
UIntPtr size = UIntPtr.Zero;
var size = UIntPtr.Zero;
ret = (ReturnCode)<%TYPE%>DataReaderNative.TakeNextSample(_native, ref ptr, ref size, ref infoWrapper);
if (ret == ReturnCode.Ok)
{
Expand Down Expand Up @@ -1263,10 +1273,12 @@
internal static partial int TakeNextInstanceWithCondition(IntPtr dr, ref IntPtr receivedData, ref IntPtr receivedInfo, int handle, int maxSamples, IntPtr condition);

[SuppressUnmanagedCodeSecurity]
[SuppressGCTransition]
[DllImport(<%TYPE%>.API_DLL, EntryPoint = "<%SCOPED_METHOD%>DataReader_ReadNextSample_Cdr", CallingConvention = CallingConvention.Cdecl)]
internal static extern int ReadNextSample(IntPtr dr, [In, Out] ref IntPtr cdr_data, [In, Out] ref UIntPtr size, [In, Out] ref SampleInfoWrapper sampleInfo);

[SuppressUnmanagedCodeSecurity]
[SuppressGCTransition]
[DllImport(<%TYPE%>.API_DLL, EntryPoint = "<%SCOPED_METHOD%>DataReader_TakeNextSample_Cdr", CallingConvention = CallingConvention.Cdecl)]
internal static extern int TakeNextSample(IntPtr dr, [In, Out] ref IntPtr cdr_data, [In, Out] ref UIntPtr size, [In, Out] ref SampleInfoWrapper sampleInfo);

Expand Down
Loading

0 comments on commit 0f7ea8a

Please sign in to comment.