示例#1
0
        public static bool HandleIntrinsic(
            ref InvocationContext context,
            out ValueReference result)
        {
            result = default;
            var method = context.Method;

            var intrinsic = method.GetCustomAttribute <IntrinsicAttribute>();

            if (intrinsic != null)
            {
                result = IntrinsicHandlers[(int)intrinsic.Type](ref context, intrinsic);
            }

            if (IsIntrinsicArrayType(method.DeclaringType))
            {
                result = HandleArrays(ref context);
            }
            else if (FunctionHandlers.TryGetValue(
                         method.DeclaringType,
                         out DeviceFunctionHandler handler))
            {
                result = handler(ref context);
            }

            return(result.IsValid);
        }
示例#2
0
        public static void SetValue(this CorValRef thisVal, EvaluationContext ctx, CorValRef val)
        {
            CorEvaluationContext cctx = (CorEvaluationContext)ctx;
            CorObjectAdaptor     actx = (CorObjectAdaptor)ctx.Adapter;

            if (actx.IsEnum(ctx, thisVal.Val.ExactType) && !actx.IsEnum(ctx, val.Val.ExactType))
            {
                ValueReference vr = actx.GetMember(ctx, null, thisVal, "value__");
                vr.Value = val;
                // Required to make sure that var returns an up-to-date value object
                thisVal.IsValid = false;
                return;
            }

            CorReferenceValue s = thisVal.Val.CastToReferenceValue();

            if (s != null)
            {
                CorReferenceValue v = val.Val.CastToReferenceValue();
                if (v != null)
                {
                    s.Value = v.Value;
                    return;
                }
            }
            CorGenericValue gv = CorObjectAdaptor.GetRealObject(cctx, thisVal.Val) as CorGenericValue;

            if (gv != null)
            {
                gv.SetValue(ctx.Adapter.TargetObjectToObject(ctx, val));
            }
        }
        private void BindDataValue <T>(ExpandoObject data, string key, RenderTreeBuilder builder, DynamicControl control)
        {
            var accessor = ((IDictionary <string, object>)data);

            object value = default(T);

            accessor.TryGetValue(key, out value);

            value = GetValue <T>(accessor, key);

            var valueChanged = RuntimeHelpers.TypeCheck(
                EventCallback.Factory.Create <T>(
                    this, EventCallback.Factory.CreateInferred(this, __value => accessor[key] = __value,
                                                               GetValue <T>(accessor, key))));

            var formElementReference = new ValueReference <T>()
            {
                Value        = (T)value,
                ValueChanged = valueChanged
            };

            var constantDropDown = Expression.Constant(formElementReference, typeof(ValueReference <T>));
            var exp = Expression.Property(constantDropDown, nameof(ValueReference <T> .Value));

            builder.AddAttribute(1, "Value", formElementReference.Value);
            builder.AddAttribute(3, "ValueChanged", formElementReference.ValueChanged);
            builder.AddAttribute(4, "ValueExpression", Expression.Lambda <Func <T> >(exp));
            builder.AddAttribute(6, "Placeholder", control.EmptyText ?? String.Empty);
        }
示例#4
0
        /// <summary>
        /// Creates a new index structure instance.
        /// </summary>
        /// <param name="location">The current location.</param>
        /// <param name="dimension">The dimension value.</param>
        /// <returns>The created index type.</returns>
        public ValueReference CreateIndex(Location location, ValueReference dimension)
        {
            var instance = CreateDynamicStructure(location, 1);

            instance.Add(dimension);
            return(instance.Seal());
        }
示例#5
0
        /// <summary>
        /// Creates a new index structure instance.
        /// </summary>
        /// <param name="dimension">The dimension value.</param>
        /// <returns>The created index type.</returns>
        public ValueReference CreateIndex(ValueReference dimension)
        {
            var indexType = GetIndexType(0);
            var instance  = CreateNull(indexType);

            return(CreateSetField(instance, 0, dimension));
        }
