diff --git a/src/DataStructures/DataCache.cs b/src/DataStructures/DataCache.cs index 851f01a..44d2bae 100644 --- a/src/DataStructures/DataCache.cs +++ b/src/DataStructures/DataCache.cs @@ -9,12 +9,12 @@ namespace Nocturnis.DataStructures; public class DataCache : CacheItem { - public new static DataCache Null => new (x => (0, GlobalProvider.DataStructureProvider!.NullDataType)); + public new static DataCache Null => new (x => (null, DataTypeConstant.BaseDataTypes.Null)); public DataCache(Func rec) : base(rec) => throw new Exception("CONSTRUCTION NOT ALLOWED"); public DataCache(Func rec) { - Value = GlobalProvider.DataStructureProvider!.NewData(0, DataTypeConstant.BaseDataTypes.Null); + Value = new DataVariable(); ProxyCalculator = rec; } diff --git a/src/DataStructures/DataTypes/DataType.cs b/src/DataStructures/DataTypes/DataType.cs index 2e622d5..8c7adf5 100644 --- a/src/DataStructures/DataTypes/DataType.cs +++ b/src/DataStructures/DataTypes/DataType.cs @@ -94,13 +94,15 @@ public class DataType } } - public static bool operator ==(DataType a, DataType b) => a.Signature == b.Signature; + public static bool operator ==(DataType a, DataType b) => a?.Signature == b?.Signature; - public static bool operator !=(DataType a, DataType b) => a.Signature != b.Signature; + public static bool operator !=(DataType a, DataType b) => a?.Signature != b?.Signature; public void Assign(DataType oth) { Type = oth.Type; + if (ElementType == null) + ElementType = new(); ElementType.Assign(oth.ElementType); StructName = oth.StructName; } diff --git a/src/Enigmos/Modules/EBaseModule.cs b/src/Enigmos/Modules/EBaseModule.cs index edffce2..02e4a2b 100644 --- a/src/Enigmos/Modules/EBaseModule.cs +++ b/src/Enigmos/Modules/EBaseModule.cs @@ -14,6 +14,6 @@ public static class EBaseModule return port; } - throw new Exception("NOT A PORT"); + throw new Exception($"NOT A PORT {typeof(TPort)}"); } } diff --git a/src/GlobalManagement/Providers/GlobalProvider.cs b/src/GlobalManagement/Providers/GlobalProvider.cs index 9a82f72..432048b 100644 --- a/src/GlobalManagement/Providers/GlobalProvider.cs +++ b/src/GlobalManagement/Providers/GlobalProvider.cs @@ -1,5 +1,4 @@ using Godot; -using Nocturnis.DataStructures.Data; using Nocturnis.DataStructures.DataTypes; using Nocturnis.Enigmos.Modules; using Nocturnis.Inventories.Items; @@ -8,23 +7,23 @@ namespace Nocturnis.GlobalManagement.Providers; public static class GlobalProvider { - public static IEnigmosProvider? EnigmosProvider { get; set; } - public static IDataStructureProvider? DataStructureProvider { get; set; } - public static IUIProvider? UIProvider { get; set; } - public static ISceneProvider? SceneProvider { get; set; } - public static IPolymorphismProvider? PolymorphismProvider { get; set; } - public static IDataTypeProvider? DataTypeProvider { get; set; } + public static IEnigmosProvider EnigmosProvider { get; set; } + public static IDataStructureProvider DataStructureProvider { get; set; } + public static IUIProvider UIProvider { get; set; } + public static ISceneProvider SceneProvider { get; set; } + public static IPolymorphismProvider PolymorphismProvider { get; set; } + public static IDataTypeProvider DataTypeProvider { get; set; } public static class ModulePreviewMapper where TModule : IBaseModule { - public static Texture2D? Preview { get; set; } + public static Texture2D Preview { get; set; } } public static class ItemIconMapper where TItem : IBaseItem { - public static Texture2D? Texture { get; set; } + public static Texture2D Texture { get; set; } } public static class AssetMapper @@ -34,16 +33,7 @@ public static class GlobalProvider public static readonly Dictionary SceneNameMapper = new(); - public static Font? Font { get; set; } + 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; } - } + public static readonly Dictionary DataTypeTexture = new(); } diff --git a/src/GlobalManagement/Providers/IDataStructureProvider.cs b/src/GlobalManagement/Providers/IDataStructureProvider.cs index e4d0c48..f7273a0 100644 --- a/src/GlobalManagement/Providers/IDataStructureProvider.cs +++ b/src/GlobalManagement/Providers/IDataStructureProvider.cs @@ -1,7 +1,5 @@ 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; @@ -13,7 +11,6 @@ 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); @@ -23,11 +20,6 @@ public interface IDataStructureProvider IDataOutGroup NewDataOutGroup(IBaseModule m, IDataOutPort[] pts, string desc, DataType defType, DataTypeOption typeOpts); - DataVariable NewData(object data, DataType type); - IDoubleParameter NewDoubleParameter(string name, double min, double max, double def); IKeyParameter NewKeyParameter(string a, string b); - DataVariable NullData { get; } - DataVariable DefaultData { get; } - StringName ArrayToElement(StringName arrayType); -} \ No newline at end of file +} diff --git a/src/GlobalManagement/Providers/IDataTypeProvider.cs b/src/GlobalManagement/Providers/IDataTypeProvider.cs index ebfc664..93f0de4 100644 --- a/src/GlobalManagement/Providers/IDataTypeProvider.cs +++ b/src/GlobalManagement/Providers/IDataTypeProvider.cs @@ -1,4 +1,3 @@ -using Godot; using Nocturnis.DataStructures.DataTypes; namespace Nocturnis.GlobalManagement.Providers; diff --git a/src/GlobalManagement/Providers/IPolymorphismProvider.cs b/src/GlobalManagement/Providers/IPolymorphismProvider.cs index 7dab3a1..017d479 100644 --- a/src/GlobalManagement/Providers/IPolymorphismProvider.cs +++ b/src/GlobalManagement/Providers/IPolymorphismProvider.cs @@ -1,5 +1,3 @@ -using Godot; -using Nocturnis.DataStructures; using Nocturnis.DataStructures.Data; using Nocturnis.DataStructures.DataTypes;