//==== Get Container Name Vec And Find Match Index For Parm_ID ====// int LinkMgrSingleton::GetCurrContainerVec( const string& parm_id, vector< string > & idVec ) { int index = 0; BuildLinkableParmData(); //==== Find Container ID ====// string curr_container_id; Parm* p = ParmMgr.FindParm( parm_id ); if ( p ) { curr_container_id = p->GetLinkContainerID(); } //==== Find Index And Load Container Names ===// for ( int i = 0 ; i < ( int )m_LinkableContainers.size() ; i++ ) { if ( m_LinkableContainers[i] == curr_container_id ) { index = i; } ParmContainer* pc = ParmMgr.FindParmContainer( m_LinkableContainers[i] ); string name; if ( pc ) { name = pc->GetName(); } idVec.push_back( name ); } return index; }
string XSecSurf::GetName() { ParmContainer* pc = GetParentContainerPtr(); if ( pc ) { return pc->GetName(); } return ParmContainer::GetName(); }
//==== Trigger Updates Because A Parm Changed ====// void XSecSurf::ParmChanged( Parm* parm_ptr, int type ) { ParmContainer* pc = GetParentContainerPtr(); if ( pc ) { pc->ParmChanged( parm_ptr, type ); } }
string LinkMgrSingleton::PickParm( int container_ind, int group_ind, int parm_ind ) { ParmContainer* pc = FindParmContainer( container_ind ); string pid; if ( pc ) { pid = pc->FindParm( group_ind, parm_ind ); } return pid; }
//==== Get Parm ID Vec And Find Match Index For Parm_ID ====// int LinkMgrSingleton::GetCurrParmIDVec( const string& parm_id, vector< string > & idVec ) { int index = 0; BuildLinkableParmData(); if ( m_LinkableContainers.size() == 0 ) { return index; } string group_name; Parm* p = ParmMgr.FindParm( parm_id ); if ( p ) { ParmContainer* pc = p->GetLinkContainer(); if ( pc ) { return pc->GetParmIDs( parm_id, idVec ); } } return index; }
//==== Find All Linkable Containers and Parms ====// void LinkMgrSingleton::BuildLinkableParmData() { //==== Check If Any Parms Have Added/Removed From Last Build ====// static int build_linkable_stamp = 0; if ( ParmMgr.GetNumParmChanges() == build_linkable_stamp ) { return; } build_linkable_stamp = ParmMgr.GetNumParmChanges(); m_LinkableContainers.clear(); for ( int i = 0 ; i < ( int )m_BaseLinkableContainers.size() ; i++ ) { ParmContainer* pc = ParmMgr.FindParmContainer( m_BaseLinkableContainers[i] ); if ( pc ) { //==== Find All Linkable Containers (Children of Base Container) And Parms ===// pc->AddLinkableContainers( m_LinkableContainers ); } } }
//==== Link All Parms In A Container (Component) ====// bool LinkMgrSingleton::LinkAllComp() { Parm* pA = ParmMgr.FindParm( m_WorkingLink->GetParmA() ); Parm* pB = ParmMgr.FindParm( m_WorkingLink->GetParmB() ); ParmContainer* pcA = pA->GetLinkContainer(); ParmContainer* pcB = pB->GetLinkContainer(); if ( !pcA || !pcB ) { return false; } if ( pcA == pcB ) { return false; } vector< string > parmAVec, parmBVec; pcA->AddLinkableParms( parmAVec, pcA->GetID() ); pcB->AddLinkableParms( parmBVec, pcB->GetID() ); for ( int k = 0 ; k < ( int )parmAVec.size() ; k++ ) { for ( int n = 0 ; n < ( int )parmBVec.size() ; n++ ) { Parm* parmA = ParmMgr.FindParm( parmAVec[k] ); Parm* parmB = ParmMgr.FindParm( parmBVec[n] ); if ( parmA && parmB ) { if ( parmA->GetName() == parmB->GetName() && parmA->GetDisplayGroupName() == parmB->GetDisplayGroupName() ) { AddLink( parmAVec[k], parmBVec[n] ); } } } } return true; }