Commit 96d45782 by IOWA\dheitbri

update for KPMG_RS1_Main

parent 62fe9a63
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/// ///
// DAQ low level IO Library // DAQ low level IO Library
// //
// $Id: DaqFileIO.cxx,v 1.23 2016/04/19 21:05:50 iowa\cschwarz Exp $ // $Id: DaqFileIO.cxx,v 1.24 2016/10/17 13:04:28 IOWA\dheitbri Exp $
// Date: March, 2005 // Date: March, 2005
// Author: Yiannis Papelis // Author: Yiannis Papelis
// //
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
#include <io.h> #include <io.h>
using namespace std; using namespace std;
#ifdef WIN32
#pragma warning(push)
#pragma warning(disable: 4996)
#endif
/// ///
/// Small dummy function to act as the default callback /// Small dummy function to act as the default callback
/// ///
...@@ -499,7 +502,8 @@ CDaqLowLevelIo::ResyncFrame( ...@@ -499,7 +502,8 @@ CDaqLowLevelIo::ResyncFrame(
void void
CDaqLowLevelIo::Close(void) CDaqLowLevelIo::Close(void)
{ {
fclose(m_pFile); if (m_pFile)
fclose(m_pFile);
m_pFile = 0; m_pFile = 0;
...@@ -1307,7 +1311,7 @@ CDaqLowLevelIo::LowLevelDataRead( ...@@ -1307,7 +1311,7 @@ CDaqLowLevelIo::LowLevelDataRead(
memset(((char *)pTempSpace) + size, 0, fullSize - size); memset(((char *)pTempSpace) + size, 0, fullSize - size);
} }
daqBuf.Append(pTempSpace, fullSize, ch.GetItemCount()); daqBuf.Append(pTempSpace, fullSize, ch.GetItemCount());
if ( pFrameList && pFrameList->size() > needChan[chId]) if ( pFrameList && (int)pFrameList->size() > needChan[chId])
{ {
(*pFrameList)[needChan[chId]].push_back(curFrame); (*pFrameList)[needChan[chId]].push_back(curFrame);
} }
...@@ -1580,7 +1584,8 @@ CDaqLowLevelIo::GetFullData( ...@@ -1580,7 +1584,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) ///< Where to store frame sequences vector<TIntVec>* pFrmList,
int maxDiffLook) ///< Where to store frame sequences
{ {
char buf[256]; // buffer for writing messages char buf[256]; // buffer for writing messages
...@@ -1698,6 +1703,10 @@ CDaqLowLevelIo::GetFullData( ...@@ -1698,6 +1703,10 @@ CDaqLowLevelIo::GetFullData(
// have none // have none
// //
if ( frm1 != GetFirstFrame() ) { if ( frm1 != GetFirstFrame() ) {
int endFrame = GetFirstFrame();
if (maxDiffLook>0){
endFrame = max(frm1 - maxDiffLook,endFrame);
}
for (size_t idx=0; idx < pChnList->size(); idx++) { for (size_t idx=0; idx < pChnList->size(); idx++) {
if ( m_Channels[(*pChnList)[idx]].GetCapRate() < 0 ) { if ( m_Channels[(*pChnList)[idx]].GetCapRate() < 0 ) {
// Search backwards from frame frm1 until // Search backwards from frame frm1 until
...@@ -1707,12 +1716,15 @@ CDaqLowLevelIo::GetFullData( ...@@ -1707,12 +1716,15 @@ CDaqLowLevelIo::GetFullData(
int candFrame = frm1; int candFrame = frm1;
int theChan = (*pChnList)[idx]; int theChan = (*pChnList)[idx];
while ( !done && candFrame >= GetFirstFrame() ) { while ( !done && candFrame >= endFrame ) {
ReadFrameHeader(candFrame, curFrame, numChan, bytesSkipped); ReadFrameHeader(candFrame, curFrame, numChan, bytesSkipped);
ReadChannelDataForOneFrame(numChan, theChan, latestData[idx], pTempSpace, done); ReadChannelDataForOneFrame(numChan, theChan, latestData[idx], pTempSpace, done);
candFrame--; candFrame--;
} }
if ( !done ) { if (candFrame < endFrame){
done = true;
}
if ( !done && endFrame < 0 ) {
m_LastError = "could not find any data for var channel; possible internal error"; m_LastError = "could not find any data for var channel; possible internal error";
return false; return false;
} }
...@@ -2082,5 +2094,7 @@ CDaqLowLevelIo::ReadFrameHeader( ...@@ -2082,5 +2094,7 @@ CDaqLowLevelIo::ReadFrameHeader(
frameToRead = -1; // no seeking needed after a resync frameToRead = -1; // no seeking needed after a resync
} }
} }
#ifdef WIN32
#pragma warning(pop)
#endif
/// @} /// @}
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions> </PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild> <MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
......
...@@ -29,7 +29,7 @@ public: ...@@ -29,7 +29,7 @@ public:
bool LowLevelDataCopy(const TIntVec* chans, TFileVec& dest, bool LowLevelDataCopy(const TIntVec* chans, TFileVec& dest,
TConvertOptions options = eBINARY_FORMAT + eINCLUDE_FRAME); TConvertOptions options = eBINARY_FORMAT + eINCLUDE_FRAME);
bool GetFullData(const TIntVec* chans, TDataVec& data, TConvertOptions option = eNO_OPTION, bool GetFullData(const TIntVec* chans, TDataVec& data, TConvertOptions option = eNO_OPTION,
int firstFrame = -1, int lastFrame = -1, std::vector<TIntVec>* pFrameList = 0); int firstFrame = -1, int lastFrame = -1, std::vector<TIntVec>* pFrameList = 0, int maxDiffLook = -1);
bool Open(const std::string &); ///< Open the file bool Open(const std::string &); ///< Open the file
void GetChannels(TChanInfoVec& channels) const; ///< Return info about channels void GetChannels(TChanInfoVec& channels) const; ///< Return info about channels
......
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