/* * p r i n t */ returnValue Constraints::print( ) { if ( n == 0 ) return SUCCESSFUL_RETURN; #ifndef __SUPPRESSANYOUTPUT__ char myPrintfString[MAX_STRING_LENGTH]; int_t nIAC = getNIAC( ); int_t nAC = getNAC( ); int_t* IAC_idx; getInactive( )->getNumberArray( &IAC_idx ); int_t* AC_idx; getActive( )->getNumberArray( &AC_idx ); snprintf( myPrintfString,MAX_STRING_LENGTH,"Constraints object comprising %d constraints (%d inactive, %d active):\n",(int)n,(int)nIAC,(int)nAC ); myPrintf( myPrintfString ); REFER_NAMESPACE_QPOASES print( IAC_idx,nIAC,"inactive" ); REFER_NAMESPACE_QPOASES print( AC_idx, nAC, "active " ); #endif /* __SUPPRESSANYOUTPUT__ */ return SUCCESSFUL_RETURN; }
/** Reset to default values * * Resets the current settings to default values */ bool Settings::reset() { int index = 0; DMSG("Active buffer is currently %08x", m_pActive); m_pActive = getInactive(m_pBuffer1, m_pBuffer2, m_pActive); DMSG("Switched to active buffer at %08x (p1 = %08x, p2 = %08x)", m_pActive, m_pBuffer1, m_pBuffer2); for(int i=0; m_pDefaults[i].typeAndModifier != EndOfSettings; i++) { DMSG("Packing entry %d at offset %d", i, index); index = packSetting(m_pActive, index, m_size, m_pDefaults[i]); if(index<=0) { DMSG("Packing failed, reverting to previous buffer"); m_pActive = getInactive(m_pBuffer1, m_pBuffer2, m_pActive); return false; } } m_used = index; return true; }
/** Set the value of a boolean setting * * @param cszName the name of the setting to modify * @param value the new value for the setting * * @return true on success, false if the setting is of the wrong type * or the buffer is not large enough to contain the new value. */ bool Settings::setBoolean(const char *cszName, bool value) { SettingDescription setting; if (findSetting(m_pActive, m_size, cszName, setting)<0) return false; if ((setting.typeAndModifier & SETTING_TYPE_MASK) != BooleanSetting) return false; setting.value.boolean = value; // Now clone with the new value unsigned char *pBackup = getInactive(m_pBuffer1, m_pBuffer2, m_pActive); int result = cloneWithChange(m_pActive, pBackup, m_size, setting); if (result>0) { m_pActive = pBackup; m_used = result; return true; } return false; }