예제 #1
0
        static Offset <FSingle> serialise_single(FlatBufferBuilder b, IHasSingle numeral)
        {
            FSingle.StartFSingle(b);
            FSingle.AddValue(b, numeral.ObservationValue);

            var range_offset = FRange.CreateFRange(
                b,
                numeral.SingleSpace._Decimal_Granularity,
                numeral.SingleSpace._Max_Value,
                numeral.SingleSpace._Min_Value);

            FSingle.AddRange(b, range_offset);
            return(FSingle.EndFSingle(b));
        }
예제 #2
0
        static Offset <FMotor> serialise_motor(FlatBufferBuilder b, IMotor motor, string identifier)
        {
            var n = b.CreateString(identifier);

            FMotor.StartFMotor(b);
            FMotor.AddMotorName(b, n);
            FMotor.AddValidInput(
                b,
                FRange.CreateFRange(
                    b,
                    motor.MotionValueSpace._Decimal_Granularity,
                    motor.MotionValueSpace._Max_Value,
                    motor.MotionValueSpace._Min_Value));
            FMotor.AddEnergySpentSinceReset(b, motor.GetEnergySpend());
            return(FMotor.EndFMotor(b));
        }