----------------------------------------------------------------------------- Automatically associate the controller with certain groups -----------------------------------------------------------------------------
| 3101 | // Automatically associate the controller with certain groups |
| 3102 | //----------------------------------------------------------------------------- |
| 3103 | void Node::AutoAssociate |
| 3104 | ( |
| 3105 | ) |
| 3106 | { |
| 3107 | bool autoAssociate = false; |
| 3108 | Options::Get()->GetOptionAsBool( "Associate", &autoAssociate ); |
| 3109 | if( autoAssociate ) |
| 3110 | { |
| 3111 | // Try to automatically associate with any groups that have been flagged. |
| 3112 | uint8 controllerNodeId = GetDriver()->GetControllerNodeId(); |
| 3113 | |
| 3114 | for( map<uint8,Group*>::iterator it = m_groups.begin(); it != m_groups.end(); ++it ) |
| 3115 | { |
| 3116 | Group* group = it->second; |
| 3117 | if( group->IsAuto() && !group->Contains( controllerNodeId ) ) |
| 3118 | { |
| 3119 | // Associate the controller into the group |
| 3120 | Log::Write( LogLevel_Info, m_nodeId, "Adding the controller to group %d (%s) of node %d", group->GetIdx(), group->GetLabel().c_str(), GetNodeId() ); |
| 3121 | group->AddAssociation( controllerNodeId ); |
| 3122 | } |
| 3123 | } |
| 3124 | } |
| 3125 | } |
| 3126 | |
| 3127 | //----------------------------------------------------------------------------- |
| 3128 | // <Node::GetDriver> |