private void SetOutputData(IMLBaseDataType newOutputData) { if (OutputData == null) { switch (newOutputData.DataType) { case IMLSpecifications.DataTypes.Float: OutputData = new IMLFloat(newOutputData); break; case IMLSpecifications.DataTypes.Integer: OutputData = new IMLInteger(newOutputData); break; case IMLSpecifications.DataTypes.Vector2: OutputData = new IMLVector2(newOutputData); break; case IMLSpecifications.DataTypes.Vector3: OutputData = new IMLVector3(newOutputData); break; case IMLSpecifications.DataTypes.Vector4: OutputData = new IMLVector4(newOutputData); break; default: break; } } // Make sure we are instantiating a new copy, not a reference OutputData.Values = new float[newOutputData.Values.Length]; Array.Copy(newOutputData.Values, OutputData.Values, newOutputData.Values.Length); }
/// <summary> /// Instantiates an abstract IML base data into a specific one /// </summary> /// <param name="dataToInstantiate"></param> /// <param name="dataToReadFrom"></param> /// <param name="IMLType"></param> public static void InstantiateIMLData(ref IMLBaseDataType dataToInstantiate, IMLSpecifications.DataTypes IMLType) { switch (IMLType) { case IMLSpecifications.DataTypes.Float: dataToInstantiate = new IMLFloat(); break; case IMLSpecifications.DataTypes.Integer: dataToInstantiate = new IMLInteger(); break; case IMLSpecifications.DataTypes.Vector2: dataToInstantiate = new IMLVector2(); break; case IMLSpecifications.DataTypes.Vector3: dataToInstantiate = new IMLVector3(); break; case IMLSpecifications.DataTypes.Vector4: dataToInstantiate = new IMLVector4(); break; case IMLSpecifications.DataTypes.SerialVector: dataToInstantiate = new IMLSerialVector(); break; default: break; } }
public IMLSerialVector(IMLBaseDataType newData) { m_DataType = IMLSpecifications.DataTypes.SerialVector; if (newData.Values != null && newData.Values.Length > 0) { SetValues(newData.Values); } }
private void SetInputData(IMLBaseDataType newInputData) { if (InputData == null) { IMLDataSerialization.InstantiateIMLData(ref InputData, newInputData); } // Make sure we are instantiating a new copy, not a reference InputData.Values = new float[newInputData.Values.Length]; Array.Copy(newInputData.Values, InputData.Values, newInputData.Values.Length); }
public void AddOutputExample(IMLBaseDataType outputExample) { // Check that list is initialised if (m_Outputs == null) { m_Outputs = new List <IMLOutput>(); } // Add entry to list with the example passed in var newOutputExample = new IMLOutput(outputExample); m_Outputs.Add(newOutputExample); }
public IMLFloat(IMLBaseDataType newData) { if (m_Values == null) { m_Values = new float[1]; } m_DataType = IMLSpecifications.DataTypes.Float; if (newData.Values != null && newData.Values.Length > 0) { SetValue(newData.Values[0]); } }
public IMLVector3(IMLBaseDataType newData) { if (m_Values == null) { m_Values = new float[3]; } m_DataType = IMLSpecifications.DataTypes.Vector3; if (newData.Values != null && newData.Values.Length > 0) { SetValues(newData.Values); } }
/// <summary> /// Instantiates an abstract IML base data into a specific one /// </summary> /// <param name="dataToInstantiate"></param> /// <param name="dataToReadFrom"></param> /// <param name="IMLType"></param> public static void InstantiateIMLData(ref IMLBaseDataType dataToInstantiate, IMLBaseDataType dataToReadFrom) { if (dataToReadFrom == null) { Debug.LogError("Can't instantiate a null IML data type!"); return; } switch (dataToReadFrom.DataType) { case IMLSpecifications.DataTypes.Float: dataToInstantiate = new IMLFloat(dataToReadFrom); break; case IMLSpecifications.DataTypes.Integer: dataToInstantiate = new IMLInteger(dataToReadFrom); break; case IMLSpecifications.DataTypes.Vector2: dataToInstantiate = new IMLVector2(dataToReadFrom); break; case IMLSpecifications.DataTypes.Vector3: dataToInstantiate = new IMLVector3(dataToReadFrom); break; case IMLSpecifications.DataTypes.Vector4: dataToInstantiate = new IMLVector4(dataToReadFrom); break; case IMLSpecifications.DataTypes.SerialVector: dataToInstantiate = new IMLSerialVector(dataToReadFrom); break; default: break; } }
public IMLOutput(IMLBaseDataType newOutputData) { SetOutputData(newOutputData); }
public IMLInput(IMLBaseDataType newInputData) { SetInputData(newInputData); }