示例#6
0
        void RoomChanged()
        {
            Dungeon dungeon = minimap.Map as Dungeon;
            Room    room    = minimap.GetRoom();

            roomSpinButton.Value = room.Index & 0xff;

            // This could go in the constructor I guess
            // TODO: Not tied to underlying event handlers, should generate this in Room.cs instead
            // (but doesn't currently matter since the data is not editable in multiple places at
            // once)
            var vrs = new ValueReference[] {
                new AbstractBoolValueReference(Project,
                                               name: "Up",
                                               getter: () => minimap.GetRoom().DungeonFlagUp,
                                               setter: (v) => minimap.GetRoom().DungeonFlagUp = v),
                new AbstractBoolValueReference(Project,
                                               name: "Right",
                                               getter: () => minimap.GetRoom().DungeonFlagRight,
                                               setter: (v) => minimap.GetRoom().DungeonFlagRight = v),
                new AbstractBoolValueReference(Project,
                                               name: "Down",
                                               getter: () => minimap.GetRoom().DungeonFlagDown,
                                               setter: (v) => minimap.GetRoom().DungeonFlagDown = v),
                new AbstractBoolValueReference(Project,
                                               name: "Left",
                                               getter: () => minimap.GetRoom().DungeonFlagLeft,
                                               setter: (v) => minimap.GetRoom().DungeonFlagLeft = v),
                new AbstractBoolValueReference(Project,
                                               name: "Key",
                                               getter: () => minimap.GetRoom().DungeonFlagKey,
                                               setter: (v) => minimap.GetRoom().DungeonFlagKey = v),
                new AbstractBoolValueReference(Project,
                                               name: "Chest",
                                               getter: () => minimap.GetRoom().DungeonFlagChest,
                                               setter: (v) => minimap.GetRoom().DungeonFlagChest = v),
                new AbstractBoolValueReference(Project,
                                               name: "Boss",
                                               getter: () => minimap.GetRoom().DungeonFlagBoss,
                                               setter: (v) => minimap.GetRoom().DungeonFlagBoss = v),
                new AbstractBoolValueReference(Project,
                                               name: "Dark",
                                               getter: () => minimap.GetRoom().DungeonFlagDark,
                                               setter: (v) => minimap.GetRoom().DungeonFlagDark = v),
            };

            var vrg = new ValueReferenceGroup(vrs);

            if (roomVre != null)
            {
                roomVre.ReplaceValueReferenceGroup(vrg);
            }
            else
            {
                roomVre = new ValueReferenceEditor(Project, vrg, 4, "Minimap Data");
                roomVreContainer.Add(roomVre);
            }
        }
示例#7
0
 /// <summary>
 /// Constructs a failed debug assertion.
 /// </summary>
 /// <param name="context">The parent IR context.</param>
 /// <param name="basicBlock">The parent basic block.</param>
 /// <param name="message">The assertion message.</param>
 internal DebugAssertFailed(
     IRContext context,
     BasicBlock basicBlock,
     ValueReference message)
     : base(
         context,
         basicBlock,
         ImmutableArray.Create(message))
 {
 }
示例#8
0
        public int CompareTo(SCIMRepresentationAttribute other)
        {
            switch (SchemaAttribute.Type)
            {
            case SCIMSchemaAttributeTypes.BINARY:
                return(ValueBinary.CompareTo(other.ValueBinary));

            case SCIMSchemaAttributeTypes.DATETIME:
                if (ValueDateTime == null)
                {
                    return(-1);
                }

                if (other.ValueDateTime == null)
                {
                    return(1);
                }

                return(ValueDateTime.Value.CompareTo(other.ValueDateTime.Value));

            case SCIMSchemaAttributeTypes.DECIMAL:
                if (ValueDecimal == null)
                {
                    return(-1);
                }

                if (other.ValueDecimal == null)
                {
                    return(1);
                }

                return(ValueDecimal.Value.CompareTo(other.ValueDecimal.Value));

            case SCIMSchemaAttributeTypes.INTEGER:
                if (ValueInteger == null)
                {
                    return(-1);
                }

                if (other.ValueInteger == null)
                {
                    return(1);
                }

                return(ValueInteger.Value.CompareTo(other.ValueInteger.Value));

            case SCIMSchemaAttributeTypes.REFERENCE:
                return(ValueReference.CompareTo(other.ValueReference));

            case SCIMSchemaAttributeTypes.STRING:
                return(ValueString.CompareTo(other.ValueString));
            }

            return(0);
        }
