Data Type
This commit is contained in:
33
src/GlobalManagement/Constants/DataTypeConstant.cs
Normal file
33
src/GlobalManagement/Constants/DataTypeConstant.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Godot;
|
||||
using Nocturnis.DataStructures.DataTypeOptions;
|
||||
using Nocturnis.DataStructures.DataTypes;
|
||||
using Nocturnis.GlobalManagement.Providers;
|
||||
|
||||
namespace Nocturnis.GlobalManagement.Constants;
|
||||
|
||||
public static partial class DataTypeConstant
|
||||
{
|
||||
public static class NestedDataTypeNames
|
||||
{
|
||||
public static readonly StringName Array = "Array";
|
||||
public static readonly StringName Struct = "Struct";
|
||||
public static readonly StringName Auto = "Auto";
|
||||
}
|
||||
|
||||
public static class AutoDataTypes
|
||||
{
|
||||
public static readonly DataType Auto = DataType.AutoDataType();
|
||||
public static readonly DataType AutoArray = DataType.AutoArrayType();
|
||||
public static readonly DataType AutoStruct = DataType.AutoStructType();
|
||||
}
|
||||
|
||||
public static partial class DataTypeOptions
|
||||
{
|
||||
public static readonly DataTypeOption ScalarTypes = new(BaseDataTypes.Real, BaseDataTypes.Complex);
|
||||
public static readonly DataTypeOption VectorTypes = new(BaseDataTypes.R2, BaseDataTypes.C2);
|
||||
public static readonly DataTypeOption TensorTypes = ScalarTypes.Union(VectorTypes);
|
||||
public static readonly DataTypeOption AnyType = new();
|
||||
public static readonly DataTypeOption AnyArray = new(DataType.ArrayDataType(BaseDataTypes.Null));
|
||||
public static readonly DataTypeOption AnyStruct = new(DataType.StructDataType(null));
|
||||
}
|
||||
}
|
||||
@@ -4,23 +4,7 @@ namespace Nocturnis.GlobalManagement.Constants;
|
||||
|
||||
public static class EnigmosConstant
|
||||
{
|
||||
public static class DataPortTypes
|
||||
{
|
||||
public static readonly StringName Null = "Null";
|
||||
public static readonly StringName Bit = "Bit";
|
||||
public static readonly StringName Real = "Real";
|
||||
public static readonly StringName Complex = "Complex";
|
||||
public static readonly StringName R2 = "R2";
|
||||
public static readonly StringName C2 = "C2";
|
||||
public static readonly StringName RealArray = "RealArray";
|
||||
public static readonly StringName AnyArrayType = "AnyArrayType";
|
||||
public static readonly StringName[] NumericTypes = new[] { Real, Complex };
|
||||
public static readonly StringName[] AnyTensor = new[] { Real, Complex, R2, C2 };
|
||||
public static readonly StringName[] AnyType = new[] { Real, Complex, R2, C2 };
|
||||
public static readonly StringName[] VectorTypes = new[] { R2, C2 };
|
||||
public static readonly StringName[] AnyArray = Array.Empty<StringName>();
|
||||
|
||||
}
|
||||
|
||||
public static class CommunicationDirections
|
||||
{
|
||||
public static readonly StringName Send = "Send";
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Godot;
|
||||
using Nocturnis.DataStructures.Data;
|
||||
using Nocturnis.DataStructures.DataTypes;
|
||||
using Nocturnis.Enigmos.Modules;
|
||||
using Nocturnis.Inventories.Items;
|
||||
|
||||
@@ -33,4 +35,15 @@ public static class GlobalProvider
|
||||
public static readonly Dictionary<string, PackedScene> SceneNameMapper = new();
|
||||
|
||||
public static Font? Font { get; set; }
|
||||
|
||||
public static class DataTypes
|
||||
{
|
||||
public static DataType Null { get; set; }
|
||||
public static DataType Bit { get; set; }
|
||||
public static DataType Real { get; set; }
|
||||
public static DataType Complex { get; set; }
|
||||
public static DataType R2 { get; set; }
|
||||
public static DataType C2 { get; set; }
|
||||
public static DataType Int { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
using Godot;
|
||||
using Nocturnis.DataStructures;
|
||||
using Nocturnis.DataStructures.ConfigurableParameters;
|
||||
using Nocturnis.DataStructures.Data;
|
||||
using Nocturnis.DataStructures.DataPortGroups;
|
||||
using Nocturnis.DataStructures.DataTypeOptions;
|
||||
using Nocturnis.DataStructures.DataTypes;
|
||||
using Nocturnis.Enigmos.Modules;
|
||||
using Nocturnis.Enigmos.Ports.DataPorts;
|
||||
using Nocturnis.Enigmos.Ports.DataPorts.Directions;
|
||||
@@ -10,20 +13,21 @@ namespace Nocturnis.GlobalManagement.Providers;
|
||||
|
||||
public interface IDataStructureProvider
|
||||
{
|
||||
DataType NullDataType { get; }
|
||||
Variant NewVariantWithType(string type, Variant a);
|
||||
IBoolParameter NewBoolParameter(string d, string t, string f, bool def);
|
||||
|
||||
IDataPortGroup NewDataPortGroup(IBaseModule m, IDataPort[] pts, string desc, StringName defType, StringName[] typeOpts);
|
||||
IDataPortGroup NewDataPortGroup(IBaseModule m, IDataPort[] pts, string desc, DataType defType, DataTypeOption typeOpts);
|
||||
|
||||
IDataInGroup NewDataInGroup(IBaseModule m, IDataInPort[] pts, string desc, StringName defType, StringName[] typeOpts);
|
||||
IDataInGroup NewDataInGroup(IBaseModule m, IDataInPort[] pts, string desc, DataType defType, DataTypeOption typeOpts);
|
||||
|
||||
IDataOutGroup NewDataOutGroup(IBaseModule m, IDataOutPort[] pts, string desc, StringName defType, StringName[] typeOpts);
|
||||
IDataOutGroup NewDataOutGroup(IBaseModule m, IDataOutPort[] pts, string desc, DataType defType, DataTypeOption typeOpts);
|
||||
|
||||
IData NewData(object data, StringName type);
|
||||
DataVariable NewData(object data, DataType type);
|
||||
|
||||
IDoubleParameter NewDoubleParameter(string name, double min, double max, double def);
|
||||
IKeyParameter NewKeyParameter(string a, string b);
|
||||
IData NullData { get; }
|
||||
IData DefaultData { get; }
|
||||
DataVariable NullData { get; }
|
||||
DataVariable DefaultData { get; }
|
||||
StringName ArrayToElement(StringName arrayType);
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
using Godot;
|
||||
using Nocturnis.DataStructures.DataTypes;
|
||||
|
||||
namespace Nocturnis.GlobalManagement.Providers;
|
||||
|
||||
public interface IDataTypeProvider
|
||||
{
|
||||
bool IsComplexTensorType(StringName type);
|
||||
StringName ComplexVersionOf(StringName type);
|
||||
StringName BuildType(StringName nType, int i, int j);
|
||||
StringName GetBaseField(StringName type);
|
||||
bool DataPortTypeCompatible(StringName inType, StringName outType);
|
||||
StringName ToElement(StringName arrayType);
|
||||
bool IsComplexTensorType(DataType type);
|
||||
DataType ComplexVersionOf(DataType type);
|
||||
DataType BuildType(DataType nType, int i, int j);
|
||||
DataType GetBaseField(DataType type);
|
||||
bool DataPortTypeCompatible(DataType inType, DataType outType);
|
||||
DataType ToElement(DataType arrayType);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Godot;
|
||||
using Nocturnis.DataStructures.DataTypes;
|
||||
|
||||
namespace Nocturnis.GlobalManagement.Providers;
|
||||
|
||||
@@ -14,7 +15,7 @@ public interface IEnigmosProvider
|
||||
|
||||
PackedScene SignalCableScene { get; set; }
|
||||
PackedScene DataCableScene { get; set; }
|
||||
Dictionary<StringName, Texture2D> DataPortTypeMap { get; set; }
|
||||
Dictionary<DataType, Texture2D> DataPortTypeMap { get; set; }
|
||||
|
||||
bool CommunicationDirectionCompatible(StringName moduleDir, StringName communicatorDir);
|
||||
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
using Godot;
|
||||
using Nocturnis.DataStructures;
|
||||
using Nocturnis.DataStructures.Data;
|
||||
using Nocturnis.DataStructures.DataTypes;
|
||||
|
||||
namespace Nocturnis.GlobalManagement.Providers;
|
||||
|
||||
public interface IPolymorphismProvider
|
||||
{
|
||||
(object, StringName) Square(IData a);
|
||||
(object, StringName) Neg(IData a);
|
||||
(object, StringName) Add(IData a, IData b);
|
||||
(object, StringName) Sub(IData a, IData b);
|
||||
(object, StringName) Div(IData a, IData b);
|
||||
(object, StringName) Dot(IData a, IData b);
|
||||
(object, StringName) Mul(IData a, IData b);
|
||||
(object, StringName) Pow(IData a, IData b);
|
||||
(object, StringName) ScalarDiv(IData a, IData b);
|
||||
(object, StringName) ScalarMul(IData a, IData b);
|
||||
(object, DataType) Square(DataVariable a);
|
||||
(object, DataType) Neg(DataVariable a);
|
||||
(object, DataType) Add(DataVariable a, DataVariable b);
|
||||
(object, DataType) Sub(DataVariable a, DataVariable b);
|
||||
(object, DataType) Div(DataVariable a, DataVariable b);
|
||||
(object, DataType) Dot(DataVariable a, DataVariable b);
|
||||
(object, DataType) Mul(DataVariable a, DataVariable b);
|
||||
(object, DataType) Pow(DataVariable a, DataVariable b);
|
||||
(object, DataType) ScalarDiv(DataVariable a, DataVariable b);
|
||||
(object, DataType) ScalarMul(DataVariable a, DataVariable b);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user