I_Value* CreateValue( VALUE_TYPE inType, vuint16 inFlags, void* inParam1, void* inParam2, bool inIsRemote ) { TVALUE_FACTORY::iterator p = gValueFactory.find( inType ); if( p == gValueFactory.end() ) return nullptr; MAKE_VALUE_FUNC_PTR pFactory = (*p).second; bool Nullable = bool(inFlags & fNullable); I_Value* pValue = pFactory( Nullable, inParam1, inParam2 ); // on default value has inIsRemote = false, // so we need to assign it only if it is really remote. if( inIsRemote ) pValue->put_IsRemote( inIsRemote ); return pValue; }
I_Value* CreateValue_Enum( I_Type_Enumerated_Ptr inpType, vuint16 inFlags, bool inIsRemote ) { FBL_CHECK( inpType ); I_Value* pValue = nullptr; switch( inpType->get_MaxIdentCount() ) { case ENUM_8_IDENT_COUNT: { pValue = (bool(inFlags & fNullable)) ? new Value_enum_null8( inpType ) : new Value_enum8( inpType ); } break; case ENUM_16_IDENT_COUNT: { pValue = (bool(inFlags & fNullable)) ? new Value_enum_null16( inpType ) : new Value_enum16( inpType ); } break; default: { FBL_Throw( xFeatureError( ERR_FEATURE_NOT_SUPPORTED, "Not enum8 or enum16" ) ); } } if( inIsRemote ) pValue->put_IsRemote( inIsRemote ); return pValue; }