示例#9
0
        /// <summary>
        /// Creates a new dynamic structure instance.
        /// </summary>
        /// <param name="location">The current location.</param>
        /// <param name="item1">The first item.</param>
        /// <param name="item2">The second item.</param>
        /// <returns>The created structure instance value.</returns>
        public ValueReference CreateDynamicStructure(
            Location location,
            ValueReference item1,
            ValueReference item2)
        {
            var builder = CreateDynamicStructure(location, 2);

            builder.Add(item1);
            builder.Add(item2);
            return(builder.Seal());
        }
        public void CallingUpdateOnEngineCallsUpdateOnAllValues()
        {
            ValueReference propertyReference = engine.GetGlobalProperty("incrementingNumberValue");
            int            listenerCalled    = 0;

            propertyReference.Watch(v =>
            {
                listenerCalled++;
            });
            engine.Update(1f);
            Assert.AreEqual(2, listenerCalled);
        }
        public void MapGlobalPropertyWithDefaultReturnsDefault()
        {
            ValueReference propertyReference = engine.GetGlobalProperty("globalMap");
            var            expected          = new Dictionary <string, ValueReference>()
            {
                { "foo",
                  new ValueReferenceDefinitionBuilder().WithStartingValue("bar").Build().CreateValueReference(engine) }
            };

            Assert.AreEqual(expected,
                            propertyReference.ValueAsMap());
        }
示例#12
0
        public void SetStarted(ValueReference startInfo, int id, EvaluationContext ctx)
        {
            // This is called after the process is launched.

            // Store the process ID. It will be used by TargetProcessLauncher to get a reference to the process.
            processId = id;

            // Assign the original exe and arguments to the start info object
            startInfo.GetChild("Arguments", ctx.Options).SetRawValue(arguments, ctx.Options);
            startInfo.GetChild("FileName", ctx.Options).SetRawValue(exe, ctx.Options);

            // Signal TargetProcessLauncher that the process has started and the process ID is available.
            startedEvent.Set();
        }
示例#13
0
        /// <summary>
        /// Realizes an array creation.
        /// </summary>
        /// <param name="block">The current basic block.</param>
        /// <param name="builder">The current builder.</param>
        /// <param name="elementType">The element type.</param>
        private void MakeNewArray(
            Block block,
            IRBuilder builder,
            Type elementType)
        {
            // Resolve length and type
            var            type   = builder.CreateType(elementType);
            ValueReference length = block.PopInt(ConvertFlags.None);
            var            extent = builder.CreateArrayImplementationExtent(
                ImmutableArray.Create(length),
                0);
            var value = CreateArray(builder, extent, type);

            block.Push(value);
        }
示例#14
0
        /// <summary>
        /// Generates an XML proxy from the object.
        /// </summary>
        /// <param name="idPrefix">A prefix to be appended to the IDs of any child XML elements that
        /// require an ID. For certain XML elements, the schema requires an ID that is unique within
        /// the XML document. Instead of generating random IDs, these are systematic and hierarchical
        /// in this software. To ensure uniqueness, each ID prefix can occur only once. The ID is of
        /// type xsd:id. This derives from xsd:NCName, so not all characters are allowed.</param>
        /// <returns>Proxy.</returns>
        internal XsdNs.GetObservationTypeTemporalFilter ToXmlProxy(string idPrefix)
        {
            var proxy       = new XsdNs.GetObservationTypeTemporalFilter();
            var idPrefixAll = idPrefix + "TempF_";

            // Creating condition element
            switch (Operator)
            {
            case OperatorType.After:

                proxy.TemporalOpsTypeInfo = XsdNs.TemporalObsTypeType.After;
                proxy.TemporalOps         = CreateTimeInstantForProxy(idPrefixAll);
                break;

            case OperatorType.Before:

                proxy.TemporalOpsTypeInfo = XsdNs.TemporalObsTypeType.Before;
                proxy.TemporalOps         = CreateTimeInstantForProxy(idPrefixAll);
                break;

            case OperatorType.During:

                proxy.TemporalOpsTypeInfo = XsdNs.TemporalObsTypeType.During;
                proxy.TemporalOps         = CreateTimePeriodForProxy(idPrefixAll);
                break;

            default:
                throw new NotImplementedException("Unsupported operator " + Operator.ToString());
            }

            // Setting value reference
            switch (ValueReference)
            {
            case ValueReferenceType.PhenomenonTime:
                proxy.TemporalOps.ValueReference = ValueRefPhenoTime;
                break;

            case ValueReferenceType.ResultTime:
                proxy.TemporalOps.ValueReference = ValueRefResultTime;
                break;

            default:
                throw new NotImplementedException("Unsupported value reference " + ValueReference.ToString());
            }

            return(proxy);
        }
        /// <inheritdoc />
        public virtual object GetExamples()
        {
            var value = new ValueReference()
            {
                Id      = Guid.NewGuid(),
                Name    = "value name",
                Value   = 123,
                IsValid = true,
                AddedOn = DateTimeOffset.Now
            };
            var model = new ValueResponseModel()
            {
                Value = value
            };

            return(model);
        }
示例#16
0
        public async Task <IHttpActionResult> CreateValue([FromBody] ValueRequestModel model)
        {
            var value = new ValueReference()
            {
                Id      = model.Id,
                Name    = model.Name,
                Value   = model.Value,
                IsValid = model.IsValid,
                AddedOn = model.AddedOn
            };
            var response = new ValueResponseModel()
            {
                Value = value
            };

            return(this.Ok(response));
        }
示例#17
0
 string EvaluateExpression(CorThread thread, string exp)
 {
     try {
         if (thread.ActiveFrame == null)
         {
             return(string.Empty);
         }
         EvaluationOptions ops = Options.EvaluationOptions;
         ops.AllowTargetInvoke = true;
         CorEvaluationContext ctx = new CorEvaluationContext(this, new CorBacktrace(thread, this), 0, ops);
         ctx.Thread = thread;
         ValueReference val = ctx.Evaluator.Evaluate(ctx, exp);
         return(val.CreateObjectValue(false).Value);
     } catch (Exception ex) {
         OnDebuggerOutput(true, ex.ToString());
         return(string.Empty);
     }
 }
 string EvaluateExpression(ThreadMirror thread, string exp)
 {
     try {
         MDB.StackFrame[] frames = thread.GetFrames();
         if (frames.Length == 0)
         {
             return(string.Empty);
         }
         EvaluationOptions ops = Options.EvaluationOptions;
         ops.AllowTargetInvoke = true;
         SoftEvaluationContext ctx = new SoftEvaluationContext(this, frames[0], ops);
         ValueReference        val = ctx.Evaluator.Evaluate(ctx, exp);
         return(val.CreateObjectValue(false).Value);
     } catch (Exception ex) {
         OnDebuggerOutput(true, ex.ToString());
         return(string.Empty);
     }
 }
