Commit c31c480d by David Heitbrink

Merge branch 'master' of https://nads-git.iowa.uiowa.edu/TestMigration/DaqIOLib

Added missing copyright, updated  daqplayer, added unit test - which is not ready
parents 9427e046 c62b3ba0
...@@ -54,7 +54,6 @@ add_executable(testDaq ${TEST_DAQ}) ...@@ -54,7 +54,6 @@ add_executable(testDaq ${TEST_DAQ})
target_link_libraries(testDaq PUBLIC target_link_libraries(testDaq PUBLIC
${PROJECT_NAME} ${PROJECT_NAME}
misc
) )
set_target_properties(testDaq PROPERTIES set_target_properties(testDaq PROPERTIES
......
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright 2005-2020 by National Advanced Driving Simulator and
// Simulation Center, The University of Iowa. All rights reserved.
//
//
/////////////////////////////////////////////////////////////////////////////
#ifndef _DAQBUFFER_H_ #ifndef _DAQBUFFER_H_
#define _DAQBUFFER_H_ #define _DAQBUFFER_H_
...@@ -32,7 +39,7 @@ public: ...@@ -32,7 +39,7 @@ public:
std::vector<TDaqByte>::const_pointer GetDataPtr() const; ///< Return faw pointer to data std::vector<TDaqByte>::const_pointer GetDataPtr() const; ///< Return faw pointer to data
int GetCount() const; ///< Return number of typed elements in buffer int GetCount() const ; ///< Return number of typed elements in buffer
int GetSize() const; ///< Return buffer size in bytes int GetSize() const; ///< Return buffer size in bytes
char* GetChar(int ind=0); ///< Return char type pointer to data char* GetChar(int ind=0); ///< Return char type pointer to data
int* GetInt(int ind=0); ///< Return int type pointer to data int* GetInt(int ind=0); ///< Return int type pointer to data
...@@ -125,7 +132,7 @@ CDaqBuffer::GetDataPtr() const ...@@ -125,7 +132,7 @@ CDaqBuffer::GetDataPtr() const
if (m_Data.size() > 0) if (m_Data.size() > 0)
return &m_Data[0]; return &m_Data[0];
else else
return NULL; return nullptr;
}; };
......
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright 2005-2020 by National Advanced Driving Simulator and
// Simulation Center, The University of Iowa. All rights reserved.
//
//
/////////////////////////////////////////////////////////////////////////////
#ifndef _DAQCHANNEL_H_ #ifndef _DAQCHANNEL_H_
#define _DAQCHANNEL_H_ #define _DAQCHANNEL_H_
......
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright 2005-2020 by National Advanced Driving Simulator and
// Simulation Center, The University of Iowa. All rights reserved.
//
//
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/// ///
// DAQ low level IO Library // DAQ low level IO Library
// //
...@@ -37,7 +44,8 @@ struct TFrameInfo { ...@@ -37,7 +44,8 @@ struct TFrameInfo {
//this may need to be changed with time. //this may need to be changed with time.
const int cFILE_BUFFER_SIZE = 8192; const int cFILE_BUFFER_SIZE = 8192;
CDaqLowLevelIo::CDaqLowLevelIo() CDaqLowLevelIo::CDaqLowLevelIo():
m_Frequency(-1)
{ {
m_pFile = 0; m_pFile = 0;
m_UserErrorFunc = DefaultErrorFunc; m_UserErrorFunc = DefaultErrorFunc;
...@@ -151,7 +159,7 @@ WriteAsciiLine( ...@@ -151,7 +159,7 @@ WriteAsciiLine(
TConvertOptions options) TConvertOptions options)
{ {
assert(pFile); assert(pFile);
if (!pData) return false;
int sample; int sample;
if ( chInf.GetType() == 'c' ) { if ( chInf.GetType() == 'c' ) {
...@@ -1348,7 +1356,7 @@ CDaqLowLevelIo::LowLevelDataRead( ...@@ -1348,7 +1356,7 @@ CDaqLowLevelIo::LowLevelDataRead(
// the rest of the space (that didn't get read from the file with zeros. // the rest of the space (that didn't get read from the file with zeros.
int fullSize = ch.GetRecSize(); int fullSize = ch.GetRecSize();
if ( fullSize != size && size < fullSize ) { if ( fullSize != size && size < fullSize ) {
memset(((char *)pTempSpace) + size, 0, fullSize - size); memset(((char *)pTempSpace) + size, 0, size_t(fullSize) - size_t(size));
} }
daqBuf.Append(pTempSpace, fullSize, ch.GetItemCount()); daqBuf.Append(pTempSpace, fullSize, ch.GetItemCount());
if ( pFrameList && (int)pFrameList->size() > needChan[chId]) if ( pFrameList && (int)pFrameList->size() > needChan[chId])
...@@ -1624,8 +1632,8 @@ CDaqLowLevelIo::GetFullData( ...@@ -1624,8 +1632,8 @@ CDaqLowLevelIo::GetFullData(
TConvertOptions option, TConvertOptions option,
int frm1, ///< First frame to sample, or -1 for first in file int frm1, ///< First frame to sample, or -1 for first in file
int frm2, ///< Last frame to sample, or -1 for last in file int frm2, ///< Last frame to sample, or -1 for last in file
vector<TIntVec>* pFrmList, vector<TIntVec>* pFrmList, ///< Where to store frame sequences
int maxDiffLook) ///< Where to store frame sequences int maxDiffLook)
{ {
char buf[256]; // buffer for writing messages char buf[256]; // buffer for writing messages
...@@ -1949,7 +1957,7 @@ CDaqLowLevelIo::ReadDataForOneFrame( ...@@ -1949,7 +1957,7 @@ CDaqLowLevelIo::ReadDataForOneFrame(
size = fullSize; size = fullSize;
} }
if ( fullSize != size && size < fullSize ) { if ( fullSize != size && size < fullSize ) {
memset(((char *)pTempSpace) + size, 0, fullSize - size); memset(((char *)pTempSpace) + size, 0, size_t(fullSize) - size_t(size));
} }
daqBuf.Replace(pTempSpace, fullSize, ch.GetItemCount()); daqBuf.Replace(pTempSpace, fullSize, ch.GetItemCount());
gotData[chId] = true; gotData[chId] = true;
...@@ -2028,7 +2036,7 @@ CDaqLowLevelIo::ReadChannelDataForOneFrame( ...@@ -2028,7 +2036,7 @@ CDaqLowLevelIo::ReadChannelDataForOneFrame(
int fullSize = ch.GetRecSize(); int fullSize = ch.GetRecSize();
if ( fullSize != size && size < fullSize ) { if ( fullSize != size && size < fullSize ) {
memset(((char *)pTempSpace) + size, 0, fullSize - size); memset(((char *)pTempSpace) + size, 0, size_t(fullSize) - size_t(size));
} }
daqBuf.Replace(pTempSpace, fullSize, ch.GetItemCount()); daqBuf.Replace(pTempSpace, fullSize, ch.GetItemCount());
gotData = true; gotData = true;
......
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="DaqIOLib"
ProjectGUID="{9BFCBD6F-7458-4944-902E-5CB41854BCC9}"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\lib\DaqIOLibD.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="replace /U DaqIoLibDefines.h ..\include&#x0D;&#x0A;replace /U DaqBuffer.h ..\include&#x0D;&#x0A;replace /U DaqIo.h ..\include&#x0D;&#x0A;replace /U DaqIoLib.h ..\include&#x0D;&#x0A;replace /U DaqChannelInfo.h ..\include&#x0D;&#x0A;replace /A DaqBuffer.h ..\include&#x0D;&#x0A;replace /A DaqIo.h ..\include&#x0D;&#x0A;replace /A DaqIoLib.h ..\include&#x0D;&#x0A;replace /A DaqChannelInfo.h ..\include&#x0D;&#x0A;replace /A DaqIoLibDefines.h ..\include&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\lib\DaqIOLib.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="replace /U DaqIoLibDefines.h ..\include&#x0D;&#x0A;replace /U DaqBuffer.h ..\include&#x0D;&#x0A;replace /U DaqIo.h ..\include&#x0D;&#x0A;replace /U DaqIoLib.h ..\include&#x0D;&#x0A;replace /U DaqChannelInfo.h ..\include&#x0D;&#x0A;replace /A DaqBuffer.h ..\include&#x0D;&#x0A;replace /A DaqIo.h ..\include&#x0D;&#x0A;replace /A DaqIoLib.h ..\include&#x0D;&#x0A;replace /A DaqChannelInfo.h ..\include&#x0D;&#x0A;replace /A DaqIoLibDefines.h ..\include&#x0D;&#x0A;"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\DaqFileIo.cxx"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\DaqBuffer.h"
>
</File>
<File
RelativePath=".\DaqChannelInfo.h"
>
</File>
<File
RelativePath=".\DaqIo.h"
>
</File>
<File
RelativePath=".\DaqIoLib.h"
>
</File>
<File
RelativePath=".\DaqIoLibDefines.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
<?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="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{9BFCBD6F-7458-4944-902E-5CB41854BCC9}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>
</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<AdditionalIncludeDirectories>$(solutiondir)nads-boost/;$(solutiondir)misc/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Lib>
<OutputFile>..\lib\DaqIOLibD.lib</OutputFile>
</Lib>
<PostBuildEvent>
<Command>replace /U DaqIoLibDefines.h ..\include
replace /U DaqBuffer.h ..\include
replace /U DaqIo.h ..\include
replace /U DaqIoLib.h ..\include
replace /U DaqChannelInfo.h ..\include
replace /A DaqBuffer.h ..\include
replace /A DaqIo.h ..\include
replace /A DaqIoLib.h ..\include
replace /A DaqChannelInfo.h ..\include
replace /A DaqIoLibDefines.h ..\include
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>$(solutiondir)nads-boost/;$(solutiondir)misc/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Lib>
<OutputFile>..\lib\DaqIOLibD.lib</OutputFile>
</Lib>
<PostBuildEvent>
<Command>replace /U DaqIoLibDefines.h ..\include
replace /U DaqBuffer.h ..\include
replace /U DaqIo.h ..\include
replace /U DaqIoLib.h ..\include
replace /U DaqChannelInfo.h ..\include
replace /A DaqBuffer.h ..\include
replace /A DaqIo.h ..\include
replace /A DaqIoLib.h ..\include
replace /A DaqChannelInfo.h ..\include
replace /A DaqIoLibDefines.h ..\include
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>$(solutiondir)nads-boost/;$(solutiondir)misc/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Lib>
<OutputFile>..\lib\DaqIOLib.lib</OutputFile>
</Lib>
<PostBuildEvent>
<Command>replace /U DaqIoLibDefines.h ..\include
replace /U DaqBuffer.h ..\include
replace /U DaqIo.h ..\include
replace /U DaqIoLib.h ..\include
replace /U DaqChannelInfo.h ..\include
replace /A DaqBuffer.h ..\include
replace /A DaqIo.h ..\include
replace /A DaqIoLib.h ..\include
replace /A DaqChannelInfo.h ..\include
replace /A DaqIoLibDefines.h ..\include
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>$(solutiondir)nads-boost/;$(solutiondir)misc/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Lib>
<OutputFile>..\lib\DaqIOLib.lib</OutputFile>
</Lib>
<PostBuildEvent>
<Command>replace /U DaqIoLibDefines.h ..\include
replace /U DaqBuffer.h ..\include
replace /U DaqIo.h ..\include
replace /U DaqIoLib.h ..\include
replace /U DaqChannelInfo.h ..\include
replace /A DaqBuffer.h ..\include
replace /A DaqIo.h ..\include
replace /A DaqIoLib.h ..\include
replace /A DaqChannelInfo.h ..\include
replace /A DaqIoLibDefines.h ..\include
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="DaqFileIo.cxx" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="DaqBuffer.h" />
<ClInclude Include="DaqChannelInfo.h" />
<ClInclude Include="DaqIo.h" />
<ClInclude Include="DaqIoLib.h" />
<ClInclude Include="DaqIoLibDefines.h" />
</ItemGroup>
<ItemGroup>
<None Include="ReadMe.txt" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="DaqIOLib"
ProjectGUID="{9BFCBD6F-7458-4944-902E-5CB41854BCC9}"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\lib\DaqIOLibD.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="replace /U DaqIoLibDefines.h ..\include&#x0D;&#x0A;replace /U DaqBuffer.h ..\include&#x0D;&#x0A;replace /U DaqIo.h ..\include&#x0D;&#x0A;replace /U DaqIoLib.h ..\include&#x0D;&#x0A;replace /U DaqChannelInfo.h ..\include&#x0D;&#x0A;replace /A DaqBuffer.h ..\include&#x0D;&#x0A;replace /A DaqIo.h ..\include&#x0D;&#x0A;replace /A DaqIoLib.h ..\include&#x0D;&#x0A;replace /A DaqChannelInfo.h ..\include&#x0D;&#x0A;replace /A DaqIoLibDefines.h ..\include&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\lib\DaqIOLib.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="replace /U DaqIoLibDefines.h ..\include&#x0D;&#x0A;replace /U DaqBuffer.h ..\include&#x0D;&#x0A;replace /U DaqIo.h ..\include&#x0D;&#x0A;replace /U DaqIoLib.h ..\include&#x0D;&#x0A;replace /U DaqChannelInfo.h ..\include&#x0D;&#x0A;replace /A DaqBuffer.h ..\include&#x0D;&#x0A;replace /A DaqIo.h ..\include&#x0D;&#x0A;replace /A DaqIoLib.h ..\include&#x0D;&#x0A;replace /A DaqChannelInfo.h ..\include&#x0D;&#x0A;replace /A DaqIoLibDefines.h ..\include&#x0D;&#x0A;"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\DaqFileIo.cxx"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\DaqBuffer.h"
>
</File>
<File
RelativePath=".\DaqChannelInfo.h"
>
</File>
<File
RelativePath=".\DaqIo.h"
>
</File>
<File
RelativePath=".\DaqIoLib.h"
>
</File>
<File
RelativePath=".\DaqIoLibDefines.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright 2005-2020 by National Advanced Driving Simulator and
// Simulation Center, The University of Iowa. All rights reserved.
//
//
/////////////////////////////////////////////////////////////////////////////
#ifndef _DAQIO_H_ #ifndef _DAQIO_H_
#define _DAQIO_H_ #define _DAQIO_H_
...@@ -111,7 +118,7 @@ public: ...@@ -111,7 +118,7 @@ public:
bool QueryIntegrityValues(TIntVec& drops, TIntVec& dropedFrm, TIntVec& skips, bool QueryIntegrityValues(TIntVec& drops, TIntVec& dropedFrm, TIntVec& skips,
TDaqEofStatus &stat); TDaqEofStatus &stat);
const std::string& GetLastError(void) const ///< Return text of most recent error const std::string& GetLastError(void) const noexcept ///< Return text of most recent error
{ return m_LastError; }; { return m_LastError; };
void Close(void); ///< Close the file void Close(void); ///< Close the file
......
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright 2005-2020 by National Advanced Driving Simulator and
// Simulation Center, The University of Iowa. All rights reserved.
//
//
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// //
// $Id: DaqIoLib.h,v 1.4 2013/06/27 18:09:08 iowa\dheitbri Exp $ // $Id: DaqIoLib.h,v 1.4 2013/06/27 18:09:08 iowa\dheitbri Exp $
......
#ifndef _DAQIOLIBDEFINES_H_ #ifndef _DAQIOLIBDEFINES_H_
#define _DAQIOLIBDEFINES_H_ #define _DAQIOLIBDEFINES_H_
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright 2005-2020 by National Advanced Driving Simulator and
// Simulation Center, The University of Iowa. All rights reserved.
//
//
/////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// $Id: DaqIoLibDefines.h,v 1.4 2019/07/09 14:33:59 IOWA\dheitbri Exp $ // $Id: DaqIoLibDefines.h,v 1.4 2019/07/09 14:33:59 IOWA\dheitbri Exp $
...@@ -47,12 +54,12 @@ typedef enum { ...@@ -47,12 +54,12 @@ typedef enum {
} TConvertOptions; } TConvertOptions;
inline TConvertOptions inline TConvertOptions
operator+(TConvertOptions left, TConvertOptions right) { operator+(TConvertOptions left, TConvertOptions right) noexcept {
return (TConvertOptions)((int)left + (int)right); return (TConvertOptions)((int)left + (int)right);
} }
inline TConvertOptions inline TConvertOptions
operator|(TConvertOptions left, TConvertOptions right) { operator|(TConvertOptions left, TConvertOptions right) noexcept {
return (TConvertOptions)((int)left | (int)right); return (TConvertOptions)((int)left | (int)right);
} }
......
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright 2020 by National Advanced Driving Simulator and
// Simulation Center, The University of Iowa. All rights reserved.
//
//
/////////////////////////////////////////////////////////////////////////////
#include <string> #include <string>
#include <vector> #include <vector>
#include <map> #include <map>
...@@ -5,8 +12,41 @@ ...@@ -5,8 +12,41 @@
#include "DaqPlayer.h" #include "DaqPlayer.h"
using namespace std; using namespace std;
DaqPlayer::DaqPlayer(int stride):_stride(stride),_firstFrame(-1),_lastFrame(-1) { ////////////////////////////////////////////////////////////////////////////////////////////////////
/// \fn DaqPlayer::DaqPlayer(int stride)
///
/// \brief Constructor
///
/// \author D A Heitbrink
/// \date 10/9/2020
///
/// \param stride How many frames per interation we advance in the playback
////////////////////////////////////////////////////////////////////////////////////////////////////
DaqPlayer::DaqPlayer(int stride):
_stride(stride),
_firstFrame(-1),
_lastFrame(-1),
_currentFrame(-1),
_DaqFrameRate(-1)
{
} }
////////////////////////////////////////////////////////////////////////////////////////////////////
/// \fn bool DaqPlayer::OpenDaqFile(const std::string& fileName,TStrVec items)
///
/// \brief Opens daq file, may block for a long time on the first time opening a file
///
///
/// \author D A Heitbrink
/// \date 10/9/2020
///
/// \param fileName Filename of the file.
/// \param items list of cells to read every frame,
///
/// \returns True if it succeeds, false if it fails.
////////////////////////////////////////////////////////////////////////////////////////////////////
bool DaqPlayer::OpenDaqFile(const std::string& fileName,TStrVec items) { bool DaqPlayer::OpenDaqFile(const std::string& fileName,TStrVec items) {
if (_pDaqIo) { if (_pDaqIo) {
_pDaqIo.reset(); _pDaqIo.reset();
...@@ -37,6 +77,7 @@ bool DaqPlayer::OpenDaqFile(const std::string& fileName,TStrVec items) { ...@@ -37,6 +77,7 @@ bool DaqPlayer::OpenDaqFile(const std::string& fileName,TStrVec items) {
return false; return false;
} }
_pDaqIo->GetChannels(_allDaqChannels); _pDaqIo->GetChannels(_allDaqChannels);
_DaqFrameRate = _pDaqIo->GetFrequency(); _DaqFrameRate = _pDaqIo->GetFrequency();
if (_DaqFrameRate < 60) if (_DaqFrameRate < 60)
_DaqFrameRate = 60; _DaqFrameRate = 60;
...@@ -60,21 +101,94 @@ bool DaqPlayer::OpenDaqFile(const std::string& fileName,TStrVec items) { ...@@ -60,21 +101,94 @@ bool DaqPlayer::OpenDaqFile(const std::string& fileName,TStrVec items) {
_firstFrame =_pDaqIo->GetFirstFrame(); _firstFrame =_pDaqIo->GetFirstFrame();
_lastFrame = _pDaqIo->GetFrames() / (_DaqFrameRate / 60) + _firstFrame; _lastFrame = _pDaqIo->GetFrames() / (_DaqFrameRate / 60) + _firstFrame;
//lets see if we have any droped frames //lets see if we have any droped frames
_currentFrame = _firstFrame;
_pDaqIo->QueryIntegrityValues( _pDaqIo->QueryIntegrityValues(
_stats.drops, _stats.dropedFrm, _stats.skips, _stats.eofStat); _stats.drops, _stats.dropedFrm, _stats.skips, _stats.eofStat);
return true;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/// \fn DaqPlayer& DaqPlayer::operator++()
///
/// \brief Increments to the next frame in replay
///
/// This functions takes current frame + stride, set EOF if this has advanced to the last frame
/// it throws if past last frame;
///
/// \author D A Heitbrink
/// \date 10/9/2020
///
/// \exception DaqPlayer::EndOfFile Thrown when an read past end of file.
/// \exception DaqPlayer::DaqReadError Thrown when an file read error occurs.
///
/// \returns The result of the operation.
////////////////////////////////////////////////////////////////////////////////////////////////////
DaqPlayer& DaqPlayer::operator ++() {
_currentFrame += _stride;
if (_currentFrame > _lastFrame) {
throw DaqPlayer::EndOfFile();
}
if (!GotoFrame(_currentFrame)) {
throw DaqPlayer::DaqReadError(_pDaqIo->GetLastError().c_str());
}
return *this;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////
/// \fn bool DaqPlayer::Eof() const
///
/// \brief is current frame > last frame
///
/// \author D A Heitbrink
/// \date 10/9/2020
///
/// \returns True if it succeeds, false if it fails.
////////////////////////////////////////////////////////////////////////////////////////////////////
bool DaqPlayer::Eof() const {
return _currentFrame > _lastFrame;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/// \fn bool DaqPlayer::GotoFrame(int frameNum)
///
/// \brief Advance current frame to input, reads data for the said frame
///
/// \author D A Heitbrink
/// \date 10/9/2020
///
/// \param frameNum The frame number.
///
/// \returns True if it succeeds, false if it fails.
////////////////////////////////////////////////////////////////////////////////////////////////////
bool DaqPlayer::GotoFrame(int frameNum) { bool DaqPlayer::GotoFrame(int frameNum) {
//DAH this is +3, we are counting by 4's and we are not guarented to have data every 4th frame, although this is true 95% of the time //DAH this is +3, we are counting by 4's and we are not guarented to have data every 4th frame, although this is true 95% of the time
if (!_pDaqIo->GetFullData(&_getDaqChannels, _daqBuffers, eFILL_MISSING, frameNum, frameNum + _stride - 1)) { if (!_pDaqIo->GetFullData(&_getDaqChannels, _daqBuffers, eFILL_MISSING, frameNum, frameNum + _stride - 1,0,_stride)) {
return false; return false;
} }
_currentFrame = frameNum;
return true; return true;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////
/// \fn bool DaqPlayer::AddCell(const std::string& str)
///
/// \brief Adds a cell to list to read
///
/// \author D A Heitbrink
/// \date 10/9/2020
///
/// \param str The string.
///
/// \returns False if the cell does not exist in the DAQ file
////////////////////////////////////////////////////////////////////////////////////////////////////
bool DaqPlayer::AddCell(const std::string& str) { bool DaqPlayer::AddCell(const std::string& str) {
auto itr = _nameToChannel.find(str); auto itr = _nameToChannel.find(str);
if (itr == _nameToChannel.end()) { if (itr == _nameToChannel.end()) {
...@@ -85,7 +199,15 @@ bool DaqPlayer::AddCell(const std::string& str) { ...@@ -85,7 +199,15 @@ bool DaqPlayer::AddCell(const std::string& str) {
return true; return true;
int id = _allDaqChannels[(itr->second)].GetId(); int id = _allDaqChannels[(itr->second)].GetId();
_getDaqChannels.push_back(id); _getDaqChannels.push_back(id);
_daqNameToIndex[str] = _getDaqChannels.size()-1; _daqNameToIndex[str] = (int)_getDaqChannels.size()-1;
return true; return true;
} }
optional<CDaqChannelInfo> DaqPlayer::GetChannelInfo(const string& str) {
optional<CDaqChannelInfo> ret;
auto itr = _nameToChannel.find(str);
if (itr == _nameToChannel.end()) {
return optional<CDaqChannelInfo>();
}
return optional<CDaqChannelInfo>(_allDaqChannels[itr->second]);
}
\ No newline at end of file
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright 2005-2020 by National Advanced Driving Simulator and
// Simulation Center, The University of Iowa. All rights reserved.
//
//
/////////////////////////////////////////////////////////////////////////////
#pragma once #pragma once
#include <DaqIoLib.h> #include <DaqIoLib.h>
#include <optional>
class DaqPlayer class DaqPlayer
{ {
public:
typedef unsigned char TDaqByte; typedef unsigned char TDaqByte;
typedef std::vector<int> TIntVec; typedef std::vector<int> TIntVec;
typedef std::vector<std::string> TStrVec; typedef std::vector<std::string> TStrVec;
typedef std::vector<CDaqBuffer> TDataVec; typedef std::vector<CDaqBuffer> TDataVec;
typedef std::vector<CDaqChannelInfo> TChanInfoVec; typedef std::vector<CDaqChannelInfo> TChanInfoVec;
typedef std::unique_ptr<CDaqLowLevelIo> TDaqFile; typedef std::unique_ptr<CDaqLowLevelIo> TDaqFile;
typedef struct TStats{ struct TStats{
TStats() :eofStat(eDAQ_EOF_UNDEFINED){}
TIntVec drops; TIntVec drops;
TIntVec dropedFrm; TIntVec dropedFrm;
TIntVec skips; TIntVec skips;
TDaqEofStatus eofStat; TDaqEofStatus eofStat;
}; };
class EndOfFile:public std::exception {
public:
EndOfFile() {}
};
class DaqReadError:public std::exception {
public:
DaqReadError(char const* const Message):std::exception(Message) {}
};
DaqPlayer(int stride = 4); DaqPlayer(int stride = 4);
DaqPlayer& operator ++();
std::optional<CDaqChannelInfo> GetChannelInfo(const std::string&);
bool OpenDaqFile(const std::string &file,TStrVec items); bool OpenDaqFile(const std::string &file,TStrVec items);
bool GotoFrame(int frameNum); bool GotoFrame(int frameNum);
const TStats& GetStats() {return _stats;} bool Eof() const;
const TStats& GetStats() const {return _stats;}
virtual void DaqReadProgress(const char *name, int pram1, int param2) {}; virtual void DaqReadProgress(const char *name, int pram1, int param2) {};
virtual void DaqError(const char *, const char *) {}; virtual void DaqError(const char *, const char *) {};
std::string GetLastError() { return m_lastError; }; const std::string& GetLastError() const { return m_lastError; };
bool AddCell(const std::string&); bool AddCell(const std::string&);
int GetCurrentFrame() { return _currentFrame; };
template <class T> std::vector<T> GetData(const std::string& name){ template <class T> std::vector<T> GetData(const std::string& name);
std::vector<T> ret;
auto idx = _daqNameToIndex.find(name);
if (idx == _daqNameToIndex.end())
return ret;
auto index = idx->second;
auto type = _allDaqChannels[index].GetType();
int typeSize = sizeof(T);
if (index >= _daqBuffers.size())
return ret;
auto valValueVec = _daqBuffers.at(index);
auto cnt = valValueVec.GetCount();
ret.reserve(cnt);
for (size_t i = 0; i < cnt; i++) {
if (type == "i") {
ret.push_back((T)valValueVec.GetInt(i));
}
else if (type == "s"){
ret.push_back((T)valValueVec.GetShort(i));
}
else if (type == "c") {
ret.push_back((T)valValueVec.GetChar(i));
}
else if (type == "f") {
ret.push_back((T)valValueVec.GetFloat(i));
}
else if (type == "d") {
ret.push_back((T)valValueVec.GetDouble(i));
}
}
return ret;
}
private: private:
TDaqFile _pDaqIo; TDaqFile _pDaqIo;
...@@ -67,7 +57,7 @@ private: ...@@ -67,7 +57,7 @@ private:
struct TDifferntialDataFrame { struct TDifferntialDataFrame {
TDifferntialDataFrame() :frame(-1) {}; TDifferntialDataFrame() :frame(-1) {};
TDifferntialDataFrame(const TDifferntialDataFrame& in):frame(in.frame), data(in.data) {}; TDifferntialDataFrame(const TDifferntialDataFrame& in):frame(in.frame), data(in.data) {};
TDifferntialDataFrame(TDifferntialDataFrame&& in) :frame(in.frame), data(std::move(in.data)) {}; TDifferntialDataFrame(TDifferntialDataFrame&& in) noexcept:frame(in.frame), data(std::move(in.data)) {};
int frame; int frame;
CDaqBuffer data; CDaqBuffer data;
}; };
...@@ -85,7 +75,60 @@ private: ...@@ -85,7 +75,60 @@ private:
int _DaqFrameRate; int _DaqFrameRate;
int _firstFrame; int _firstFrame;
int _lastFrame; int _lastFrame;
int _currentFrame;
TStats _stats; TStats _stats;
TDaqFile file; TDaqFile file;
std::string m_lastError; std::string m_lastError;
}; };
////////////////////////////////////////////////////////////////////////////////////////////////////
/// \fn template <class T> std::vector<T> DaqPlayer::GetData(const std::string& name)
///
/// \brief Gets a data for a cell
///
/// Gets data for a cell, does type casting from cell type to type T
///
///
/// \tparam T type parameter, must be able to cast from numeric type.
/// \param name The name of the cell.
///
/// \returns The data.
////////////////////////////////////////////////////////////////////////////////////////////////////
template <class T> std::vector<T> DaqPlayer::GetData(const std::string& name){
std::vector<T> ret;
auto idx = _daqNameToIndex.find(name);
if (idx == _daqNameToIndex.end())
return ret;
auto index = idx->second;
auto type = _allDaqChannels[index].GetType();
int typeSize = sizeof(T);
if (index >= _daqBuffers.size())
return ret;
auto valValueVec = _daqBuffers.at(index);
auto cnt = valValueVec.GetCount();
ret.reserve(cnt);
for (size_t i = 0; i < cnt; i++) {
if (type == 'i') {
ret.push_back((T)*valValueVec.GetInt((int)i));
}
else if (type == 's'){
ret.push_back((T)*valValueVec.GetShort((int)i));
}
else if (type == 'c') {
ret.push_back((T)*valValueVec.GetChar((int)i));
}
else if (type == 'f') {
ret.push_back((T)*valValueVec.GetFloat((int)i));
}
else if (type == 'd') {
ret.push_back((T)*valValueVec.GetDouble((int)i));
}
}
return ret;
}
#include <string> ////////////////////////////////////////////////////////////////////////////////////////////////////
#include <vector> /// \file daqTest.cpp.
#include <map> ///
#include <memory> /// \brief Unit Test for DAQIolib
#include "DaqPlayer.h" ////////////////////////////////////////////////////////////////////////////////////////////////////
#include <DaqPlayer.h>
#include <iostream>
using namespace std; using namespace std;
int main(int argc, char **argv) {
DaqPlayer::DaqPlayer(int stride):_stride(stride),_firstFrame(-1),_lastFrame(-1) { if (argc < 2) {
} cout << "Requires Daq File Name" << endl;
bool DaqPlayer::OpenDaqFile(const std::string& fileName,TStrVec items) { return 1;
if (_pDaqIo) {
_pDaqIo.reset();
}
_cellList = items;
string temp;
_pDaqIo = std::make_unique<CDaqLowLevelIo>();
struct stat daqTocInfo;
//_pDaqIo->SetCallbacks(NULL, &DaqProgressCallBack);
temp = fileName;
temp += ".toc";
//see if we have a .toc file, if not create one
if (0 != stat(temp.c_str(), &daqTocInfo)) {
if (!_pDaqIo->Open(fileName)) {
string message = "Unable to load DAQ file - ";
message += _pDaqIo->GetLastError();
_pDaqIo.reset();
return false;
}
if (!_pDaqIo->CheckIntegrity(true, true)) {
_pDaqIo.reset();
return false;
}
} }
else if (!_pDaqIo->Open(fileName) || !_pDaqIo->TocFileExists()) { ::DaqPlayer dp;
string message = "Unable to load DAQ file - "; std::vector<string> items = { "SCC_Audio_Trigger" };
message += _pDaqIo->GetLastError(); try {
return false; dp.OpenDaqFile(argv[1], items);
while (!dp.Eof()) {
++dp;
} }
_pDaqIo->GetChannels(_allDaqChannels);
_DaqFrameRate = _pDaqIo->GetFrequency();
if (_DaqFrameRate < 60)
_DaqFrameRate = 60;
size_t cnt = 0;
for (TChanInfoVec::iterator i = _allDaqChannels.begin(); i != _allDaqChannels.end(); i++,cnt++) {
_varNameList.push_back(i->GetName());
_nameToChannel[i->GetName()] = cnt;
for (auto & val : _cellList) {
if (i->GetName() == val) {
_getDaqChannels.push_back(i->GetId());
_daqNameToIndex[val] = (int)_getDaqChannels.size() - 1;
}
}
}
CDaqBuffer empty;
_daqBuffers.resize(_getDaqChannels.size(), empty);
TConvertOptions opt = eNO_OPTION;
opt = opt + eFILL_MISSING;
_firstFrame =_pDaqIo->GetFirstFrame();
_lastFrame = _pDaqIo->GetFrames() / (_DaqFrameRate / 60) + _firstFrame;
//lets see if we have any droped frames
_pDaqIo->QueryIntegrityValues(
_stats.drops, _stats.dropedFrm, _stats.skips, _stats.eofStat);
}
bool DaqPlayer::GotoFrame(int frameNum) {
//DAH this is +3, we are counting by 4's and we are not guarented to have data every 4th frame, although this is true 95% of the time
if (!_pDaqIo->GetFullData(&_getDaqChannels, _daqBuffers, eFILL_MISSING, frameNum, frameNum + _stride - 1)) {
return false;
} }
return true; catch (std::exception ex) {
} return 1;
bool DaqPlayer::AddCell(const std::string& str) {
auto itr = _nameToChannel.find(str);
if (itr == _nameToChannel.end()) {
return false;
} }
//see if we have it already return 0;
if (_daqNameToIndex.find(str) == _daqNameToIndex.end())
return true;
int id = _allDaqChannels[(itr->second)].GetId();
_getDaqChannels.push_back(id);
_daqNameToIndex[str] = _getDaqChannels.size()-1;
return true;
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment