📄 rec_settings.cpp
字号:
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;
}
}
// Find calApplied (required)
if( status )
{
status = false;
pvect = FindVectorInCollection( pcollMain, tagCalApplied );
if( pvect )
{
// Check size of vector
pvect->GetCount( count );
if( pvect->GetPhysicalType() == ID_PHYS_TYPE_REAL8 )
{
// Copy them over (pvect --> triggerShapeParam)
calApplied.SetCount( count );
for( idx = 0; idx < count; idx++ )
{
pvect->GetValueREAL8( idx, valueREAL8 );
calApplied.SetValueREAL8( idx, valueREAL8 );
}
status = true;
} // Got the right physical type and array size
} // Found vector
}
// Find calRecorded (required)
if( status )
{
status = false;
pvect = FindVectorInCollection( pcollMain, tagCalRecorded );
if( pvect )
{
// Check size of vector
pvect->GetCount( count );
if( pvect->GetPhysicalType() == ID_PHYS_TYPE_REAL8 )
{
// Copy them over (pvect --> triggerShapeParam)
calRecorded.SetCount( count );
for( idx = 0; idx < count; idx++ )
{
pvect->GetValueREAL8( idx, valueREAL8 );
calRecorded.SetValueREAL8( idx, valueREAL8 );
}
status = true;
} // Got the right physical type and array size
} // Found vector
}
return status;
}
// Set functions
// -------------
bool CPQDIF_R_Settings::SetConnectionInfo
(
const UINT4 connectionType
)
{
bool status = true;
CPQDIF_E_Scalar * psc;
PQDIFValue value;
// Set the connection type
if( status )
{
status = false;
psc = FindOrCreateScalarInCollection( m_pcollMain,
tagSettingPhysicalConnection, ID_PHYS_TYPE_UNS_INTEGER4 );
// Set value
if( psc )
{
value.uint4 = connectionType;
status = psc->SetValue( ID_PHYS_TYPE_UNS_INTEGER4, value );
}
}
return status;
}
bool CPQDIF_R_Settings::SetInfo
(
const TIMESTAMPPQDIF& timeEffective,
const TIMESTAMPPQDIF& timeInstalled,
const TIMESTAMPPQDIF& timeRemoved,
bool useCal,
bool useTrans
)
{
bool status = true;
CPQDIF_E_Scalar * psc;
PQDIFValue value;
CPQDIF_E_Collection * pcolInstances;
// Set times ... effective
if( status )
{
status = false;
psc = FindOrCreateScalarInCollection( m_pcollMain,
tagEffective, ID_PHYS_TYPE_TIMESTAMPPQDIF );
// Set value
if( psc )
{
value.ts = timeEffective;
status = psc->SetValue( ID_PHYS_TYPE_TIMESTAMPPQDIF, value );
}
}
// ... installed
if( status )
{
status = false;
psc = FindOrCreateScalarInCollection( m_pcollMain,
tagTimeInstalled, ID_PHYS_TYPE_TIMESTAMPPQDIF );
// Set value
if( psc )
{
value.ts = timeInstalled;
status = psc->SetValue( ID_PHYS_TYPE_TIMESTAMPPQDIF, value );
}
}
// ... removed
if( status )
{
status = false;
psc = FindOrCreateScalarInCollection( m_pcollMain,
tagTimeRemoved, ID_PHYS_TYPE_TIMESTAMPPQDIF );
// Set value
if( psc )
{
value.ts = timeRemoved;
status = psc->SetValue( ID_PHYS_TYPE_TIMESTAMPPQDIF, value );
}
}
// Flags ... useCal
if( status )
{
status = false;
psc = FindOrCreateScalarInCollection( m_pcollMain,
tagUseCalibration, ID_PHYS_TYPE_BOOLEAN4 );
// Set value
if( psc )
{
value.bool4 = useCal;
status = psc->SetValue( ID_PHYS_TYPE_BOOLEAN4, value );
}
}
// ... useTrans
if( status )
{
status = false;
psc = FindOrCreateScalarInCollection( m_pcollMain,
tagUseTransducer, ID_PHYS_TYPE_BOOLEAN4 );
// Set value
if( psc )
{
value.bool4 = useTrans;
status = psc->SetValue( ID_PHYS_TYPE_BOOLEAN4, value );
}
}
// Is there a collection?
pcolInstances = GetChannelSettings();
if( !pcolInstances )
{
// Nope, insert an empty collection ...
pcolInstances = (CPQDIF_E_Collection *) theFactory.NewElement( ID_ELEMENT_TYPE_COLLECTION );
pcolInstances->SetTag( tagChannelSettingsArray );
m_pcollMain->Add( pcolInstances );
}
return status;
}
long CPQDIF_R_Settings::AddChannel
(
UINT4 idxChannelDefn
)
{
long idxNew = -1;
//
//
// Is there a collection?
//
CPQDIF_E_Collection * pcolInstances = GetChannelSettings();
if( !pcolInstances )
{
// Nope, insert an empty collection ...
pcolInstances = (CPQDIF_E_Collection *) theFactory.NewElement( ID_ELEMENT_TYPE_COLLECTION );
pcolInstances->SetTag( tagChannelSettingsArray );
m_pcollMain->Add( pcolInstances );
}
if( pcolInstances )
{
// Get the new index
idxNew = GetCountChannels();
// Create the new channel instance
CPQDIF_E_Collection * pcollOne = (CPQDIF_E_Collection *) theFactory.NewElement( ID_ELEMENT_TYPE_COLLECTION );
pcollOne->SetTag( tagOneChannelSetting );
// Stuff in the information...
pcollOne->SetScalarUINT4( tagChannelDefnIdx, idxChannelDefn );
// We're done filling the collection ... add it!
pcolInstances->Add( pcollOne );
}
return idxNew;
}
long CPQDIF_R_Settings::AddChannel
(
UINT4 idxChannelDefn,
UINT4 idTriggerType
)
{
long idxNew = -1;
//
//
// Is there a collection?
//
CPQDIF_E_Collection * pcolInstances = GetChannelSettings();
if( !pcolInstances )
{
// Nope, insert an empty collection ...
pcolInstances = (CPQDIF_E_Collection *) theFactory.NewElement( ID_ELEMENT_TYPE_COLLECTION );
pcolInstances->SetTag( tagChannelSettingsArray );
m_pcollMain->Add( pcolInstances );
}
if( pcolInstances )
{
// Get the new index
idxNew = GetCountChannels();
// Create the new channel instance
CPQDIF_E_Collection * pcollOne = (CPQDIF_E_Collection *) theFactory.NewElement( ID_ELEMENT_TYPE_COLLECTION );
pcollOne->SetTag( tagOneChannelSetting );
// Stuff in the information...
pcollOne->SetScalarUINT4( tagChannelDefnIdx, idxChannelDefn );
pcollOne->SetScalarUINT4( tagTriggerTypeID, idTriggerType );
// We're done filling the collection ... add it!
pcolInstances->Add( pcollOne );
}
return idxNew;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -