Пример #1
0
 public static FOBS GetRootAsFOBS(ByteBuffer _bb, FOBS obj)
 {
     return(obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb));
 }
Пример #2
0
        static Offset <FOBS> serialise_observer(FlatBufferBuilder b, IObserver observer)
        {
            var n = b.CreateString(observer.Identifier);

            int          observation_offset;
            FObservation observation_type;

            if (observer is IHasArray)
            {
                observation_offset = serialise_array(b, (IHasArray)observer).Value;
                observation_type   = FObservation.FArray;
            }
            else if (observer is IHasSingle)
            {
                observation_offset = serialise_single(b, (IHasSingle)observer).Value;
                observation_type   = FObservation.FSingle;
            }
            else if (observer is IHasDouble)
            {
                observation_offset = serialise_double(b, (IHasDouble)observer).Value;
                observation_type   = FObservation.FDouble;
            }
            else if (observer is IHasTriple)
            {
                observation_offset = serialise_triple(b, (IHasTriple)observer).Value;
                observation_type   = FObservation.FTriple;
            }
            else if (observer is IHasQuadruple)
            {
                observation_offset = serialise_quadruple(b, (IHasQuadruple)observer).Value;
                observation_type   = FObservation.FQuadruple;
            }
            else if (observer is IHasEulerTransform)
            {
                observation_offset = serialise_euler_transform(b, (IHasEulerTransform)observer).Value;
                observation_type   = FObservation.FET;
            }
            else if (observer is IHasQuaternionTransform)
            {
                observation_offset = serialise_quaternion_transform(b, (IHasQuaternionTransform)observer).Value;
                observation_type   = FObservation.FQT;
            }
            else if (observer is IHasRigidbody)
            {
                observation_offset = serialise_body_observation(
                    b,
                    ((IHasRigidbody)observer).Velocity,
                    ((IHasRigidbody)observer).AngularVelocity).Value;
                observation_type = FObservation.FRB;
            }
            else if (observer is IHasByteArray)
            {
                observation_offset = serialise_byte_array(b, (IHasByteArray)observer).Value;
                observation_type   = FObservation.FByteArray;
            }
            else
            {
                return(FOBS.CreateFOBS(b, n));
            }

            FOBS.StartFOBS(b);
            FOBS.AddObservationName(b, n);
            FOBS.AddObservationType(b, observation_type);
            FOBS.AddObservation(b, observation_offset);
            return(FOBS.EndFOBS(b));
        }
Пример #3
0
 public FOBS?ObservationsByKey(string key)
 {
     int o = this.__p.__offset(16); return(o != 0 ? FOBS.__lookup_by_key(this.__p.__vector(o), key, this.__p.bb) : null);
 }