/*---------------------------------------------------------------------- | PLT_Argument::SetValue +---------------------------------------------------------------------*/ NPT_Result PLT_Argument::SetValue(const char* value) { NPT_CHECK_SEVERE(ValidateValue(value)); m_Value = value; return NPT_SUCCESS; }
//definition of class methods void ConfigurableImpl::SetParameter( const uint64 & actualKey, eDataType type, const CombinedDataValue & value ) { uint64 key = ModifyKey( actualKey ); if ( mTreatKeyAsCaseInsensitiveCharBuffer ) key = ConvertToLowerCase( key ); eConfigurableErrorCode validKey = ValidateKey( key ); eDataType oldType = kDTNone; CombinedDataValue oldValue; if ( validKey == kCECNone ) { AutoSharedLock lock( GetMutex(), true ); if ( mKeysSet ) { auto it = mKeysSet->find( key ); if ( it == mKeysSet->end() ) NotifyError( "Key is not supported", key, kCECKeyNotSupported, type, value, oldType, oldValue ); } eConfigurableErrorCode validValue = ValidateValue( key, type, value ); if ( validValue == kCECNone && mKeyValueTypeMap ) { auto it = mKeyValueTypeMap->find( key ); if ( it != mKeyValueTypeMap->end() ) { if ( type != it->second ) { validValue = kCECValueTypeNotSupported; } } } if ( validValue == kCECNone && !mAllowDifferentValueTypesForExistingEntries ) { auto it = mMap.find( key ); if ( it != mMap.end() && it->second.first != type ) validValue = kCECPreviousTypeDifferent; } if ( validValue == kCECNone ) { TypeValuePair pair; pair.first = type; pair.second = value; mMap[ key ] = pair; } else { auto it = mMap.find( key ); if ( it != mMap.end() ) { oldType = it->second.first; oldValue = it->second.second; } NotifyError( "Validation failed for the parameter, type and value combination", key, validValue, type, value, oldType, oldValue ); } } else { NotifyError( "Key is not valid", key, validKey, type, value, oldType, oldValue ); } }
/*---------------------------------------------------------------------- | PLT_StateVariable::SetValue +---------------------------------------------------------------------*/ NPT_Result PLT_StateVariable::SetValue(const char* value, const bool clearonsend /*=false*/) { if (value == NULL) { return NPT_FAILURE; } // update only if it's different if (m_Value != value) { NPT_Result res = ValidateValue(value); if (NPT_FAILED(res)) { return res; } m_Value = value; m_ShouldClearOnSend = clearonsend; m_Service->AddChanged(this); } return NPT_SUCCESS; }