示例#19
0
        /// <summary>
        /// Creates a new n-dimensional array.
        /// </summary>
        /// <param name="builder">The current builder.</param>
        /// <param name="extent">The array extent.</param>
        /// <param name="elementType">The element type.</param>
        internal ValueReference CreateArray(
            IRBuilder builder,
            ValueReference extent,
            TypeNode elementType)
        {
            // We have to create an appropriate array view type
            // that uses the correct index type to access all elements
            var extentType = extent.Type as ArrayType;

            Debug.Assert(extentType != null, "Invalid extent type");
            var arraySize = builder.CreateArrayAccumulationMultiply(extent);

            // Allocate memory and create the view
            var memoryPtr = CreateTempAlloca(arraySize, elementType);
            var array     = builder.CreateNewView(memoryPtr, arraySize);

            // Create the actual array instance
            return(builder.CreateArrayImplementation(array, extent));
        }
        public ValueReference CreateValueReference(IdleEngine engine, ValueReference containingReference)
        {
            if (engine == null)
            {
                throw new ArgumentException("engine cannot be null");
            }
            if (HasChildValues) // Recursively create child references
            {
                var mapValues    = new ParentNotifyingMap(engine);
                var mapReference = new ValueReference(containingReference, mapValues, postUpdateHook);
                foreach (var entry in StartingValue as Dictionary <string, ValueReferenceDefinition> )
                {
                    mapValues[entry.Key] = entry.Value.CreateValueReference(engine, mapReference);
                }
                engine.RegisterReference(mapReference);
                return(mapReference);
            }
            var newReference = new ValueReference(containingReference, startingValue, updater, postUpdateHook);;

            engine.RegisterReference(newReference);
            return(newReference);
        }
 void EndInvoke()
 {
     try {
         if (obj is ObjectMirror)
         {
             result = ((ObjectMirror)obj).EndInvokeMethod(handle);
         }
         else if (obj is TypeMirror)
         {
             result = ((TypeMirror)obj).EndInvokeMethod(handle);
         }
         else
         {
             result = ((StructMirror)obj).EndInvokeMethod(handle);
         }
     } catch (InvocationException ex) {
         if (ex.Exception != null)
         {
             string         ename = ctx.Adapter.GetValueTypeName(ctx, ex.Exception);
             ValueReference vref  = ctx.Adapter.GetMember(ctx, null, ex.Exception, "Message");
             if (vref != null)
             {
                 exception = new Exception(ename + ": " + (string)vref.ObjectValue);
                 return;
             }
             else
             {
                 exception = new Exception(ename);
                 return;
             }
         }
         exception = ex;
     } catch (Exception ex) {
         LoggingService.LogError("Error in soft debugger method call thread on " + GetInfo(), ex);
         exception = ex;
     } finally {
         ctx.Session.StackVersion++;
     }
 }
示例#22
0
 /// <summary>
 /// Replaces the given value with the new value.
 /// </summary>
 /// <typeparam name="T">The context type.</typeparam>
 /// <param name="context">The context instance.</param>
 /// <param name="value">The current value.</param>
 /// <param name="newValue">The new value.</param>
 /// <returns>Returns the new value.</returns>
 public static Value Replace <T>(
     this T context,
     Value value,
     ValueReference newValue)
     where T : IRewriterContext =>
 context.Replace(value, newValue.Resolve());
示例#23
0
        protected internal override void InitializeBackward(bool isRecurrent, ValueReference<double> valueOfOneReference)
        {
            base.InitializeBackward(isRecurrent, valueOfOneReference);

            gradientValue = new ValueReference<double>(ValueSpace);
            gradientSumValue = new ValueReference<double>(ValueSpace);
            this.valueOfOneReference = valueOfOneReference;

            if (isRecurrent)
            {
                savedDerivates = new Stack<double>();
                derivateValue = new ValueReference<double>(ValueSpace);
            }
        }
示例#24
0
        protected override void Initialize()
        {
            base.Initialize();

            biasValue = new ValueReference<double>(ValueSpace);
        }
示例#25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NamedNumber"/> class.
 /// </summary>
 /// <param name="name">The named number's name</param>
 /// <param name="reference">A reference to the value</param>
 public NamedNumber(string name, ValueReference reference)
 {
     this.name      = name;
     this.reference = reference;
 }
示例#26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NamedNumber"/> class.
 /// </summary>
 /// <param name="reference">A reference to the represented value</param>
 public NamedNumber(ValueReference reference) : this(null, reference)
 {
 }
示例#27
0
 /// <summary>
 /// Converts a new value entry.
 /// </summary>
 /// <param name="index">The index within the block.</param>
 /// <param name="valueReference">The actual value reference.</param>
 public ValueEntry(int index, ValueReference valueReference)
 {
     Index          = index;
     ValueReference = valueReference;
 }
示例#28
0
 public static int MethodWithRefParameter(int a, ref ValueReference vc)
 {
     vc.SomeValue = a;
     return(vc.Square().SomeValue);
 }
示例#29
0
 public static int MethodWithRefOutParameters(int a, ref ValueReference vc1, out ValueReference vc2)
 {
     vc1.SomeValue = a;
     vc2           = new ValueReference(a);
     return(vc1.SomeValue + vc2.SomeValue);
 }
