📄 rec_settings.cpp
字号:
/*
** CPQDIF_R_Settings class. Implements a PQDIF record "wrapper" for the
** settings record. You can cast a standard record object to this class.
** --------------------------------------------------------------------------
**
** File name: $Workfile: rec_settings.cpp $
** Last modified: $Modtime: 3/12/98 3:27p $
** Last modified by: $Author: Rob $
**
** VCS archive path: $Archive: /Hank/DMM/FirmWare/Level3/ObDatMgr/rec_settings.cpp $
** VCS revision: $Revision: 6 $
*/
#include "PQDIF_classes.h"
long CPQDIF_R_Settings::GetCountChannels( void )
{
long count = 0;
CPQDIF_E_Collection * pcolCI;
pcolCI = GetChannelSettings();
if( pcolCI )
{
count = pcolCI->GetCount();
}
return count;
}
bool CPQDIF_R_Settings::GetInfo
(
TIMESTAMPPQDIF& timeEffective,
TIMESTAMPPQDIF& timeInstalled,
TIMESTAMPPQDIF& timeRemoved,
bool& useCal,
bool& useTrans
)
{
bool status = false;
bool foundItem = false;
CPQDIF_E_Scalar * psc;
// Init
memset( &timeEffective, 0, sizeof( timeEffective ) );
memset( &timeInstalled, 0, sizeof( timeEffective ) );
memset( &timeRemoved, 0, sizeof( timeEffective ) );
useCal = false;
useTrans = false;
// Find effective time (required)
status = true;
if( status )
{
status = false;
psc = FindScalarInCollection( m_pcollMain, tagEffective );
if( psc )
{
foundItem = psc->GetValueTimeStamp( timeEffective );
}
}
// Find installed time (optional)
if( status )
{
psc = FindScalarInCollection( m_pcollMain, tagTimeInstalled );
if( psc )
{
foundItem = psc->GetValueTimeStamp( timeInstalled );
}
}
// Find removed time (optional)
if( status )
{
psc = FindScalarInCollection( m_pcollMain, tagTimeRemoved );
if( psc )
{
foundItem = psc->GetValueTimeStamp( timeRemoved );
}
}
// Find useCal (required)
if( status )
{
status = false;
psc = FindScalarInCollection( m_pcollMain, tagUseCalibration );
if( psc )
{
foundItem = psc->GetValueBOOL4( useCal );
if( foundItem )
{
status = true;
}
}
}
// Find useTrans (required)
if( status )
{
status = false;
psc = FindScalarInCollection( m_pcollMain, tagUseTransducer );
if( psc )
{
foundItem = psc->GetValueBOOL4( useTrans );
if( foundItem )
{
status = true;
}
}
}
return status;
}
bool CPQDIF_R_Settings::GetChannelInfo
(
long idxChannel,
UINT4& idxChannelDefn,
UINT4& triggerTypeID,
REAL8& fullScale,
REAL8& noiseFloor,
REAL8& triggerLow,
REAL8& triggerHigh,
REAL8& triggerRate,
CPQDIF_E_Vector& triggerShapeParam // Array of [3] ... or NULL
//REAL8 * triggerShapeParam // Array of [3] ... or NULL
)
{
bool status = false;
bool foundItem;
CPQDIF_E_Collection * pcollMain;
CPQDIF_E_Collection * pcollChannel = NULL;
CPQDIF_E_Vector * pvect;
PQDIFValue value;
long count;
long idx;
double valueREAL8;
const long countParams = 3;
// Find the appropriate channel collection
pcollMain = GetOneChannelSetting( idxChannel );
if( pcollMain )
{
status = true;
}
// Find channel defn (required)
if( status )
{
foundItem = GetScalarValueInCollection( pcollMain, tagChannelDefnIdx, ID_PHYS_TYPE_UNS_INTEGER4, value );
if( foundItem )
{
idxChannelDefn = value.uint4;
status = true;
}
}
// Find trigger type (required)
if( status )
{
foundItem = GetScalarValueInCollection( pcollMain, tagTriggerTypeID, ID_PHYS_TYPE_UNS_INTEGER4, value );
if( foundItem )
{
triggerTypeID = value.uint4;
status = true;
}
}
// Find full scale (required)
if( status )
{
status = false;
foundItem = GetScalarValueInCollection( pcollMain, tagFullScale, ID_PHYS_TYPE_REAL8, value );
if( foundItem )
{
fullScale = value.real8;
status = true;
}
}
// Find noise floor (required)
if( status )
{
status = false;
foundItem = GetScalarValueInCollection( pcollMain, tagNoiseFloor, ID_PHYS_TYPE_REAL8, value );
if( foundItem )
{
noiseFloor = value.real8;
status = true;
}
}
// Find trigger low (required)
if( status )
{
status = false;
foundItem = GetScalarValueInCollection( pcollMain, tagTriggerLow, ID_PHYS_TYPE_REAL8, value );
if( foundItem )
{
triggerLow = value.real8;
status = true;
}
}
// Find trigger high (required)
if( status )
{
status = false;
foundItem = GetScalarValueInCollection( pcollMain, tagTriggerHigh, ID_PHYS_TYPE_REAL8, value );
if( foundItem )
{
triggerHigh = value.real8;
status = true;
}
}
// Find trigger rate (required)
if( status )
{
status = false;
foundItem = GetScalarValueInCollection( pcollMain, tagTriggerRate, ID_PHYS_TYPE_REAL8, value );
if( foundItem )
{
triggerRate = value.real8;
status = true;
}
}
// Find trigger shape (optional)
if( status )
{
//status = false;
pvect = FindVectorInCollection( pcollMain, tagTriggerShapeParam );
if( pvect )
{
// Check size of vector
pvect->GetCount( count );
if( pvect->GetPhysicalType() == ID_PHYS_TYPE_REAL8
&& count == countParams )
{
// Copy them over (pvect --> triggerShapeParam)
triggerShapeParam.SetCount( count );
for( idx = 0; idx < count; idx++ )
{
pvect->GetValueREAL8( idx, valueREAL8 );
triggerShapeParam.SetValueREAL8( idx, valueREAL8 );
}
status = true;
} // Got the right physical type and array size
} // Found vector
}
return status;
}
bool CPQDIF_R_Settings::GetChanTrans
(
long idxChannel,
UINT4& xdTransformerTypeID,
REAL8& xdSystemSideRatio,
REAL8& xdMonitorSideRatio,
CPQDIF_E_Vector& xdFrequencyResponse // Array [n]... or NULL
)
{
bool status = false;
bool foundItem;
CPQDIF_E_Collection * pcollMain;
CPQDIF_E_Collection * pcollChannel = NULL;
CPQDIF_E_Vector * pvect;
PQDIFValue value;
long count;
long idx;
double valueREAL8;
// Find the appropriate channel collection
pcollMain = GetOneChannelSetting( idxChannel );
if( pcollMain )
{
status = true;
}
// Find xdTransformerTypeID (required)
if( status )
{
foundItem = GetScalarValueInCollection( pcollMain, tagXDTransformerTypeID, ID_PHYS_TYPE_UNS_INTEGER4, value );
if( foundItem )
{
xdTransformerTypeID = value.uint4;
status = true;
}
}
// Find xdSystemSideRatio (required)
if( status )
{
status = false;
foundItem = GetScalarValueInCollection( pcollMain, tagXDSystemSideRatio, ID_PHYS_TYPE_REAL8, value );
if( foundItem )
{
xdSystemSideRatio = value.real8;
status = true;
}
}
// Find xdMonitorSideRatio (required)
if( status )
{
status = false;
foundItem = GetScalarValueInCollection( pcollMain, tagXDMonitorSideRatio, ID_PHYS_TYPE_REAL8, value );
if( foundItem )
{
xdMonitorSideRatio = value.real8;
status = true;
}
}
// Find xdFrequencyResponse (required)
if( status )
{
status = false;
pvect = FindVectorInCollection( pcollMain, tagXDFrequencyResponse );
if( pvect )
{
// Check size of vector
pvect->GetCount( count );
if( pvect->GetPhysicalType() == ID_PHYS_TYPE_REAL8 )
{
// Copy them over (pvect --> triggerShapeParam)
xdFrequencyResponse.SetCount( count );
for( idx = 0; idx < count; idx++ )
{
pvect->GetValueREAL8( idx, valueREAL8 );
xdFrequencyResponse.SetValueREAL8( idx, valueREAL8 );
}
status = true;
} // Got the right physical type and array size
} // Found vector
}
return status;
}
bool CPQDIF_R_Settings::GetChanCal
(
long idxChannel,
REAL8& calTimeSkew,
REAL8& calOffset,
REAL8& calRatio,
bool& calMustUseARCal,
CPQDIF_E_Vector& calApplied, // Array [n]
CPQDIF_E_Vector& calRecorded // Array [n]
)
{
bool status = false;
bool foundItem;
CPQDIF_E_Collection * pcollMain;
CPQDIF_E_Collection * pcollChannel = NULL;
CPQDIF_E_Vector * pvect;
PQDIFValue value;
long count;
long idx;
double valueREAL8;
// Find the appropriate channel collection
pcollMain = GetOneChannelSetting( idxChannel );
if( pcollMain )
{
status = true;
}
// Find calTimeSkew (required)
if( status )
{
status = false;
foundItem = GetScalarValueInCollection( pcollMain, tagCalTimeSkew, ID_PHYS_TYPE_REAL8, value );
if( foundItem )
{
calTimeSkew = value.real8;
status = true;
}
}
// Find calOffset (required)
if( status )
{
status = false;
foundItem = GetScalarValueInCollection( pcollMain, tagCalOffset, ID_PHYS_TYPE_REAL8, value );
if( foundItem )
{
calOffset = value.real8;
status = true;
}
}
// Find calRatio (required)
if( status )
{
status = false;
foundItem = GetScalarValueInCollection( pcollMain, tagCalRatio, ID_PHYS_TYPE_REAL8, value );
if( foundItem )
{
calRatio = value.real8;
status = true;
}
}
// Find calMustUseARCal (required)
if( status )
{
status = false;
foundItem = GetScalarValueInCollection( pcollMain, tagCalMustUseARCal, ID_PHYS_TYPE_BOOLEAN4, value );
if( foundItem )
{
calMustUseARCal = value.bool4 ? true : false;
status = true;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -