本文整理汇总了C++中Parm::SetFromLink方法的典型用法代码示例。如果您正苦于以下问题:C++ Parm::SetFromLink方法的具体用法?C++ Parm::SetFromLink怎么用?C++ Parm::SetFromLink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parm
的用法示例。
在下文中一共展示了Parm::SetFromLink方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParmChanged
//==== Parm Changed ====//
void LinkMgrSingleton::ParmChanged( const string& pid, bool start_flag )
{
//==== Find Parm Ptr ===//
Parm* parm_ptr = ParmMgr.FindParm( pid );
if ( !parm_ptr )
return;
//==== Check For Advanced Links ====//
bool adv_link_flag = AdvLinkMgr.IsInputParm( pid );
//==== Look for Reg Links ====//
vector < Link* > parm_link_vec;
for ( int i = 0 ; i < ( int )m_LinkVec.size() ; i++ )
{
if ( m_LinkVec[i]->GetParmA() == pid )
{
parm_link_vec.push_back( m_LinkVec[i] );
}
}
//==== Check Links ====//
bool reg_link_flag = false;
if ( parm_link_vec.size() )
{
reg_link_flag = true;
}
//==== Abort if No Links ====//
if ( !adv_link_flag && !reg_link_flag )
return;
//==== Set Link Update Flag ====//
parm_ptr->SetLinkUpdateFlag( true );
m_UpdatedParmVec.push_back( parm_ptr->GetID() );
//==== Update Linked Parms ====//
for ( int i = 0 ; i < ( int )parm_link_vec.size() ; i++ )
{
Link* pl = parm_link_vec[i];
Parm* pB = ParmMgr.FindParm( pl->GetParmB() );
if ( pB && ! pB->GetLinkUpdateFlag() ) // Prevent Circular
{
double offset = 0.0;
if ( pl->GetOffsetFlag() )
{
offset = pl->m_Offset();
}
double scale = 1.0;
if ( pl->GetScaleFlag() )
{
scale = pl->m_Scale();
}
double val = parm_ptr->Get() * scale + offset;
if ( pl->GetLowerLimitFlag() && val < pl->m_LowerLimit() ) // Constraints
{
val = pl->m_LowerLimit();
}
if ( pl->GetUpperLimitFlag() && val > pl->m_UpperLimit() ) // Constraints
{
val = pl->m_UpperLimit();
}
pB->SetFromLink( val );
}
}
//==== Update Adv Link ===//
if ( adv_link_flag )
{
AdvLinkMgr.UpdateLinks( pid );
}
//==== Clean Up ====/
if ( start_flag )
{
for ( int i = 0 ; i < ( int )m_UpdatedParmVec.size() ; i++ )
{
Parm* p = ParmMgr.FindParm( m_UpdatedParmVec[i] );
if ( p )
{
p->SetLinkUpdateFlag( false );
}
}
m_UpdatedParmVec.clear();
Vehicle* veh = VehicleMgr.GetVehicle();
if ( veh )
{
veh->ParmChanged( parm_ptr, Parm::SET );
}
}
}