示例#30
0
 public static int MethodWithOutParameter(int a, out ValueReference vc)
 {
     vc = new ValueReference(a);
     return(vc.SomeValue);
 }
示例#31
0
        /// <summary>
        /// Realizes an arithmetic operation.
        /// </summary>
        /// <param name="kind">The kind of the arithmetic operation.</param>
        /// <param name="instruction">The current IL instruction.</param>
        private void MakeArithmetic(
            BinaryArithmeticKind kind,
            ILInstruction instruction)
        {
            var arithmeticFlags = ArithmeticFlags.None;
            var convertFlags    = ConvertFlags.None;

            if (instruction.HasFlags(ILInstructionFlags.Overflow))
            {
                arithmeticFlags |= ArithmeticFlags.Overflow;
            }
            if (instruction.HasFlags(ILInstructionFlags.Unsigned))
            {
                convertFlags    |= ConvertFlags.TargetUnsigned;
                arithmeticFlags |= ArithmeticFlags.Unsigned;
            }

            ValueReference result = default;

            if (Block.PopArithmeticArgs(
                    Location,
                    convertFlags,
                    out var left,
                    out var right) == Block.ArithmeticOperandKind.Pointer)
            {
                // This is a pointer access
                bool isLeftPointer = left.Type.IsPointerType;
                if (!isLeftPointer)
                {
                    Utilities.Swap(ref left, ref right);
                }

                // Check for raw combinations of two pointer values
                if (
                    !right.Type.IsPointerType &&
                    // Check whether this can be safely converted into a LEA value
                    kind == BinaryArithmeticKind.Add)
                {
                    result = Builder.CreateLoadElementAddress(
                        Location,
                        left,
                        right);
                }
                // Check whether this operation on pointer values can be converted
                // into a LEA instruction
                // FIXME: remove this code once we add additional LEA nodes
                else if (
                    kind == BinaryArithmeticKind.Add &&
                    right is BinaryArithmeticValue baseAddress &&
                    TryConvertIntoLoadElementAddress(left, baseAddress, out var lea))
                {
                    result = lea;
                }
            }

            if (!result.IsValid)
            {
                switch (kind)
                {
                case BinaryArithmeticKind.Shl:
                case BinaryArithmeticKind.Shr:
                    // Convert right operand to 32bits
                    right = CreateConversion(
                        right,
                        Builder.GetPrimitiveType(BasicValueType.Int32),
                        convertFlags);
                    break;
                }
                result = Builder.CreateArithmetic(
                    Location,
                    left,
                    right,
                    kind,
                    arithmeticFlags);
            }
            Block.Push(result);
        }
示例#32
0
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }

            ((Fhir.R4.Models.BackboneElement) this).SerializeJson(writer, options, false);

            if (!string.IsNullOrEmpty(Name))
            {
                writer.WriteString("name", (string)Name !);
            }

            if (_Name != null)
            {
                writer.WritePropertyName("_name");
                _Name.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(ValueBase64Binary))
            {
                writer.WriteString("valueBase64Binary", (string)ValueBase64Binary !);
            }

            if (_ValueBase64Binary != null)
            {
                writer.WritePropertyName("_valueBase64Binary");
                _ValueBase64Binary.SerializeJson(writer, options);
            }

            if (ValueBoolean != null)
            {
                writer.WriteBoolean("valueBoolean", (bool)ValueBoolean !);
            }

            if (!string.IsNullOrEmpty(ValueCanonical))
            {
                writer.WriteString("valueCanonical", (string)ValueCanonical !);
            }

            if (_ValueCanonical != null)
            {
                writer.WritePropertyName("_valueCanonical");
                _ValueCanonical.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(ValueCode))
            {
                writer.WriteString("valueCode", (string)ValueCode !);
            }

            if (_ValueCode != null)
            {
                writer.WritePropertyName("_valueCode");
                _ValueCode.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(ValueDate))
            {
                writer.WriteString("valueDate", (string)ValueDate !);
            }

            if (_ValueDate != null)
            {
                writer.WritePropertyName("_valueDate");
                _ValueDate.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(ValueDateTime))
            {
                writer.WriteString("valueDateTime", (string)ValueDateTime !);
            }

            if (_ValueDateTime != null)
            {
                writer.WritePropertyName("_valueDateTime");
                _ValueDateTime.SerializeJson(writer, options);
            }

            if (ValueDecimal != null)
            {
                writer.WriteNumber("valueDecimal", (decimal)ValueDecimal !);
            }

            if (_ValueDecimal != null)
            {
                writer.WritePropertyName("_valueDecimal");
                _ValueDecimal.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(ValueId))
            {
                writer.WriteString("valueId", (string)ValueId !);
            }

            if (_ValueId != null)
            {
                writer.WritePropertyName("_valueId");
                _ValueId.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(ValueInstant))
            {
                writer.WriteString("valueInstant", (string)ValueInstant !);
            }

            if (_ValueInstant != null)
            {
                writer.WritePropertyName("_valueInstant");
                _ValueInstant.SerializeJson(writer, options);
            }

            if (ValueInteger != null)
            {
                writer.WriteNumber("valueInteger", (int)ValueInteger !);
            }

            if (!string.IsNullOrEmpty(ValueMarkdown))
            {
                writer.WriteString("valueMarkdown", (string)ValueMarkdown !);
            }

            if (_ValueMarkdown != null)
            {
                writer.WritePropertyName("_valueMarkdown");
                _ValueMarkdown.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(ValueOid))
            {
                writer.WriteString("valueOid", (string)ValueOid !);
            }

            if (_ValueOid != null)
            {
                writer.WritePropertyName("_valueOid");
                _ValueOid.SerializeJson(writer, options);
            }

            if (ValuePositiveInt != null)
            {
                writer.WriteNumber("valuePositiveInt", (uint)ValuePositiveInt !);
            }

            if (!string.IsNullOrEmpty(ValueString))
            {
                writer.WriteString("valueString", (string)ValueString !);
            }

            if (_ValueString != null)
            {
                writer.WritePropertyName("_valueString");
                _ValueString.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(ValueTime))
            {
                writer.WriteString("valueTime", (string)ValueTime !);
            }

            if (_ValueTime != null)
            {
                writer.WritePropertyName("_valueTime");
                _ValueTime.SerializeJson(writer, options);
            }

            if (ValueUnsignedInt != null)
            {
                writer.WriteNumber("valueUnsignedInt", (uint)ValueUnsignedInt !);
            }

            if (!string.IsNullOrEmpty(ValueUri))
            {
                writer.WriteString("valueUri", (string)ValueUri !);
            }

            if (_ValueUri != null)
            {
                writer.WritePropertyName("_valueUri");
                _ValueUri.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(ValueUrl))
            {
                writer.WriteString("valueUrl", (string)ValueUrl !);
            }

            if (_ValueUrl != null)
            {
                writer.WritePropertyName("_valueUrl");
                _ValueUrl.SerializeJson(writer, options);
            }

            if (ValueUuid != null)
            {
                writer.WriteString("valueUuid", (Guid)ValueUuid !);
            }

            if (ValueAddress != null)
            {
                writer.WritePropertyName("valueAddress");
                ValueAddress.SerializeJson(writer, options);
            }

            if (ValueAge != null)
            {
                writer.WritePropertyName("valueAge");
                ValueAge.SerializeJson(writer, options);
            }

            if (ValueAnnotation != null)
            {
                writer.WritePropertyName("valueAnnotation");
                ValueAnnotation.SerializeJson(writer, options);
            }

            if (ValueAttachment != null)
            {
                writer.WritePropertyName("valueAttachment");
                ValueAttachment.SerializeJson(writer, options);
            }

            if (ValueCodeableConcept != null)
            {
                writer.WritePropertyName("valueCodeableConcept");
                ValueCodeableConcept.SerializeJson(writer, options);
            }

            if (ValueCoding != null)
            {
                writer.WritePropertyName("valueCoding");
                ValueCoding.SerializeJson(writer, options);
            }

            if (ValueContactPoint != null)
            {
                writer.WritePropertyName("valueContactPoint");
                ValueContactPoint.SerializeJson(writer, options);
            }

            if (ValueCount != null)
            {
                writer.WritePropertyName("valueCount");
                ValueCount.SerializeJson(writer, options);
            }

            if (ValueDistance != null)
            {
                writer.WritePropertyName("valueDistance");
                ValueDistance.SerializeJson(writer, options);
            }

            if (ValueDuration != null)
            {
                writer.WritePropertyName("valueDuration");
                ValueDuration.SerializeJson(writer, options);
            }

            if (ValueHumanName != null)
            {
                writer.WritePropertyName("valueHumanName");
                ValueHumanName.SerializeJson(writer, options);
            }

            if (ValueIdentifier != null)
            {
                writer.WritePropertyName("valueIdentifier");
                ValueIdentifier.SerializeJson(writer, options);
            }

            if (ValueMoney != null)
            {
                writer.WritePropertyName("valueMoney");
                ValueMoney.SerializeJson(writer, options);
            }

            if (ValuePeriod != null)
            {
                writer.WritePropertyName("valuePeriod");
                ValuePeriod.SerializeJson(writer, options);
            }

            if (ValueQuantity != null)
            {
                writer.WritePropertyName("valueQuantity");
                ValueQuantity.SerializeJson(writer, options);
            }

            if (ValueRange != null)
            {
                writer.WritePropertyName("valueRange");
                ValueRange.SerializeJson(writer, options);
            }

            if (ValueRatio != null)
            {
                writer.WritePropertyName("valueRatio");
                ValueRatio.SerializeJson(writer, options);
            }

            if (ValueReference != null)
            {
                writer.WritePropertyName("valueReference");
                ValueReference.SerializeJson(writer, options);
            }

            if (ValueSampledData != null)
            {
                writer.WritePropertyName("valueSampledData");
                ValueSampledData.SerializeJson(writer, options);
            }

            if (ValueSignature != null)
            {
                writer.WritePropertyName("valueSignature");
                ValueSignature.SerializeJson(writer, options);
            }

            if (ValueTiming != null)
            {
                writer.WritePropertyName("valueTiming");
                ValueTiming.SerializeJson(writer, options);
            }

            if (ValueContactDetail != null)
            {
                writer.WritePropertyName("valueContactDetail");
                ValueContactDetail.SerializeJson(writer, options);
            }

            if (ValueContributor != null)
            {
                writer.WritePropertyName("valueContributor");
                ValueContributor.SerializeJson(writer, options);
            }

            if (ValueDataRequirement != null)
            {
                writer.WritePropertyName("valueDataRequirement");
                ValueDataRequirement.SerializeJson(writer, options);
            }

            if (ValueExpression != null)
            {
                writer.WritePropertyName("valueExpression");
                ValueExpression.SerializeJson(writer, options);
            }

            if (ValueParameterDefinition != null)
            {
                writer.WritePropertyName("valueParameterDefinition");
                ValueParameterDefinition.SerializeJson(writer, options);
            }

            if (ValueRelatedArtifact != null)
            {
                writer.WritePropertyName("valueRelatedArtifact");
                ValueRelatedArtifact.SerializeJson(writer, options);
            }

            if (ValueTriggerDefinition != null)
            {
                writer.WritePropertyName("valueTriggerDefinition");
                ValueTriggerDefinition.SerializeJson(writer, options);
            }

            if (ValueUsageContext != null)
            {
                writer.WritePropertyName("valueUsageContext");
                ValueUsageContext.SerializeJson(writer, options);
            }

            if (ValueDosage != null)
            {
                writer.WritePropertyName("valueDosage");
                ValueDosage.SerializeJson(writer, options);
            }

            if (ValueMeta != null)
            {
                writer.WritePropertyName("valueMeta");
                ValueMeta.SerializeJson(writer, options);
            }

            if (Resource != null)
            {
                writer.WritePropertyName("resource");
                JsonSerializer.Serialize <Fhir.R4.Models.Resource>(writer, (Fhir.R4.Models.Resource)Resource, options);
            }

            if ((Part != null) && (Part.Count != 0))
            {
                writer.WritePropertyName("part");
                writer.WriteStartArray();

                foreach (ParametersParameter valPart in Part)
                {
                    valPart.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }