Skip to content
Snippets Groups Projects
Commit b3c94eb6 authored by Tim Übelhör's avatar Tim Übelhör
Browse files

Initial commit of the CLI Wrapper

parents
Branches
No related tags found
No related merge requests found
Showing
with 883 additions and 0 deletions
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
project.fragment.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
#*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
\ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27004.2008
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AdidatCLI", "AdidatCLI\AdidatCLI.vcxproj", "{080112AF-3D1C-4269-BA88-3AD5E0C5F587}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{080112AF-3D1C-4269-BA88-3AD5E0C5F587}.Debug|x64.ActiveCfg = Debug|x64
{080112AF-3D1C-4269-BA88-3AD5E0C5F587}.Debug|x64.Build.0 = Debug|x64
{080112AF-3D1C-4269-BA88-3AD5E0C5F587}.Debug|x86.ActiveCfg = Debug|Win32
{080112AF-3D1C-4269-BA88-3AD5E0C5F587}.Debug|x86.Build.0 = Debug|Win32
{080112AF-3D1C-4269-BA88-3AD5E0C5F587}.Release|x64.ActiveCfg = Release|x64
{080112AF-3D1C-4269-BA88-3AD5E0C5F587}.Release|x64.Build.0 = Release|x64
{080112AF-3D1C-4269-BA88-3AD5E0C5F587}.Release|x86.ActiveCfg = Release|Win32
{080112AF-3D1C-4269-BA88-3AD5E0C5F587}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D931CAEF-598A-44F5-9D9F-AC2B9913C126}
EndGlobalSection
EndGlobal
// Do not change the order of includes!!!
#include "stdafx.h"
#include <msclr/marshal_cppstd.h>
// Use the simpler C-Style interface
#include "ADIDatCli.h"
ADIDatCli::AdiDatWriter::AdiDatWriter(String ^ path, IEnumerable<String^>^ channelNames, IEnumerable<String^>^ channelUnits, double secondsPerSample)
{
using namespace msclr::interop;
// Create the native vectors
std::vector<std::string> vecChannelNames;
for each(auto name in channelNames)
{
vecChannelNames.push_back(marshal_as<std::string>(name));
}
std::vector<std::string> vecChannelUnits;
for each(auto unit in channelUnits)
{
vecChannelUnits.push_back(marshal_as<std::string>(unit));
}
// Check conistency
if (vecChannelNames.size() != vecChannelUnits.size())
{
throw gcnew ArgumentException("The number of names and units does not match.");
}
// Create the native class
_writer = new NativeWriter(marshal_as<std::string>(path), vecChannelNames, vecChannelUnits, secondsPerSample);
}
ADIDatCli::AdiDatWriter::~AdiDatWriter()
{
delete(_writer);
}
void ADIDatCli::AdiDatWriter::AppendData(IEnumerable<IEnumerable<float>^>^ data)
{
throw gcnew System::NotImplementedException();
}
// ADIDatCli.h
#pragma once
#include "NativeWriter.h"
using namespace System;
using namespace System::Collections::Generic;
namespace ADIDatCli
{
// This class is a wrapper for the NativeWrite, the purpose is to convert managed and unmanaged types
/// This class can create and write .adidat files for LabChart
public ref class AdiDatWriter
{
public:
/// Creates the file in the path. Also set up the
AdiDatWriter(String^ path, IEnumerable<String^>^ channelNames, IEnumerable<String^>^ channelUnits, double secondsPerSample);
~AdiDatWriter();
void AppendData( IEnumerable<IEnumerable<float>^>^ data);
private:
// The native class does the actual work
NativeWriter* _writer;
};
}
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{080112AF-3D1C-4269-BA88-3AD5E0C5F587}</ProjectGuid>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<Keyword>ManagedCProj</Keyword>
<RootNamespace>AdidatCLI</RootNamespace>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<AdditionalIncludeDirectories>../adidat/include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalDependencies>ADIDatIOWin64.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>../adidat/lib</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<AdditionalIncludeDirectories>../adidat/include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalDependencies>ADIDatIOWin64.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>../adidat/lib</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<AdditionalIncludeDirectories>../adidat/include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalDependencies>ADIDatIOWin64.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>../adidat/lib</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<AdditionalIncludeDirectories>../adidat/include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalDependencies>ADIDatIOWin64.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>../adidat/lib</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="ADIDatCli.h" />
<ClInclude Include="NativeWriter.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="Stdafx.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="ADIDatCli.cpp" />
<ClCompile Include="AssemblyInfo.cpp" />
<ClCompile Include="NativeWriter.cpp" />
<ClCompile Include="Stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="app.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="app.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ADIDatCli.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="NativeWriter.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="AssemblyInfo.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="NativeWriter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ADIDatCli.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="app.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="app.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
</Project>
\ No newline at end of file
#include "stdafx.h"
using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::CompilerServices;
using namespace System::Runtime::InteropServices;
using namespace System::Security::Permissions;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly:AssemblyTitleAttribute(L"AdidatCLI")];
[assembly:AssemblyDescriptionAttribute(L"")];
[assembly:AssemblyConfigurationAttribute(L"")];
[assembly:AssemblyCompanyAttribute(L"")];
[assembly:AssemblyProductAttribute(L"AdidatCLI")];
[assembly:AssemblyCopyrightAttribute(L"Copyright (c) 2017")];
[assembly:AssemblyTrademarkAttribute(L"")];
[assembly:AssemblyCultureAttribute(L"")];
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the value or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly:AssemblyVersionAttribute("1.0.*")];
[assembly:ComVisible(false)];
[assembly:CLSCompliantAttribute(true)];
\ No newline at end of file
#include "stdafx.h"
#include "NativeWriter.h"
#include <ctime>
#include "ADIDatCAPI.h"
NativeWriter::NativeWriter(std::string path, std::vector<std::string> channelNames, std::vector<std::string> channelUnits, double secondsPerSample)
{
_channelCount = channelNames.size();
// Create the file
_path = std::wstring(path.length(), L'\0');
size_t pathCharsConverted = 0;
mbstowcs_s(&pathCharsConverted, &_path[0], path.length(), path.c_str(), _path.length());
ADI_FileHandle fileHandle(0);
checkResult(ADI_CreateFile(_path.c_str(), &fileHandle));
// Start writing
ADI_WriterHandle writerHandle(0);
checkResult(ADI_CreateWriter(fileHandle, &writerHandle));
// Set the channels names and indo
for (int channel = 0; channel < static_cast<int>(channelNames.size()); channel++)
{
std::wstring wName(channelNames[channel].size(), L'\0');
size_t channelCharsConverted = 0;
mbstowcs_s(&channelCharsConverted, &wName[0], channelNames[channel].length(), channelNames[channel].c_str(), wName.length());
ADI_SetChannelName(fileHandle, channel, wName.c_str());
std::wstring wUnit(channelUnits[channel].size(), L'\0');
size_t unitCharsConverted = 0;
mbstowcs_s(&unitCharsConverted, &wUnit[0], channelUnits[channel].length(), channelUnits[channel].c_str(), wUnit.length());
checkResult(ADI_SetChannelInfo(writerHandle, channel, true, secondsPerSample, wUnit.c_str(), NULL));
}
// Commit the changes
checkResult(ADI_CommitFile(writerHandle, 0));
checkResult(ADI_CloseWriter(&writerHandle));
checkResult(ADI_CloseFile(&fileHandle));
}
NativeWriter::~NativeWriter()
{
}
void NativeWriter::checkResult(int code)
{
ADIResultCode adiCode = static_cast<ADIResultCode>(code);
if (adiCode != ADIResultCode::kResultSuccess)
{
wchar_t msg[MAX_ERROR_MESSAGE_SIZE];
long msgLen;
ADI_GetErrorMessage(adiCode, msg, MAX_ERROR_MESSAGE_SIZE, &msgLen);
std::wstring msgWStr(msg);
std::string msgStr(msgWStr.begin(), msgWStr.end());
throw new std::exception(msgStr.c_str());
}
// If it is kResultsuccess we are all fine :)
}
void NativeWriter::AppendData(std::vector<std::vector<float>> data)
{
// Check if the data is consistent
if (data.empty())
{
return;
}
size_t samplesToAdd = data[0].size();
for (auto channel : data)
{
if (channel.size() != samplesToAdd)
{
throw new std::invalid_argument("The channels do no contain an equal number of samples.");
}
}
// Open the file
ADI_FileHandle fileHandle(0);
checkResult(ADI_OpenFile(_path.c_str(), &fileHandle, ADIFileOpenMode::kOpenFileForReadAndWrite));
// Create the write handler
ADI_WriterHandle writerHandle(0);
checkResult(ADI_CreateWriter(fileHandle, &writerHandle));
// Start a new record
time_t currentTime;
time(&currentTime);
checkResult(ADI_StartRecord(writerHandle, currentTime, 0, 0));
// Add the data to the record
size_t samplesAdded = 0;
while (samplesAdded < samplesToAdd)
{
// Add Optimal chunk size for each channel
long chunkSize = static_cast<long>(samplesToAdd - samplesAdded);
if (OPTIMAL_CHUNK_SIZE < chunkSize)
{
chunkSize = OPTIMAL_CHUNK_SIZE;
}
long samplesAdded = 0;
for (int i = 0; i < static_cast<int>(data.size()); i++)
{
// Add the data directly from the matrix
checkResult(ADI_AddChannelSamples(writerHandle, i, &data[i][samplesAdded], chunkSize, &samplesAdded));
}
}
// Close the record
checkResult(ADI_FinishRecord(writerHandle));
// Commit the changes
checkResult(ADI_CommitFile(writerHandle, 0));
checkResult(ADI_CloseWriter(&writerHandle));
checkResult(ADI_CloseFile(&fileHandle));
}
\ No newline at end of file
#pragma once
#include <string>
#include <vector>
// For best display in labchart
const size_t OPTIMAL_CHUNK_SIZE = 16000;
// The maximal count of characters when getting the error message
const size_t MAX_ERROR_MESSAGE_SIZE = 1024;
class NativeWriter
{
private:
// Where we created the file
std::wstring _path;
// Rememebr how many channels we use
size_t _channelCount;
/// Throws an exception if any error occured
void checkResult(int code);
public:
NativeWriter(std::string path, std::vector<std::string> channelNames, std::vector<std::string> channelUnits, double secondsPerSample);
void AppendData(std::vector<std::vector<float>> data);
~NativeWriter();
};
========================================================================
DYNAMIC LINK LIBRARY : AdidatCLI Project Overview
========================================================================
AppWizard has created this AdidatCLI DLL for you.
This file contains a summary of what you will find in each of the files that
make up your AdidatCLI application.
AdidatCLI.vcxproj
This is the main project file for VC++ projects generated using an Application Wizard.
It contains information about the version of Visual C++ that generated the file, and
information about the platforms, configurations, and project features selected with the
Application Wizard.
AdidatCLI.vcxproj.filters
This is the filters file for VC++ projects generated using an Application Wizard.
It contains information about the association between the files in your project
and the filters. This association is used in the IDE to show grouping of files with
similar extensions under a specific node (for e.g. ".cpp" files are associated with the
"Source Files" filter).
AdidatCLI.cpp
This is the main DLL source file.
AdidatCLI.h
This file contains a class declaration.
AssemblyInfo.cpp
Contains custom attributes for modifying assembly metadata.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" to indicate parts of the source code you
should add to or customize.
/////////////////////////////////////////////////////////////////////////////
// stdafx.cpp : source file that includes just the standard includes
// AdidatCLI.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#pragma once
AdidatCLI/AdidatCLI/app.ico

40.4 KiB

File suppressed by a .gitattributes entry or the file's encoding is unsupported.
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by app.rc
This diff is collapsed.
File added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment