diff --git a/GitVersion.yml b/GitVersion.yml index 3cf5581a9..ac035488f 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,5 +1,5 @@ mode: ContinuousDeployment -next-version: 0.20.1 +next-version: 0.21.0 branches: main: regex: ^master$|^main$ diff --git a/src/AXSharp.compiler/src/AXSharp.Compiler/AXSharpProject.cs b/src/AXSharp.compiler/src/AXSharp.Compiler/AXSharpProject.cs index 9d78e3e75..426aefb39 100644 --- a/src/AXSharp.compiler/src/AXSharp.Compiler/AXSharpProject.cs +++ b/src/AXSharp.compiler/src/AXSharp.Compiler/AXSharpProject.cs @@ -138,6 +138,46 @@ public void Generate() } } + foreach (var sourceBuilderType in BuilderTypes) + { + var builder = Activator.CreateInstance(sourceBuilderType, this, compilationResult.Compilation); + var treeWalker = builder as ICombinedThreeVisitor; + var sourceBuilder = builder as ISourceBuilder; + + + if (treeWalker == null) + throw new FailedToCreateCombineThreeVisitorException( + $"Could not create {sourceBuilderType.Name} as ICombinedThreeVisitor"); + if (sourceBuilder == null) + throw new FailedToCreateSourceBuilderException( + $"Could not create {sourceBuilderType.Name} as ISourceBuilder"); + + var visitor = new IxNodeVisitor(compilationResult.Compilation); + + try + { + treeWalker.CreateMergedConfigurations(visitor, compilationResult.Compilation); + + Policy + .Handle() + .WaitAndRetry(5, a => TimeSpan.FromMilliseconds(500)) + .Execute(() => + { + using (var swr = new StreamWriter(Path.Combine( + EnsureFolder(Path.Combine(OutputFolder, ".g")), + "Configurations.g.cs"))) + { + swr.Write(sourceBuilder.Output); + } + }); + } + catch (NotImplementedException) + { + + // swallow if not implemented + } + } + //TargetProject.ProvisionProjectStructure(); GenerateMetadata(compilationResult.Compilation); TargetProject.GenerateResources(); diff --git a/src/AXSharp.compiler/src/AXSharp.Compiler/Core/ICombinedThreeVisitor.cs b/src/AXSharp.compiler/src/AXSharp.Compiler/Core/ICombinedThreeVisitor.cs index 83bb48e4c..c11ca904d 100644 --- a/src/AXSharp.compiler/src/AXSharp.Compiler/Core/ICombinedThreeVisitor.cs +++ b/src/AXSharp.compiler/src/AXSharp.Compiler/Core/ICombinedThreeVisitor.cs @@ -20,7 +20,12 @@ namespace AXSharp.Compiler.Core; /// public interface ICombinedThreeVisitor { - + public virtual void CreateMergedConfigurations(IxNodeVisitor visitor, Compilation compilation) + { + throw new NotImplementedException(); + } + + /// /// Creates file declaration from node of given syntax tree. /// diff --git a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerConfigurationConstructorBuilder.cs b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerConfigurationConstructorBuilder.cs index e1592e995..030260b5f 100644 --- a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerConfigurationConstructorBuilder.cs +++ b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerConfigurationConstructorBuilder.cs @@ -45,6 +45,37 @@ protected CsOnlinerConfigurationConstructorBuilder(ISourceBuilder sourceBuilder) return builder; } + public new static CsOnlinerConfigurationConstructorBuilder Create(IxNodeVisitor visitor, + IReadOnlyCollection semantics, AXSharpProject project, ISourceBuilder sourceBuilder) + { + var builder = new CsOnlinerConfigurationConstructorBuilder(sourceBuilder); + builder.AddToSource( + $"public {project.TargetProject.ProjectRootNamespace}TwinController({typeof(ConnectorAdapter).n()} adapter, object[] parameters) {{"); + builder.AddToSource("this.Connector = adapter.GetConnector(parameters);"); + + + foreach (var conf in semantics) + { + conf.Variables.ToList().ForEach(p => p.Accept(visitor, builder)); + } + + + builder.AddToSource("}"); + + builder.AddToSource( + $"public {project.TargetProject.ProjectRootNamespace}TwinController({typeof(ConnectorAdapter).n()} adapter) {{"); + builder.AddToSource("this.Connector = adapter.GetConnector(adapter.Parameters);"); + + foreach (var conf in semantics) + { + conf.Variables.ToList().ForEach(p => p.Accept(visitor, builder)); + } + + builder.AddToSource("}"); + + return builder; + } + public override void CreateVariableDeclaration(IVariableDeclaration semantics, IxNodeVisitor visitor) { if (semantics.IsMemberEligibleForConstructor(SourceBuilder)) diff --git a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerConstructorBuilder.cs b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerConstructorBuilder.cs index 3a2c3dc0b..776a26227 100644 --- a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerConstructorBuilder.cs +++ b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerConstructorBuilder.cs @@ -106,12 +106,37 @@ public virtual void CreateNamedValueTypeDeclaration(INamedValueTypeDeclaration n public virtual void CreateVariableDeclaration(IVariableDeclaration semantics, IxNodeVisitor visitor) { + if (semantics.IsMemberEligibleForConstructor(SourceBuilder)) { - AddToSource($"{semantics.Name}"); - semantics.Type.Accept(visitor, this); - AddToSource($"(this, \"\", \"{semantics.Name}\");"); - } + switch (semantics.Type) + { + case IArrayTypeDeclaration array: + AddArrayMemberInitialization(array, semantics, visitor); + break; + case IEnumTypeDeclaration @enum: + AddMemberInitialization(@enum, semantics); + break; + case INamedValueTypeDeclaration namedValue: + AddMemberInitialization(namedValue, semantics, visitor); + break; + case IScalarTypeDeclaration scalar: + AddMemberInitialization(scalar, semantics); + break; + case IStringTypeDeclaration @string: + AddMemberInitialization(@string, semantics); + break; + case IClassDeclaration @class: + AddMemberInitialization(@class, semantics, visitor); + break; + case IStructuredTypeDeclaration @struct: + AddMemberInitialization(@struct, semantics, visitor); + break; + } + + AddToSource(semantics.SetProperties()); + AddToSource(semantics.AddAnnotations(this.SourceBuilder)); + } } public void CreateEnumTypeDeclaration(IEnumTypeDeclaration enumTypeDeclaration, IxNodeVisitor visitor) @@ -214,6 +239,36 @@ public static CsOnlinerConstructorBuilder Create(IxNodeVisitor visitor, IStructu return builder; } + public static CsOnlinerConstructorBuilder Create(IxNodeVisitor visitor, IConfigurationDeclaration semantics, + ISourceBuilder sourceBuilder) + { + var builder = new CsOnlinerConstructorBuilder(sourceBuilder); + + + builder.AddToSource( + $"public {semantics.Name}({typeof(ITwinObject).n()} parent, string readableTail, string symbolTail)"); + + + builder.AddToSource("{"); + builder.AddToSource(@$"this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = {typeof(Connector.Connector).n()}.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = {typeof(Connector.Connector).n()}.CreateSymbol(parent.Symbol, symbolTail);"); + + builder.AddToSource(@$"PreConstruct(parent, readableTail, symbolTail);"); + + semantics.Variables.ToList().ForEach(p => p.Accept(visitor, builder)); + builder.AddToSource("parent.AddChild(this);"); + builder.AddToSource("parent.AddKid(this);"); + + builder.AddToSource(@$"PostConstruct(parent, readableTail, symbolTail);"); + + builder.AddToSource("}"); + + return builder; + } + public static CsOnlinerConstructorBuilder Create(IxNodeVisitor visitor, IConfigurationDeclaration semantics, AXSharpProject project, ISourceBuilder sourceBuilder) { @@ -227,7 +282,7 @@ public static CsOnlinerConstructorBuilder Create(IxNodeVisitor visitor, IConfigu return builder; } - private void AddArrayMemberInitialization(IArrayTypeDeclaration type, IFieldDeclaration field, + private void AddArrayMemberInitialization(IArrayTypeDeclaration type, IStorageDeclaration field, IxNodeVisitor visitor) { if(!type.IsMemberEligibleForConstructor(this.SourceBuilder)) @@ -277,7 +332,7 @@ private void AddArrayMemberInitialization(IArrayTypeDeclaration type, IFieldDecl } - private void AddMemberInitialization(IClassDeclaration type, IFieldDeclaration field, IxNodeVisitor visitor) + private void AddMemberInitialization(IClassDeclaration type, IStorageDeclaration field, IxNodeVisitor visitor) { AddToSource($"{field.Name}"); AddToSource("= new"); @@ -285,7 +340,7 @@ private void AddMemberInitialization(IClassDeclaration type, IFieldDeclaration f AddToSource($"(this, \"{field.GetAttributeNameValue(field.Name)}\", \"{field.Name}\");"); } - private void AddMemberInitialization(IStructuredTypeDeclaration type, IFieldDeclaration field, IxNodeVisitor visitor) + private void AddMemberInitialization(IStructuredTypeDeclaration type, IStorageDeclaration field, IxNodeVisitor visitor) { AddToSource($"{field.Name}"); AddToSource("= new"); @@ -293,14 +348,14 @@ private void AddMemberInitialization(IStructuredTypeDeclaration type, IFieldDecl AddToSource($"(this, \"{field.GetAttributeNameValue(field.Name)}\", \"{field.Name}\");"); } - private void AddMemberInitialization(IScalarTypeDeclaration type, IFieldDeclaration field) + private void AddMemberInitialization(IScalarTypeDeclaration type, IStorageDeclaration field) { AddToSource($"{field.Name}"); AddToSource($"= @Connector.ConnectorAdapter.AdapterFactory.Create{IecToAdapterExtensions.ToAdapterType(type)}"); AddToSource($"(this, \"{field.GetAttributeNameValue(field.Name)}\", \"{field.Name}\");"); } - private void AddMemberInitialization(IStringTypeDeclaration type, IFieldDeclaration field) + private void AddMemberInitialization(IStringTypeDeclaration type, IStorageDeclaration field) { AddToSource($"{field.Name}"); AddToSource($"= @Connector.ConnectorAdapter.AdapterFactory.Create{IecToAdapterExtensions.ToAdapterType(type)}"); @@ -308,7 +363,7 @@ private void AddMemberInitialization(IStringTypeDeclaration type, IFieldDeclarat } // We get warning here about unused method, it is false positive, but we will need to investigate further the object hierarchy. - private void AddMemberInitialization(IEnumTypeDeclaration enumType, IFieldDeclaration field) + private void AddMemberInitialization(IEnumTypeDeclaration enumType, IStorageDeclaration field) { AddToSource($"{field.Name}"); AddToSource("= @Connector.ConnectorAdapter.AdapterFactory.CreateINT"); @@ -316,7 +371,7 @@ private void AddMemberInitialization(IEnumTypeDeclaration enumType, IFieldDeclar AddToSource(field.SetProperties()); } - private void AddMemberInitialization(INamedValueTypeDeclaration namedValueType, IFieldDeclaration field, + private void AddMemberInitialization(INamedValueTypeDeclaration namedValueType, IStorageDeclaration field, IxNodeVisitor visitor) { AddToSource($"{field.Name}"); diff --git a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerMemberBuilder.cs b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerMemberBuilder.cs index 46a9f85da..6d5439c57 100644 --- a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerMemberBuilder.cs +++ b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerMemberBuilder.cs @@ -203,6 +203,23 @@ public static CsOnlinerMemberBuilder Create(IxNodeVisitor visitor, IStructuredTy return builder; } + public static CsOnlinerMemberBuilder Create(IxNodeVisitor visitor, IReadOnlyCollection semantics, + ISourceBuilder sourceBuilder) + { + var builder = new CsOnlinerMemberBuilder(sourceBuilder); + + foreach (var structuredTypeDeclaration in semantics) + { + builder.AddToSource(structuredTypeDeclaration.DeclareProperties()); + structuredTypeDeclaration.Variables.ToList().ForEach(p => p.Accept(visitor, builder)); + } + + builder.AddToSource(@$"partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail);"); + + return builder; + } + public static CsOnlinerMemberBuilder Create(IxNodeVisitor visitor, IClassDeclaration semantics, ISourceBuilder sourceBuilder) { diff --git a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerSourceBuilder.cs b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerSourceBuilder.cs index f16590e28..7c6ec0a4f 100644 --- a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerSourceBuilder.cs +++ b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerSourceBuilder.cs @@ -15,6 +15,7 @@ using AXSharp.Compiler.Core; using AXSharp.Compiler.Cs.Helpers; using AXSharp.Compiler.Cs.Helpers.Plain; +using AXSharp.Compiler.Cs.Pragmas.PragmaParser; using AXSharp.Connector; namespace AXSharp.Compiler.Cs.Onliner; @@ -39,6 +40,31 @@ public CsOnlinerSourceBuilder(AXSharpProject project, CompilerOptions = project.CompilerOptions; } + public void CreateMergedConfigurations(IxNodeVisitor visitor, Compilation compilation) + { + var configurations = compilation.GetActiveConfigurations(); + if(configurations.Count == 0) + return; + + AddToSource("using System;"); + AddToSource("using AXSharp.Connector;"); + AddToSource("using AXSharp.Connector.ValueTypes;"); + AddToSource("using System.Collections.Generic;"); + AddToSource("using AXSharp.Connector.Localizations;"); + AddToSource("using AXSharp.Abstractions.Presentation;"); + + TypeCommAccessibility = configurations.First().GetCommAccessibility(this); + + AddToSource( + $"public partial class {Project.TargetProject.ProjectRootNamespace}TwinController : ITwinController {{"); + AddToSource($"public {typeof(Connector.Connector).n()} Connector {{ get; }}"); + + AddToSource(CsOnlinerMemberBuilder.Create(visitor, configurations, this).Output); + AddToSource(CsOnlinerConfigurationConstructorBuilder.Create(visitor, configurations, Project, this).Output); + AddToSource("}"); + + } + /// public Compilation Compilation { get; } @@ -188,26 +214,67 @@ public void CreateConfigDeclaration(IConfigDeclarationSyntax configDeclarationSy IConfigurationDeclaration configurationDeclaration, IxNodeVisitor visitor) { - TypeCommAccessibility = eCommAccessibility.None; - - AddToSource( - $"public partial class {Project.TargetProject.ProjectRootNamespace}TwinController : ITwinController {{"); - AddToSource($"public {typeof(Connector.Connector).n()} Connector {{ get; }}"); - AddToSource(CsOnlinerMemberBuilder.Create(visitor, configurationDeclaration, this).Output); - AddToSource(CsOnlinerConfigurationConstructorBuilder - .Create(visitor, configurationDeclaration, Project, this).Output); - AddToSource("}"); + /// In order to align with stc v7 where multiple configurations are allowed that are merged at + /// compile time, we need to create a merged configuration class that contains all the configurations. + /// We merge the configuration in CreateMergedConfigurations the entry is called outside visitor in + /// Generate method of the AXSharpProject. + + return; + CreateConfigDeclaration(configurationDeclaration, visitor); + + //TypeCommAccessibility = eCommAccessibility.None; + + //AddToSource( + // $"public partial class {Project.TargetProject.ProjectRootNamespace}TwinController : ITwinController {{"); + //AddToSource($"public {typeof(Connector.Connector).n()} Connector {{ get; }}"); + //AddToSource(CsOnlinerMemberBuilder.Create(visitor, configurationDeclaration, this).Output); + //AddToSource(CsOnlinerConfigurationConstructorBuilder + // .Create(visitor, configurationDeclaration, Project, this).Output); + //AddToSource("}"); } /// public void CreateConfigDeclaration(IConfigurationDeclaration configurationDeclaration, IxNodeVisitor visitor) { - TypeCommAccessibility = eCommAccessibility.None; + // see CreateConfigDeclaration overload comments + return; + TypeCommAccessibility = configurationDeclaration.GetCommAccessibility(this); + + AddToSource(configurationDeclaration.Pragmas.AddAttributes()); + AddToSource( + $"public partial class {configurationDeclaration.Name}"); + AddToSource(":"); + + AddToSource(typeof(ITwinObject).n()!); + + AddToSource("\n{"); + + AddToSource(CsOnlinerMemberBuilder.Create(visitor, configurationDeclaration, this).Output); + + AddToSource(CsOnlinerConstructorBuilder.Create(visitor, configurationDeclaration, this).Output); + + //AddToSource(CsOnlinerPlainerOnlineToPlainBuilder.Create(visitor, structuredTypeDeclaration, this).Output); + //AddToSource(CsOnlinerPlainerOnlineToPlainProtectedBuilder.Create(visitor, structuredTypeDeclaration, this).Output); + //AddToSource(CsOnlinerPlainerPlainToOnlineBuilder.Create(visitor, structuredTypeDeclaration, this).Output); + + //AddToSource(CsOnlinerPlainerShadowToPlainBuilder.Create(visitor, structuredTypeDeclaration, this).Output); + //AddToSource(CsOnlinerPlainerShadowToPlainProtectedBuilder.Create(visitor, structuredTypeDeclaration, this).Output); + //AddToSource(CsOnlinerPlainerPlainToShadowBuilder.Create(visitor, structuredTypeDeclaration, this).Output); + + //AddToSource(CsOnlinerHasChangedBuilder.Create(visitor, structuredTypeDeclaration, this).Output); + //AddPollingMethod(false); + + //AddCreatePocoMethod(structuredTypeDeclaration, false); + + CreateITwinObjectImplementation(); - AddToSource($"public partial class {Project.TargetProject.ProjectRootNamespace} : ITwinController {{"); - AddToSource(@$"public {typeof(Connector.Connector).n()} Connector {{ get; }}"); - AddToSource(CsOnlinerConstructorBuilder.Create(visitor, configurationDeclaration, Project, this).Output); AddToSource("}"); + //TypeCommAccessibility = eCommAccessibility.None; + + //AddToSource($"public partial class {Project.TargetProject.ProjectRootNamespace} : ITwinController {{"); + //AddToSource(@$"public {typeof(Connector.Connector).n()} Connector {{ get; }}"); + //AddToSource(CsOnlinerConstructorBuilder.Create(visitor, configurationDeclaration, Project, this).Output); + //AddToSource("}"); } /// diff --git a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Plain/CsPlainSourceBuilder.cs b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Plain/CsPlainSourceBuilder.cs index e6943165b..9e356689e 100644 --- a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Plain/CsPlainSourceBuilder.cs +++ b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Plain/CsPlainSourceBuilder.cs @@ -208,6 +208,12 @@ public void CreateConfigDeclaration(IConfigDeclarationSyntax configDeclarationSy IConfigurationDeclaration configurationDeclaration, IxNodeVisitor visitor) { + /// In order to align with stc v7 where multiple configurations are allowed that are merged at + /// compile time, we need to create a merged configuration class that contains all the configurations. + /// We merge the configuration in CreateMergedConfigurations the entry is called outside visitor in + /// Generate method of the AXSharpProject. + + return; TypeCommAccessibility = eCommAccessibility.None; AddToSource($"public partial class {Project.TargetProject.ProjectRootNamespace}TwinController{{"); @@ -258,6 +264,11 @@ public void CreateInterfaceDeclaration(IInterfaceDeclarationSyntax interfaceDecl /// public void CreateConfigDeclaration(IConfigurationDeclaration configurationDeclaration, IxNodeVisitor visitor) { + /// In order to align with stc v7 where multiple configurations are allowed that are merged at + /// compile time, we need to create a merged configuration class that contains all the configurations. + /// We merge the configuration in CreateMergedConfigurations the entry is called outside visitor in + /// Generate method of the AXSharpProject. + return; AddToSource($"public partial class {Project.TargetProject.ProjectRootNamespace}{{"); configurationDeclaration.Variables.ToList().ForEach(p => p.Accept(visitor, this)); AddToSource("}"); diff --git a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Pragmas/PragmaExtensions.cs b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Pragmas/PragmaExtensions.cs index fdfe2c79c..cd89a9fa7 100644 --- a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Pragmas/PragmaExtensions.cs +++ b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Pragmas/PragmaExtensions.cs @@ -93,7 +93,7 @@ public static string DeclareProperties(this IConfigurationDeclaration configDecl /// /// Field declaration /// Statement setting property to given value. - public static string SetProperties(this IFieldDeclaration fieldDeclaration) + public static string SetProperties(this IStorageDeclaration fieldDeclaration) { return string.Join("\r\n", fieldDeclaration.Pragmas.Where(p => p.Content.StartsWith(PRAGMA_PROPERTY_SET_SIGNATURE)).Select(p => Pragmas.PragmaParser.PragmaCompiler.Compile(p, fieldDeclaration).Product)); diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/AXSharp.Compiler.CsTests.csproj b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/AXSharp.Compiler.CsTests.csproj index dffc132c9..4f6cbef36 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/AXSharp.Compiler.CsTests.csproj +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/AXSharp.Compiler.CsTests.csproj @@ -61,6 +61,12 @@ + + + PreserveNewest + + + PreserveNewest diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Configurations.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Configurations.g.cs new file mode 100644 index 000000000..17dc6c6f5 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Configurations.g.cs @@ -0,0 +1,181 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class unitsTwinController : ITwinController +{ + public AXSharp.Connector.Connector Connector { get; } + public ComplexForConfig Complex { get; } + public OnlinerBool myBOOL { get; } + public OnlinerByte myBYTE { get; } + public OnlinerWord myWORD { get; } + public OnlinerDWord myDWORD { get; } + public OnlinerLWord myLWORD { get; } + public OnlinerSInt mySINT { get; } + public OnlinerInt myINT { get; } + public OnlinerDInt myDINT { get; } + public OnlinerLInt myLINT { get; } + public OnlinerUSInt myUSINT { get; } + public OnlinerUInt myUINT { get; } + public OnlinerUDInt myUDINT { get; } + public OnlinerULInt myULINT { get; } + public OnlinerReal myREAL { get; } + public OnlinerLReal myLREAL { get; } + public OnlinerTime myTIME { get; } + public OnlinerLTime myLTIME { get; } + public OnlinerDate myDATE { get; } + public OnlinerDate myLDATE { get; } + public OnlinerTimeOfDay myTIME_OF_DAY { get; } + public OnlinerLTimeOfDay myLTIME_OF_DAY { get; } + public OnlinerDateTime myDATE_AND_TIME { get; } + public OnlinerLDateTime myLDATE_AND_TIME { get; } + public OnlinerChar myCHAR { get; } + public OnlinerWChar myWCHAR { get; } + public OnlinerString mySTRING { get; } + public OnlinerWString myWSTRING { get; } + + [ReadOnce()] + public OnlinerWString myWSTRING_readOnce { get; } + + [ReadOnly()] + public OnlinerWString myWSTRING_readOnly { get; } + + [ReadOnce()] + public ComplexForConfig cReadOnce { get; } + + [ReadOnly()] + public ComplexForConfig cReadOnly { get; } + + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Colorss))] + public OnlinerInt Colorss { get; } + + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Colorsss))] + public OnlinerULInt Colorsss { get; } + + [CompilerOmitsAttribute("POCO")] + public OnlinerBool _must_be_omitted_in_poco { get; } + + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Colorss))] + public OnlinerInt Colorss2 { get; } + + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Colorsss))] + public OnlinerULInt Colorsss2 { get; } + public OnlinerBool MotorOn { get; } + public OnlinerInt MotorState { get; } + public Motor Motor1 { get; } + public Motor Motor2 { get; } + public struct1 s1 { get; } + public struct4 s4 { get; } + public SpecificMotorA mot1 { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public unitsTwinController(AXSharp.Connector.ConnectorAdapter adapter, object[] parameters) + { + this.Connector = adapter.GetConnector(parameters); + Complex = new ComplexForConfig(this.Connector, "", "Complex"); + myBOOL = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "myBOOL"); + myBYTE = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this.Connector, "", "myBYTE"); + myWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this.Connector, "", "myWORD"); + myDWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateDWORD(this.Connector, "", "myDWORD"); + myLWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateLWORD(this.Connector, "", "myLWORD"); + mySINT = @Connector.ConnectorAdapter.AdapterFactory.CreateSINT(this.Connector, "", "mySINT"); + myINT = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "myINT"); + myDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateDINT(this.Connector, "", "myDINT"); + myLINT = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this.Connector, "", "myLINT"); + myUSINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUSINT(this.Connector, "", "myUSINT"); + myUINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUINT(this.Connector, "", "myUINT"); + myUDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUDINT(this.Connector, "", "myUDINT"); + myULINT = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this.Connector, "", "myULINT"); + myREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateREAL(this.Connector, "", "myREAL"); + myLREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateLREAL(this.Connector, "", "myLREAL"); + myTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME(this.Connector, "", "myTIME"); + myLTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME(this.Connector, "", "myLTIME"); + myDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE(this.Connector, "", "myDATE"); + myLDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE(this.Connector, "", "myLDATE"); + myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this.Connector, "", "myTIME_OF_DAY"); + myLTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME_OF_DAY(this.Connector, "", "myLTIME_OF_DAY"); + myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this.Connector, "", "myDATE_AND_TIME"); + myLDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE_AND_TIME(this.Connector, "", "myLDATE_AND_TIME"); + myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this.Connector, "", "myCHAR"); + myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this.Connector, "", "myWCHAR"); + mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this.Connector, "", "mySTRING"); + myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING"); + myWSTRING_readOnce = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING_readOnce"); + myWSTRING_readOnce.MakeReadOnce(); + myWSTRING_readOnly = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING_readOnly"); + myWSTRING_readOnly.MakeReadOnly(); + cReadOnce = new ComplexForConfig(this.Connector, "", "cReadOnce"); + cReadOnce.MakeReadOnce(); + cReadOnly = new ComplexForConfig(this.Connector, "", "cReadOnly"); + cReadOnly.MakeReadOnly(); + Colorss = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "Colorss"); + Colorsss = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Colorsss", "Colorsss"); + _must_be_omitted_in_poco = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "_must_be_omitted_in_poco"); + Colorss2 = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "Colorss2"); + Colorsss2 = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Colorsss2", "Colorsss2"); + MotorOn = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "MotorOn"); + MotorState = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "MotorState"); + Motor1 = new Motor(this.Connector, "", "Motor1"); + Motor2 = new Motor(this.Connector, "", "Motor2"); + s1 = new struct1(this.Connector, "", "s1"); + s4 = new struct4(this.Connector, "", "s4"); + mot1 = new SpecificMotorA(this.Connector, "", "mot1"); + } + + public unitsTwinController(AXSharp.Connector.ConnectorAdapter adapter) + { + this.Connector = adapter.GetConnector(adapter.Parameters); + Complex = new ComplexForConfig(this.Connector, "", "Complex"); + myBOOL = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "myBOOL"); + myBYTE = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this.Connector, "", "myBYTE"); + myWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this.Connector, "", "myWORD"); + myDWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateDWORD(this.Connector, "", "myDWORD"); + myLWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateLWORD(this.Connector, "", "myLWORD"); + mySINT = @Connector.ConnectorAdapter.AdapterFactory.CreateSINT(this.Connector, "", "mySINT"); + myINT = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "myINT"); + myDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateDINT(this.Connector, "", "myDINT"); + myLINT = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this.Connector, "", "myLINT"); + myUSINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUSINT(this.Connector, "", "myUSINT"); + myUINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUINT(this.Connector, "", "myUINT"); + myUDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUDINT(this.Connector, "", "myUDINT"); + myULINT = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this.Connector, "", "myULINT"); + myREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateREAL(this.Connector, "", "myREAL"); + myLREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateLREAL(this.Connector, "", "myLREAL"); + myTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME(this.Connector, "", "myTIME"); + myLTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME(this.Connector, "", "myLTIME"); + myDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE(this.Connector, "", "myDATE"); + myLDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE(this.Connector, "", "myLDATE"); + myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this.Connector, "", "myTIME_OF_DAY"); + myLTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME_OF_DAY(this.Connector, "", "myLTIME_OF_DAY"); + myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this.Connector, "", "myDATE_AND_TIME"); + myLDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE_AND_TIME(this.Connector, "", "myLDATE_AND_TIME"); + myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this.Connector, "", "myCHAR"); + myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this.Connector, "", "myWCHAR"); + mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this.Connector, "", "mySTRING"); + myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING"); + myWSTRING_readOnce = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING_readOnce"); + myWSTRING_readOnce.MakeReadOnce(); + myWSTRING_readOnly = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING_readOnly"); + myWSTRING_readOnly.MakeReadOnly(); + cReadOnce = new ComplexForConfig(this.Connector, "", "cReadOnce"); + cReadOnce.MakeReadOnce(); + cReadOnly = new ComplexForConfig(this.Connector, "", "cReadOnly"); + cReadOnly.MakeReadOnly(); + Colorss = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "Colorss"); + Colorsss = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Colorsss", "Colorsss"); + _must_be_omitted_in_poco = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "_must_be_omitted_in_poco"); + Colorss2 = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "Colorss2"); + Colorsss2 = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Colorsss2", "Colorsss2"); + MotorOn = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "MotorOn"); + MotorState = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "MotorState"); + Motor1 = new Motor(this.Connector, "", "Motor1"); + Motor2 = new Motor(this.Connector, "", "Motor2"); + s1 = new struct1(this.Connector, "", "s1"); + s4 = new struct4(this.Connector, "", "s4"); + mot1 = new SpecificMotorA(this.Connector, "", "mot1"); + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/configuration.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/configuration.g.cs index 026a0b2ed..49aedcf27 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/configuration.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/configuration.g.cs @@ -5,148 +5,6 @@ using AXSharp.Connector.Localizations; using AXSharp.Abstractions.Presentation; -public partial class unitsTwinController : ITwinController -{ - public AXSharp.Connector.Connector Connector { get; } - public ComplexForConfig Complex { get; } - public OnlinerBool myBOOL { get; } - public OnlinerByte myBYTE { get; } - public OnlinerWord myWORD { get; } - public OnlinerDWord myDWORD { get; } - public OnlinerLWord myLWORD { get; } - public OnlinerSInt mySINT { get; } - public OnlinerInt myINT { get; } - public OnlinerDInt myDINT { get; } - public OnlinerLInt myLINT { get; } - public OnlinerUSInt myUSINT { get; } - public OnlinerUInt myUINT { get; } - public OnlinerUDInt myUDINT { get; } - public OnlinerULInt myULINT { get; } - public OnlinerReal myREAL { get; } - public OnlinerLReal myLREAL { get; } - public OnlinerTime myTIME { get; } - public OnlinerLTime myLTIME { get; } - public OnlinerDate myDATE { get; } - public OnlinerDate myLDATE { get; } - public OnlinerTimeOfDay myTIME_OF_DAY { get; } - public OnlinerLTimeOfDay myLTIME_OF_DAY { get; } - public OnlinerDateTime myDATE_AND_TIME { get; } - public OnlinerLDateTime myLDATE_AND_TIME { get; } - public OnlinerChar myCHAR { get; } - public OnlinerWChar myWCHAR { get; } - public OnlinerString mySTRING { get; } - public OnlinerWString myWSTRING { get; } - - [ReadOnce()] - public OnlinerWString myWSTRING_readOnce { get; } - - [ReadOnly()] - public OnlinerWString myWSTRING_readOnly { get; } - - [ReadOnce()] - public ComplexForConfig cReadOnce { get; } - - [ReadOnly()] - public ComplexForConfig cReadOnly { get; } - - [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Colorss))] - public OnlinerInt Colorss { get; } - - [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Colorsss))] - public OnlinerULInt Colorsss { get; } - - [CompilerOmitsAttribute("POCO")] - public OnlinerBool _must_be_omitted_in_poco { get; } - - public unitsTwinController(AXSharp.Connector.ConnectorAdapter adapter, object[] parameters) - { - this.Connector = adapter.GetConnector(parameters); - Complex = new ComplexForConfig(this.Connector, "", "Complex"); - myBOOL = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "myBOOL"); - myBYTE = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this.Connector, "", "myBYTE"); - myWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this.Connector, "", "myWORD"); - myDWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateDWORD(this.Connector, "", "myDWORD"); - myLWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateLWORD(this.Connector, "", "myLWORD"); - mySINT = @Connector.ConnectorAdapter.AdapterFactory.CreateSINT(this.Connector, "", "mySINT"); - myINT = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "myINT"); - myDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateDINT(this.Connector, "", "myDINT"); - myLINT = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this.Connector, "", "myLINT"); - myUSINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUSINT(this.Connector, "", "myUSINT"); - myUINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUINT(this.Connector, "", "myUINT"); - myUDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUDINT(this.Connector, "", "myUDINT"); - myULINT = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this.Connector, "", "myULINT"); - myREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateREAL(this.Connector, "", "myREAL"); - myLREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateLREAL(this.Connector, "", "myLREAL"); - myTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME(this.Connector, "", "myTIME"); - myLTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME(this.Connector, "", "myLTIME"); - myDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE(this.Connector, "", "myDATE"); - myLDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE(this.Connector, "", "myLDATE"); - myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this.Connector, "", "myTIME_OF_DAY"); - myLTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME_OF_DAY(this.Connector, "", "myLTIME_OF_DAY"); - myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this.Connector, "", "myDATE_AND_TIME"); - myLDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE_AND_TIME(this.Connector, "", "myLDATE_AND_TIME"); - myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this.Connector, "", "myCHAR"); - myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this.Connector, "", "myWCHAR"); - mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this.Connector, "", "mySTRING"); - myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING"); - myWSTRING_readOnce = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING_readOnce"); - myWSTRING_readOnce.MakeReadOnce(); - myWSTRING_readOnly = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING_readOnly"); - myWSTRING_readOnly.MakeReadOnly(); - cReadOnce = new ComplexForConfig(this.Connector, "", "cReadOnce"); - cReadOnce.MakeReadOnce(); - cReadOnly = new ComplexForConfig(this.Connector, "", "cReadOnly"); - cReadOnly.MakeReadOnly(); - Colorss = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "Colorss"); - Colorsss = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Colorsss", "Colorsss"); - _must_be_omitted_in_poco = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "_must_be_omitted_in_poco"); - } - - public unitsTwinController(AXSharp.Connector.ConnectorAdapter adapter) - { - this.Connector = adapter.GetConnector(adapter.Parameters); - Complex = new ComplexForConfig(this.Connector, "", "Complex"); - myBOOL = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "myBOOL"); - myBYTE = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this.Connector, "", "myBYTE"); - myWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this.Connector, "", "myWORD"); - myDWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateDWORD(this.Connector, "", "myDWORD"); - myLWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateLWORD(this.Connector, "", "myLWORD"); - mySINT = @Connector.ConnectorAdapter.AdapterFactory.CreateSINT(this.Connector, "", "mySINT"); - myINT = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "myINT"); - myDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateDINT(this.Connector, "", "myDINT"); - myLINT = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this.Connector, "", "myLINT"); - myUSINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUSINT(this.Connector, "", "myUSINT"); - myUINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUINT(this.Connector, "", "myUINT"); - myUDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUDINT(this.Connector, "", "myUDINT"); - myULINT = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this.Connector, "", "myULINT"); - myREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateREAL(this.Connector, "", "myREAL"); - myLREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateLREAL(this.Connector, "", "myLREAL"); - myTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME(this.Connector, "", "myTIME"); - myLTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME(this.Connector, "", "myLTIME"); - myDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE(this.Connector, "", "myDATE"); - myLDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE(this.Connector, "", "myLDATE"); - myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this.Connector, "", "myTIME_OF_DAY"); - myLTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME_OF_DAY(this.Connector, "", "myLTIME_OF_DAY"); - myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this.Connector, "", "myDATE_AND_TIME"); - myLDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE_AND_TIME(this.Connector, "", "myLDATE_AND_TIME"); - myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this.Connector, "", "myCHAR"); - myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this.Connector, "", "myWCHAR"); - mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this.Connector, "", "mySTRING"); - myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING"); - myWSTRING_readOnce = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING_readOnce"); - myWSTRING_readOnce.MakeReadOnce(); - myWSTRING_readOnly = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING_readOnly"); - myWSTRING_readOnly.MakeReadOnly(); - cReadOnce = new ComplexForConfig(this.Connector, "", "cReadOnce"); - cReadOnce.MakeReadOnce(); - cReadOnly = new ComplexForConfig(this.Connector, "", "cReadOnly"); - cReadOnly.MakeReadOnly(); - Colorss = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "Colorss"); - Colorsss = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Colorsss", "Colorsss"); - _must_be_omitted_in_poco = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "_must_be_omitted_in_poco"); - } -} - public partial class ComplexForConfig : AXSharp.Connector.ITwinObject { public OnlinerBool myBOOL { get; } diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/mixed_access.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/mixed_access.g.cs index 8646778ce..ef4c5f539 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/mixed_access.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/mixed_access.g.cs @@ -5,42 +5,6 @@ using AXSharp.Connector.Localizations; using AXSharp.Abstractions.Presentation; -public partial class unitsTwinController : ITwinController -{ - public AXSharp.Connector.Connector Connector { get; } - public OnlinerBool MotorOn { get; } - public OnlinerInt MotorState { get; } - public Motor Motor1 { get; } - public Motor Motor2 { get; } - public struct1 s1 { get; } - public struct4 s4 { get; } - public SpecificMotorA mot1 { get; } - - public unitsTwinController(AXSharp.Connector.ConnectorAdapter adapter, object[] parameters) - { - this.Connector = adapter.GetConnector(parameters); - MotorOn = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "MotorOn"); - MotorState = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "MotorState"); - Motor1 = new Motor(this.Connector, "", "Motor1"); - Motor2 = new Motor(this.Connector, "", "Motor2"); - s1 = new struct1(this.Connector, "", "s1"); - s4 = new struct4(this.Connector, "", "s4"); - mot1 = new SpecificMotorA(this.Connector, "", "mot1"); - } - - public unitsTwinController(AXSharp.Connector.ConnectorAdapter adapter) - { - this.Connector = adapter.GetConnector(adapter.Parameters); - MotorOn = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "MotorOn"); - MotorState = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "MotorState"); - Motor1 = new Motor(this.Connector, "", "Motor1"); - Motor2 = new Motor(this.Connector, "", "Motor2"); - s1 = new struct1(this.Connector, "", "s1"); - s4 = new struct4(this.Connector, "", "s4"); - mot1 = new SpecificMotorA(this.Connector, "", "mot1"); - } -} - public partial class Motor : AXSharp.Connector.ITwinObject { public OnlinerBool Run { get; } diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/configuration.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/configuration.g.cs index d0d444b30..c73387375 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/configuration.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/configuration.g.cs @@ -4,45 +4,6 @@ namespace Pocos { - public partial class unitsTwinController - { - public ComplexForConfig Complex { get; set; } = new ComplexForConfig(); - public Boolean myBOOL { get; set; } - public Byte myBYTE { get; set; } - public UInt16 myWORD { get; set; } - public UInt32 myDWORD { get; set; } - public UInt64 myLWORD { get; set; } - public SByte mySINT { get; set; } - public Int16 myINT { get; set; } - public Int32 myDINT { get; set; } - public Int64 myLINT { get; set; } - public Byte myUSINT { get; set; } - public UInt16 myUINT { get; set; } - public UInt32 myUDINT { get; set; } - public UInt64 myULINT { get; set; } - public Single myREAL { get; set; } - public Double myLREAL { get; set; } - public TimeSpan myTIME { get; set; } = default(TimeSpan); - public TimeSpan myLTIME { get; set; } = default(TimeSpan); - public DateOnly myDATE { get; set; } = default(DateOnly); - public DateOnly myLDATE { get; set; } = default(DateOnly); - public TimeSpan myTIME_OF_DAY { get; set; } = default(TimeSpan); - public TimeSpan myLTIME_OF_DAY { get; set; } = default(TimeSpan); - public DateTime myDATE_AND_TIME { get; set; } = default(DateTime); - public DateTime myLDATE_AND_TIME { get; set; } = default(DateTime); - public Char myCHAR { get; set; } - public Char myWCHAR { get; set; } - public string mySTRING { get; set; } = string.Empty; - public string myWSTRING { get; set; } = string.Empty; - public string myWSTRING_readOnce { get; set; } = string.Empty; - public string myWSTRING_readOnly { get; set; } = string.Empty; - public ComplexForConfig cReadOnce { get; set; } = new ComplexForConfig(); - public ComplexForConfig cReadOnly { get; set; } = new ComplexForConfig(); - public global::Colorss Colorss { get; set; } - public UInt64 Colorsss { get; set; } - public Boolean _must_be_omitted_in_onliner { get; set; } - } - public partial class ComplexForConfig : AXSharp.Connector.IPlain { public ComplexForConfig() diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/mixed_access.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/mixed_access.g.cs index ac9344f50..a7383fdf4 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/mixed_access.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/mixed_access.g.cs @@ -4,17 +4,6 @@ namespace Pocos { - public partial class unitsTwinController - { - public Boolean MotorOn { get; set; } - public Int16 MotorState { get; set; } - public Motor Motor1 { get; set; } = new Motor(); - public Motor Motor2 { get; set; } = new Motor(); - public struct1 s1 { get; set; } = new struct1(); - public struct4 s4 { get; set; } = new struct4(); - public SpecificMotorA mot1 { get; set; } = new SpecificMotorA(); - } - public partial class Motor : AXSharp.Connector.IPlain { public Motor() diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/units.csproj b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/units.csproj index 528978710..370fc45e7 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/units.csproj +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/units.csproj @@ -6,8 +6,8 @@ - - + + diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/configuration.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/configuration.st index 373219112..0da7b58a2 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/configuration.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/configuration.st @@ -88,6 +88,16 @@ CONFIGURATION MyConfiguration _must_be_omitted_in_poco : BOOL; END_VAR END_CONFIGURATION + +CONFIGURATION MyConfiguration2 + VAR_GLOBAL + {S7.extern=ReadWrite} + Colorss2 : Colorss; + {S7.extern=ReadWrite} + Colorsss2 : Colorsss; + END_VAR +END_CONFIGURATION + {S7.extern=ReadWrite} CLASS PUBLIC ComplexForConfig VAR PUBLIC diff --git a/src/AXSharp.compiler/tests/AXSharp.ixc.Tests/CliProgramTest.cs b/src/AXSharp.compiler/tests/AXSharp.ixc.Tests/CliProgramTest.cs index 94f6c0636..6ef003b97 100644 --- a/src/AXSharp.compiler/tests/AXSharp.ixc.Tests/CliProgramTest.cs +++ b/src/AXSharp.compiler/tests/AXSharp.ixc.Tests/CliProgramTest.cs @@ -46,7 +46,7 @@ public void should_run_with_default_settings() ixc.Program.Main(new string[0]); Assert.True(Directory.Exists(outputDirectory)); - Assert.Equal(6, Directory.EnumerateFiles(outputDirectory, "*.*", SearchOption.AllDirectories).Count()); + Assert.Equal(7, Directory.EnumerateFiles(outputDirectory, "*.*", SearchOption.AllDirectories).Count()); } catch { @@ -79,7 +79,7 @@ public void should_run_with_setting_retrieved_from_config_file_settings() Assert.True(Directory.Exists(outputDirectory)); - Assert.Equal(8, Directory.EnumerateFiles(outputDirectory, "*.*", SearchOption.AllDirectories).Count()); + Assert.Equal(9, Directory.EnumerateFiles(outputDirectory, "*.*", SearchOption.AllDirectories).Count()); } catch { @@ -98,12 +98,7 @@ public void should_run_with_setting_retrieved_from_config_file_settings_but_over var axProjectFolder = Path.Combine(TestFolder, "samples","plt","lib"); var config = AXSharpConfig.UpdateAndGetAXSharpConfig(axProjectFolder); var outputDirectory = Path.GetFullPath(Path.Combine(axProjectFolder, $"..{Path.DirectorySeparatorChar}ix-lib-override")); - - if (Directory.Exists(outputDirectory)) - { - Directory.Delete(outputDirectory, true); - } - + var recoverDirectory = Environment.CurrentDirectory; Environment.CurrentDirectory = axProjectFolder; @@ -113,7 +108,7 @@ public void should_run_with_setting_retrieved_from_config_file_settings_but_over Assert.True(Directory.Exists(outputDirectory)); - Assert.Equal(6, Directory.EnumerateFiles(outputDirectory, "*.*", SearchOption.AllDirectories).Count()); + Assert.Equal(7, Directory.EnumerateFiles(outputDirectory, "*.*", SearchOption.AllDirectories).Count()); } catch { diff --git a/src/AXSharp.compiler/tests/AXSharp.ixc.Tests/Usings.cs b/src/AXSharp.compiler/tests/AXSharp.ixc.Tests/Usings.cs index 5ed131957..843e11c6c 100644 --- a/src/AXSharp.compiler/tests/AXSharp.ixc.Tests/Usings.cs +++ b/src/AXSharp.compiler/tests/AXSharp.ixc.Tests/Usings.cs @@ -5,4 +5,4 @@ // https://github.com/ix-ax/axsharp/blob/dev/LICENSE // Third party licenses: https://github.com/ix-ax/axsharp/blob/master/notices.md -global using Xunit; \ No newline at end of file +global using Xunit; diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Configurations.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Configurations.g.cs new file mode 100644 index 000000000..2087ba973 --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Configurations.g.cs @@ -0,0 +1,29 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class appTwinController : ITwinController +{ + public AXSharp.Connector.Connector Connector { get; } + public lib1.MyClass lib1_MyClass { get; } + public lib2.MyClass lib2_MyClass { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public appTwinController(AXSharp.Connector.ConnectorAdapter adapter, object[] parameters) + { + this.Connector = adapter.GetConnector(parameters); + lib1_MyClass = new lib1.MyClass(this.Connector, "", "lib1_MyClass"); + lib2_MyClass = new lib2.MyClass(this.Connector, "", "lib2_MyClass"); + } + + public appTwinController(AXSharp.Connector.ConnectorAdapter adapter) + { + this.Connector = adapter.GetConnector(adapter.Parameters); + lib1_MyClass = new lib1.MyClass(this.Connector, "", "lib1_MyClass"); + lib2_MyClass = new lib2.MyClass(this.Connector, "", "lib2_MyClass"); + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/configuration.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/configuration.g.cs index 47f02510e..6c546f63c 100644 --- a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/configuration.g.cs +++ b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/configuration.g.cs @@ -3,25 +3,4 @@ using AXSharp.Connector.ValueTypes; using System.Collections.Generic; using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class appTwinController : ITwinController -{ - public AXSharp.Connector.Connector Connector { get; } - public lib1.MyClass lib1_MyClass { get; } - public lib2.MyClass lib2_MyClass { get; } - - public appTwinController(AXSharp.Connector.ConnectorAdapter adapter, object[] parameters) - { - this.Connector = adapter.GetConnector(parameters); - lib1_MyClass = new lib1.MyClass(this.Connector, "", "lib1_MyClass"); - lib2_MyClass = new lib2.MyClass(this.Connector, "", "lib2_MyClass"); - } - - public appTwinController(AXSharp.Connector.ConnectorAdapter adapter) - { - this.Connector = adapter.GetConnector(adapter.Parameters); - lib1_MyClass = new lib1.MyClass(this.Connector, "", "lib1_MyClass"); - lib2_MyClass = new lib2.MyClass(this.Connector, "", "lib2_MyClass"); - } -} \ No newline at end of file +using AXSharp.Abstractions.Presentation; \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/configuration.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/configuration.g.cs index 842fa3b13..e23d372b9 100644 --- a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/configuration.g.cs +++ b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/configuration.g.cs @@ -4,9 +4,4 @@ namespace Pocos { - public partial class appTwinController - { - public lib1.MyClass lib1_MyClass { get; set; } = new lib1.MyClass(); - public lib2.MyClass lib2_MyClass { get; set; } = new lib2.MyClass(); - } } \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.meta/meta.json b/src/AXSharp.compiler/tests/integration/expected/app/ix/.meta/meta.json new file mode 100644 index 000000000..752bccfed --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/app/ix/.meta/meta.json @@ -0,0 +1 @@ +["NAMESPACE lib1\n\n{S7.extern=ReadWrite}\nCLASS MyClass \nEND_CLASS\nEND_NAMESPACE","NAMESPACE lib2\n\n{S7.extern=ReadWrite}\nCLASS MyClass \nEND_CLASS\nEND_NAMESPACE"] \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.meta/sourceinfo.json b/src/AXSharp.compiler/tests/integration/expected/app/ix/.meta/sourceinfo.json new file mode 100644 index 000000000..424fcce0a --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/app/ix/.meta/sourceinfo.json @@ -0,0 +1 @@ +{"ax-source":"../app"} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/Configurations.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/Configurations.g.cs new file mode 100644 index 000000000..e69de29bb diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/Onliners/library.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/Onliners/library.g.cs new file mode 100644 index 000000000..0c38c998e --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/Onliners/library.g.cs @@ -0,0 +1,236 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace lib1 +{ + public partial class MyClass : AXSharp.Connector.ITwinObject + { + public OnlinerString MyString { get; } + public OnlinerInt MyInt { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public MyClass(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + MyString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "MyString", "MyString"); + MyInt = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "MyInt", "MyInt"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain() + { + return await (dynamic)this.OnlineToPlainAsync(); + } + + public async Task OnlineToPlainAsync() + { + global::Pocos.lib1.MyClass plain = new global::Pocos.lib1.MyClass(); + await this.ReadAsync(); + plain.MyString = MyString.LastValue; + plain.MyInt = MyInt.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.lib1.MyClass plain = new global::Pocos.lib1.MyClass(); + plain.MyString = MyString.LastValue; + plain.MyInt = MyInt.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.lib1.MyClass plain) + { + plain.MyString = MyString.LastValue; + plain.MyInt = MyInt.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain) + { + await this.PlainToOnlineAsync((dynamic)plain); + } + + public async Task> PlainToOnlineAsync(global::Pocos.lib1.MyClass plain) + { +#pragma warning disable CS0612 + MyString.LethargicWrite(plain.MyString); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + MyInt.LethargicWrite(plain.MyInt); +#pragma warning restore CS0612 + return await this.WriteAsync(); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.lib1.MyClass plain) + { +#pragma warning disable CS0612 + MyString.LethargicWrite(plain.MyString); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + MyInt.LethargicWrite(plain.MyInt); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.lib1.MyClass plain = new global::Pocos.lib1.MyClass(); + plain.MyString = MyString.Shadow; + plain.MyInt = MyInt.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.lib1.MyClass plain) + { + plain.MyString = MyString.Shadow; + plain.MyInt = MyInt.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.lib1.MyClass plain) + { + MyString.Shadow = plain.MyString; + MyInt.Shadow = plain.MyInt; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.lib1.MyClass plain, global::Pocos.lib1.MyClass latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.MyString != MyString.LastValue) + somethingChanged = true; + if (plain.MyInt != MyInt.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.lib1.MyClass CreateEmptyPoco() + { + return new global::Pocos.lib1.MyClass(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::lib1.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/POCO/library.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/POCO/library.g.cs new file mode 100644 index 000000000..38abe0b03 --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/POCO/library.g.cs @@ -0,0 +1,19 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace lib1 + { + public partial class MyClass : AXSharp.Connector.IPlain + { + public MyClass() + { + } + + public string MyString { get; set; } = string.Empty; + public Int16 MyInt { get; set; } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/PlcResources.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/PlcResources.g.cs new file mode 100644 index 000000000..e09a12075 --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/PlcResources.g.cs @@ -0,0 +1,26 @@ + +using System.Reflection; +using AXSharp.Connector.Localizations; + +namespace lib1 +{ + public sealed class PlcTranslator : Translator + { + private static readonly PlcTranslator instance = new PlcTranslator(); + + public static PlcTranslator Instance + { + get + { + return instance; + } + } + + private PlcTranslator() + { + var defaultResourceType = Assembly.GetAssembly(typeof(lib1.PlcTranslator)) + .GetType("lib1.Resources.PlcStringResources"); + this.SetLocalizationResource(defaultResourceType); + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.meta/meta.json b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.meta/meta.json new file mode 100644 index 000000000..66fc88508 --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.meta/meta.json @@ -0,0 +1 @@ +["NAMESPACE lib1\n\n{S7.extern=ReadWrite}\nCLASS MyClass \nEND_CLASS\nEND_NAMESPACE",""] \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.meta/sourceinfo.json b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.meta/sourceinfo.json new file mode 100644 index 000000000..8d95ff600 --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.meta/sourceinfo.json @@ -0,0 +1 @@ +{"ax-source":"../lib1"} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/Configurations.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/Configurations.g.cs new file mode 100644 index 000000000..e69de29bb diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/Onliners/library.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/Onliners/library.g.cs new file mode 100644 index 000000000..ea3a87b38 --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/Onliners/library.g.cs @@ -0,0 +1,236 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace lib2 +{ + public partial class MyClass : AXSharp.Connector.ITwinObject + { + public OnlinerString MyString { get; } + public OnlinerInt MyInt { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public MyClass(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + MyString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "MyString", "MyString"); + MyInt = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "MyInt", "MyInt"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain() + { + return await (dynamic)this.OnlineToPlainAsync(); + } + + public async Task OnlineToPlainAsync() + { + global::Pocos.lib2.MyClass plain = new global::Pocos.lib2.MyClass(); + await this.ReadAsync(); + plain.MyString = MyString.LastValue; + plain.MyInt = MyInt.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.lib2.MyClass plain = new global::Pocos.lib2.MyClass(); + plain.MyString = MyString.LastValue; + plain.MyInt = MyInt.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.lib2.MyClass plain) + { + plain.MyString = MyString.LastValue; + plain.MyInt = MyInt.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain) + { + await this.PlainToOnlineAsync((dynamic)plain); + } + + public async Task> PlainToOnlineAsync(global::Pocos.lib2.MyClass plain) + { +#pragma warning disable CS0612 + MyString.LethargicWrite(plain.MyString); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + MyInt.LethargicWrite(plain.MyInt); +#pragma warning restore CS0612 + return await this.WriteAsync(); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.lib2.MyClass plain) + { +#pragma warning disable CS0612 + MyString.LethargicWrite(plain.MyString); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + MyInt.LethargicWrite(plain.MyInt); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.lib2.MyClass plain = new global::Pocos.lib2.MyClass(); + plain.MyString = MyString.Shadow; + plain.MyInt = MyInt.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.lib2.MyClass plain) + { + plain.MyString = MyString.Shadow; + plain.MyInt = MyInt.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.lib2.MyClass plain) + { + MyString.Shadow = plain.MyString; + MyInt.Shadow = plain.MyInt; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.lib2.MyClass plain, global::Pocos.lib2.MyClass latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.MyString != MyString.LastValue) + somethingChanged = true; + if (plain.MyInt != MyInt.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.lib2.MyClass CreateEmptyPoco() + { + return new global::Pocos.lib2.MyClass(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::lib2.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/POCO/library.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/POCO/library.g.cs new file mode 100644 index 000000000..9c8c66ac0 --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/POCO/library.g.cs @@ -0,0 +1,19 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace lib2 + { + public partial class MyClass : AXSharp.Connector.IPlain + { + public MyClass() + { + } + + public string MyString { get; set; } = string.Empty; + public Int16 MyInt { get; set; } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/PlcResources.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/PlcResources.g.cs new file mode 100644 index 000000000..7781a99fa --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/PlcResources.g.cs @@ -0,0 +1,26 @@ + +using System.Reflection; +using AXSharp.Connector.Localizations; + +namespace lib2 +{ + public sealed class PlcTranslator : Translator + { + private static readonly PlcTranslator instance = new PlcTranslator(); + + public static PlcTranslator Instance + { + get + { + return instance; + } + } + + private PlcTranslator() + { + var defaultResourceType = Assembly.GetAssembly(typeof(lib2.PlcTranslator)) + .GetType("lib2.Resources.PlcStringResources"); + this.SetLocalizationResource(defaultResourceType); + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.meta/meta.json b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.meta/meta.json new file mode 100644 index 000000000..3f1fd3132 --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.meta/meta.json @@ -0,0 +1 @@ +["NAMESPACE lib2\n\n{S7.extern=ReadWrite}\nCLASS MyClass \nEND_CLASS\nEND_NAMESPACE",""] \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.meta/sourceinfo.json b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.meta/sourceinfo.json new file mode 100644 index 000000000..70de007ce --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.meta/sourceinfo.json @@ -0,0 +1 @@ +{"ax-source":"../lib2"} \ No newline at end of file diff --git a/src/AXSharp.connectors/tests/ax-test-project/apax-lock.json b/src/AXSharp.connectors/tests/ax-test-project/apax-lock.json index f7e4bf291..68811a489 100644 --- a/src/AXSharp.connectors/tests/ax-test-project/apax-lock.json +++ b/src/AXSharp.connectors/tests/ax-test-project/apax-lock.json @@ -41,9 +41,9 @@ }, "@ax/sld": { "name": "@ax/sld", - "version": "3.0.8", - "integrity": "sha512-4YSQf0eXLTGN0LmBBKFYUyhuhZAxH11W+kZfHAjXy5cIkJhhf5g50d/GDZHj5q5hcY/GEIerKLL+B3RUBejHgg==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/sld/-/sld-3.0.8.tgz", + "version": "3.0.9", + "integrity": "sha512-9JijTgtQdxjJOwTScqCciAMMMXn59whSKfYWTtndbjKkDhmds+GnuPJz2w0lQdS4IcFm9odxNWWV5I5lfwrZ0Q==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/sld/-/sld-3.0.9.tgz", "cpu": [ "x64" ], @@ -617,13 +617,6 @@ ], "dependencies": {} }, - "@ax/st-docs": { - "name": "@ax/st-docs", - "version": "7.1.87", - "integrity": "sha512-J5BthD1BR0fu1dkqQFyW3yOByC14TxhG+b/NUl2zXkSqjnsAQQbNtdheZquZ225x0qkJAR8wRrBx9Kr3QdYg8w==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/st-docs/-/st-docs-7.1.87.tgz", - "dependencies": {} - }, "@ax/system-strings": { "name": "@ax/system-strings", "version": "7.1.47", @@ -686,6 +679,13 @@ ], "dependencies": {} }, + "@ax/st-docs": { + "name": "@ax/st-docs", + "version": "7.1.87", + "integrity": "sha512-J5BthD1BR0fu1dkqQFyW3yOByC14TxhG+b/NUl2zXkSqjnsAQQbNtdheZquZ225x0qkJAR8wRrBx9Kr3QdYg8w==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/st-docs/-/st-docs-7.1.87.tgz", + "dependencies": {} + }, "@ax/system-math": { "name": "@ax/system-math", "version": "7.1.47", diff --git a/src/AXSharp.connectors/tests/ax-test-project/src/configuration.st b/src/AXSharp.connectors/tests/ax-test-project/src/configuration.st index 256291c84..d0654f0ca 100644 --- a/src/AXSharp.connectors/tests/ax-test-project/src/configuration.st +++ b/src/AXSharp.connectors/tests/ax-test-project/src/configuration.st @@ -107,3 +107,11 @@ CONFIGURATION MyConfiguration myLDATE_AND_TIME_leap_late : LDATE_AND_TIME; END_VAR END_CONFIGURATION + + +CONFIGURATION MyConfiguration2 + VAR_GLOBAL + {S7.extern=ReadWrite} + mins1 : full_of_primitives; + END_VAR +END_CONFIGURATION \ No newline at end of file diff --git a/src/sanbox/integration/ix-integration-plc/ix/.g/Onliners/configuration.g.cs b/src/sanbox/integration/ix-integration-plc/ix/.g/Onliners/configuration.g.cs index 9e380b6bc..7a0a5ce17 100644 --- a/src/sanbox/integration/ix-integration-plc/ix/.g/Onliners/configuration.g.cs +++ b/src/sanbox/integration/ix-integration-plc/ix/.g/Onliners/configuration.g.cs @@ -4,73 +4,4 @@ using System.Collections.Generic; using AXSharp.Connector.Localizations; using AXSharp.Abstractions.Presentation; -using MonsterData; - -public partial class ix_integration_plcTwinController : ITwinController -{ - public AXSharp.Connector.Connector Connector { get; } - public all_primitives all_primitives { get; } - public weather weather { get; } - public weathers weathers { get; } - public Layouts.Stacked.weather weather_stacked { get; } - public Layouts.Wrapped.weather weather_wrapped { get; } - public Layouts.Tabbed.weather weather_tabbed { get; } - - [ReadOnce()] - public Layouts.Stacked.weather weather_readOnce { get; } - - [ReadOnly()] - public Layouts.Stacked.weather weather_readOnly { get; } - public example test_example { get; } - public MeasurementExample.Measurements measurements { get; } - public ixcomponent ixcomponent { get; } - public MonsterData.Monster monster { get; } - - public ix_integration_plcTwinController(AXSharp.Connector.ConnectorAdapter adapter, object[] parameters) - { - this.Connector = adapter.GetConnector(parameters); - all_primitives = new all_primitives(this.Connector, "", "all_primitives"); - weather = new weather(this.Connector, "", "weather"); - weathers = new weathers(this.Connector, "", "weathers"); - weather_stacked = new Layouts.Stacked.weather(this.Connector, "", "weather_stacked"); - weather_stacked.AttributeName = "Weather in a stack pannel and grouped in group box"; - weather_wrapped = new Layouts.Wrapped.weather(this.Connector, "", "weather_wrapped"); - weather_wrapped.AttributeName = "Weather in a wrap pannel and grouped in group box"; - weather_tabbed = new Layouts.Tabbed.weather(this.Connector, "", "weather_tabbed"); - weather_tabbed.AttributeName = "Weather in a tabs and grouped in group box"; - weather_readOnce = new Layouts.Stacked.weather(this.Connector, "", "weather_readOnce"); - weather_readOnce.AttributeName = "Weather structure set to read once"; - weather_readOnce.MakeReadOnce(); - weather_readOnly = new Layouts.Stacked.weather(this.Connector, "", "weather_readOnly"); - weather_readOnly.AttributeName = "Weather structure set to read only"; - weather_readOnly.MakeReadOnly(); - test_example = new example(this.Connector, "", "test_example"); - measurements = new MeasurementExample.Measurements(this.Connector, "", "measurements"); - ixcomponent = new ixcomponent(this.Connector, "", "ixcomponent"); - monster = new MonsterData.Monster(this.Connector, "", "monster"); - } - - public ix_integration_plcTwinController(AXSharp.Connector.ConnectorAdapter adapter) - { - this.Connector = adapter.GetConnector(adapter.Parameters); - all_primitives = new all_primitives(this.Connector, "", "all_primitives"); - weather = new weather(this.Connector, "", "weather"); - weathers = new weathers(this.Connector, "", "weathers"); - weather_stacked = new Layouts.Stacked.weather(this.Connector, "", "weather_stacked"); - weather_stacked.AttributeName = "Weather in a stack pannel and grouped in group box"; - weather_wrapped = new Layouts.Wrapped.weather(this.Connector, "", "weather_wrapped"); - weather_wrapped.AttributeName = "Weather in a wrap pannel and grouped in group box"; - weather_tabbed = new Layouts.Tabbed.weather(this.Connector, "", "weather_tabbed"); - weather_tabbed.AttributeName = "Weather in a tabs and grouped in group box"; - weather_readOnce = new Layouts.Stacked.weather(this.Connector, "", "weather_readOnce"); - weather_readOnce.AttributeName = "Weather structure set to read once"; - weather_readOnce.MakeReadOnce(); - weather_readOnly = new Layouts.Stacked.weather(this.Connector, "", "weather_readOnly"); - weather_readOnly.AttributeName = "Weather structure set to read only"; - weather_readOnly.MakeReadOnly(); - test_example = new example(this.Connector, "", "test_example"); - measurements = new MeasurementExample.Measurements(this.Connector, "", "measurements"); - ixcomponent = new ixcomponent(this.Connector, "", "ixcomponent"); - monster = new MonsterData.Monster(this.Connector, "", "monster"); - } -} \ No newline at end of file +using MonsterData; \ No newline at end of file diff --git a/src/sanbox/integration/ix-integration-plc/ix/.g/POCO/configuration.g.cs b/src/sanbox/integration/ix-integration-plc/ix/.g/POCO/configuration.g.cs index 4fc70f4b5..087bf3a43 100644 --- a/src/sanbox/integration/ix-integration-plc/ix/.g/POCO/configuration.g.cs +++ b/src/sanbox/integration/ix-integration-plc/ix/.g/POCO/configuration.g.cs @@ -5,29 +5,4 @@ namespace Pocos { - public partial class ix_integration_plcTwinController - { - public all_primitives all_primitives { get; set; } = new all_primitives(); - public weather weather { get; set; } = new weather(); - public weathers weathers { get; set; } = new weathers(); - - [AXSharp.Connector.AddedPropertiesAttribute("AttributeName", "Weather in a stack pannel and grouped in group box")] - public Layouts.Stacked.weather weather_stacked { get; set; } = new Layouts.Stacked.weather(); - - [AXSharp.Connector.AddedPropertiesAttribute("AttributeName", "Weather in a wrap pannel and grouped in group box")] - public Layouts.Wrapped.weather weather_wrapped { get; set; } = new Layouts.Wrapped.weather(); - - [AXSharp.Connector.AddedPropertiesAttribute("AttributeName", "Weather in a tabs and grouped in group box")] - public Layouts.Tabbed.weather weather_tabbed { get; set; } = new Layouts.Tabbed.weather(); - - [AXSharp.Connector.AddedPropertiesAttribute("AttributeName", "Weather structure set to read once")] - public Layouts.Stacked.weather weather_readOnce { get; set; } = new Layouts.Stacked.weather(); - - [AXSharp.Connector.AddedPropertiesAttribute("AttributeName", "Weather structure set to read only")] - public Layouts.Stacked.weather weather_readOnly { get; set; } = new Layouts.Stacked.weather(); - public example test_example { get; set; } = new example(); - public MeasurementExample.Measurements measurements { get; set; } = new MeasurementExample.Measurements(); - public ixcomponent ixcomponent { get; set; } = new ixcomponent(); - public MonsterData.Monster monster { get; set; } = new MonsterData.Monster(); - } } \ No newline at end of file diff --git a/src/tests.integrations/integrated/src/ax/apax-lock.json b/src/tests.integrations/integrated/src/ax/apax-lock.json index dba2d3644..62a06b765 100644 --- a/src/tests.integrations/integrated/src/ax/apax-lock.json +++ b/src/tests.integrations/integrated/src/ax/apax-lock.json @@ -41,9 +41,9 @@ }, "@ax/sld": { "name": "@ax/sld", - "version": "3.0.8", - "integrity": "sha512-4YSQf0eXLTGN0LmBBKFYUyhuhZAxH11W+kZfHAjXy5cIkJhhf5g50d/GDZHj5q5hcY/GEIerKLL+B3RUBejHgg==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/sld/-/sld-3.0.8.tgz", + "version": "3.0.9", + "integrity": "sha512-9JijTgtQdxjJOwTScqCciAMMMXn59whSKfYWTtndbjKkDhmds+GnuPJz2w0lQdS4IcFm9odxNWWV5I5lfwrZ0Q==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/sld/-/sld-3.0.9.tgz", "cpu": [ "x64" ], diff --git a/src/tests.integrations/integrated/src/integrated.twin/.g/Onliners/configuration.g.cs b/src/tests.integrations/integrated/src/integrated.twin/.g/Onliners/configuration.g.cs index a79c9e2b7..1a41fa9df 100644 --- a/src/tests.integrations/integrated/src/integrated.twin/.g/Onliners/configuration.g.cs +++ b/src/tests.integrations/integrated/src/integrated.twin/.g/Onliners/configuration.g.cs @@ -6,120 +6,6 @@ using AXSharp.Abstractions.Presentation; using RealMonsterData; -public partial class integratedTwinController : ITwinController -{ - public AXSharp.Connector.Connector Connector { get; } - public MonsterData.Monster Monster { get; } - public MonsterData.Monster OnlineToPlain_should_copy_entire_structure { get; } - public MonsterData.Monster PlainToOnline_should_copy_entire_structure { get; } - public MonsterData.Monster OnlineToShadowAsync_should_copy_entire_structure { get; } - public MonsterData.Monster ShadowToOnlineAsync_should_copy_entire_structure { get; } - public MonsterData.Monster ITwinObjectOnlineToPlain_should_copy_entire_structure { get; } - public MonsterData.Monster ITwinObjectPlainToOnline_should_copy_entire_structure { get; } - public MonsterData.Monster ITwinObjectOnlineToShadowAsync_should_copy_entire_structure { get; } - public MonsterData.Monster ITwinObjectShadowToOnlineAsync_should_copy_entire_structure { get; } - public MonsterData.Monster ShadowToPlainAsync_should_copy_entire_structure { get; } - public MonsterData.Monster PlainToShadowAsync_should_copy_entire_structure { get; } - public MonsterData.Monster ITwinObjectShadowToPlainAsync_should_copy_entire_structure { get; } - public MonsterData.Monster ITwinObjectPlainToShadowAsync_should_copy_entire_structure { get; } - public Pokus Pokus { get; } - public RealMonsterData.RealMonster RealMonster { get; } - public RealMonsterData.RealMonster OnlineToShadow_should_copy { get; } - public RealMonsterData.RealMonster ShadowToOnline_should_copy { get; } - public RealMonsterData.RealMonster OnlineToPlain_should_copy { get; } - public RealMonsterData.RealMonster PlainToOnline_should_copy { get; } - public RealMonsterData.RealMonster ITwinObjectOnlineToShadow_should_copy { get; } - public RealMonsterData.RealMonster ITwinObjectShadowToOnline_should_copy { get; } - public RealMonsterData.RealMonster ITwinObjectOnlineToPlain_should_copy { get; } - public RealMonsterData.RealMonster ITwinObjectPlainToOnline_should_copy { get; } - public all_primitives p_online_shadow { get; } - public all_primitives p_shadow_online { get; } - public all_primitives p_online_plain { get; } - public all_primitives p_plain_online { get; } - public all_primitives p_shadow_plain { get; } - public all_primitives p_plain_shadow { get; } - public RealMonsterData.RealMonster StartPolling_should_update_cyclic_property { get; } - public RealMonsterData.RealMonster StartPolling_ConcurentOverload { get; } - public RealMonsterData.RealMonster ChangeDetections { get; } - public GH_ISSUE_183.GH_ISSUE_183_1 GH_ISSUE_183 { get; } - - public integratedTwinController(AXSharp.Connector.ConnectorAdapter adapter, object[] parameters) - { - this.Connector = adapter.GetConnector(parameters); - Monster = new MonsterData.Monster(this.Connector, "", "Monster"); - OnlineToPlain_should_copy_entire_structure = new MonsterData.Monster(this.Connector, "", "OnlineToPlain_should_copy_entire_structure"); - PlainToOnline_should_copy_entire_structure = new MonsterData.Monster(this.Connector, "", "PlainToOnline_should_copy_entire_structure"); - OnlineToShadowAsync_should_copy_entire_structure = new MonsterData.Monster(this.Connector, "", "OnlineToShadowAsync_should_copy_entire_structure"); - ShadowToOnlineAsync_should_copy_entire_structure = new MonsterData.Monster(this.Connector, "", "ShadowToOnlineAsync_should_copy_entire_structure"); - ITwinObjectOnlineToPlain_should_copy_entire_structure = new MonsterData.Monster(this.Connector, "", "ITwinObjectOnlineToPlain_should_copy_entire_structure"); - ITwinObjectPlainToOnline_should_copy_entire_structure = new MonsterData.Monster(this.Connector, "", "ITwinObjectPlainToOnline_should_copy_entire_structure"); - ITwinObjectOnlineToShadowAsync_should_copy_entire_structure = new MonsterData.Monster(this.Connector, "", "ITwinObjectOnlineToShadowAsync_should_copy_entire_structure"); - ITwinObjectShadowToOnlineAsync_should_copy_entire_structure = new MonsterData.Monster(this.Connector, "", "ITwinObjectShadowToOnlineAsync_should_copy_entire_structure"); - ShadowToPlainAsync_should_copy_entire_structure = new MonsterData.Monster(this.Connector, "", "ShadowToPlainAsync_should_copy_entire_structure"); - PlainToShadowAsync_should_copy_entire_structure = new MonsterData.Monster(this.Connector, "", "PlainToShadowAsync_should_copy_entire_structure"); - ITwinObjectShadowToPlainAsync_should_copy_entire_structure = new MonsterData.Monster(this.Connector, "", "ITwinObjectShadowToPlainAsync_should_copy_entire_structure"); - ITwinObjectPlainToShadowAsync_should_copy_entire_structure = new MonsterData.Monster(this.Connector, "", "ITwinObjectPlainToShadowAsync_should_copy_entire_structure"); - Pokus = new Pokus(this.Connector, "", "Pokus"); - RealMonster = new RealMonsterData.RealMonster(this.Connector, "", "RealMonster"); - OnlineToShadow_should_copy = new RealMonsterData.RealMonster(this.Connector, "", "OnlineToShadow_should_copy"); - ShadowToOnline_should_copy = new RealMonsterData.RealMonster(this.Connector, "", "ShadowToOnline_should_copy"); - OnlineToPlain_should_copy = new RealMonsterData.RealMonster(this.Connector, "", "OnlineToPlain_should_copy"); - PlainToOnline_should_copy = new RealMonsterData.RealMonster(this.Connector, "", "PlainToOnline_should_copy"); - ITwinObjectOnlineToShadow_should_copy = new RealMonsterData.RealMonster(this.Connector, "", "ITwinObjectOnlineToShadow_should_copy"); - ITwinObjectShadowToOnline_should_copy = new RealMonsterData.RealMonster(this.Connector, "", "ITwinObjectShadowToOnline_should_copy"); - ITwinObjectOnlineToPlain_should_copy = new RealMonsterData.RealMonster(this.Connector, "", "ITwinObjectOnlineToPlain_should_copy"); - ITwinObjectPlainToOnline_should_copy = new RealMonsterData.RealMonster(this.Connector, "", "ITwinObjectPlainToOnline_should_copy"); - p_online_shadow = new all_primitives(this.Connector, "", "p_online_shadow"); - p_shadow_online = new all_primitives(this.Connector, "", "p_shadow_online"); - p_online_plain = new all_primitives(this.Connector, "", "p_online_plain"); - p_plain_online = new all_primitives(this.Connector, "", "p_plain_online"); - p_shadow_plain = new all_primitives(this.Connector, "", "p_shadow_plain"); - p_plain_shadow = new all_primitives(this.Connector, "", "p_plain_shadow"); - StartPolling_should_update_cyclic_property = new RealMonsterData.RealMonster(this.Connector, "", "StartPolling_should_update_cyclic_property"); - StartPolling_ConcurentOverload = new RealMonsterData.RealMonster(this.Connector, "", "StartPolling_ConcurentOverload"); - ChangeDetections = new RealMonsterData.RealMonster(this.Connector, "", "ChangeDetections"); - GH_ISSUE_183 = new GH_ISSUE_183.GH_ISSUE_183_1(this.Connector, "", "GH_ISSUE_183"); - } - - public integratedTwinController(AXSharp.Connector.ConnectorAdapter adapter) - { - this.Connector = adapter.GetConnector(adapter.Parameters); - Monster = new MonsterData.Monster(this.Connector, "", "Monster"); - OnlineToPlain_should_copy_entire_structure = new MonsterData.Monster(this.Connector, "", "OnlineToPlain_should_copy_entire_structure"); - PlainToOnline_should_copy_entire_structure = new MonsterData.Monster(this.Connector, "", "PlainToOnline_should_copy_entire_structure"); - OnlineToShadowAsync_should_copy_entire_structure = new MonsterData.Monster(this.Connector, "", "OnlineToShadowAsync_should_copy_entire_structure"); - ShadowToOnlineAsync_should_copy_entire_structure = new MonsterData.Monster(this.Connector, "", "ShadowToOnlineAsync_should_copy_entire_structure"); - ITwinObjectOnlineToPlain_should_copy_entire_structure = new MonsterData.Monster(this.Connector, "", "ITwinObjectOnlineToPlain_should_copy_entire_structure"); - ITwinObjectPlainToOnline_should_copy_entire_structure = new MonsterData.Monster(this.Connector, "", "ITwinObjectPlainToOnline_should_copy_entire_structure"); - ITwinObjectOnlineToShadowAsync_should_copy_entire_structure = new MonsterData.Monster(this.Connector, "", "ITwinObjectOnlineToShadowAsync_should_copy_entire_structure"); - ITwinObjectShadowToOnlineAsync_should_copy_entire_structure = new MonsterData.Monster(this.Connector, "", "ITwinObjectShadowToOnlineAsync_should_copy_entire_structure"); - ShadowToPlainAsync_should_copy_entire_structure = new MonsterData.Monster(this.Connector, "", "ShadowToPlainAsync_should_copy_entire_structure"); - PlainToShadowAsync_should_copy_entire_structure = new MonsterData.Monster(this.Connector, "", "PlainToShadowAsync_should_copy_entire_structure"); - ITwinObjectShadowToPlainAsync_should_copy_entire_structure = new MonsterData.Monster(this.Connector, "", "ITwinObjectShadowToPlainAsync_should_copy_entire_structure"); - ITwinObjectPlainToShadowAsync_should_copy_entire_structure = new MonsterData.Monster(this.Connector, "", "ITwinObjectPlainToShadowAsync_should_copy_entire_structure"); - Pokus = new Pokus(this.Connector, "", "Pokus"); - RealMonster = new RealMonsterData.RealMonster(this.Connector, "", "RealMonster"); - OnlineToShadow_should_copy = new RealMonsterData.RealMonster(this.Connector, "", "OnlineToShadow_should_copy"); - ShadowToOnline_should_copy = new RealMonsterData.RealMonster(this.Connector, "", "ShadowToOnline_should_copy"); - OnlineToPlain_should_copy = new RealMonsterData.RealMonster(this.Connector, "", "OnlineToPlain_should_copy"); - PlainToOnline_should_copy = new RealMonsterData.RealMonster(this.Connector, "", "PlainToOnline_should_copy"); - ITwinObjectOnlineToShadow_should_copy = new RealMonsterData.RealMonster(this.Connector, "", "ITwinObjectOnlineToShadow_should_copy"); - ITwinObjectShadowToOnline_should_copy = new RealMonsterData.RealMonster(this.Connector, "", "ITwinObjectShadowToOnline_should_copy"); - ITwinObjectOnlineToPlain_should_copy = new RealMonsterData.RealMonster(this.Connector, "", "ITwinObjectOnlineToPlain_should_copy"); - ITwinObjectPlainToOnline_should_copy = new RealMonsterData.RealMonster(this.Connector, "", "ITwinObjectPlainToOnline_should_copy"); - p_online_shadow = new all_primitives(this.Connector, "", "p_online_shadow"); - p_shadow_online = new all_primitives(this.Connector, "", "p_shadow_online"); - p_online_plain = new all_primitives(this.Connector, "", "p_online_plain"); - p_plain_online = new all_primitives(this.Connector, "", "p_plain_online"); - p_shadow_plain = new all_primitives(this.Connector, "", "p_shadow_plain"); - p_plain_shadow = new all_primitives(this.Connector, "", "p_plain_shadow"); - StartPolling_should_update_cyclic_property = new RealMonsterData.RealMonster(this.Connector, "", "StartPolling_should_update_cyclic_property"); - StartPolling_ConcurentOverload = new RealMonsterData.RealMonster(this.Connector, "", "StartPolling_ConcurentOverload"); - ChangeDetections = new RealMonsterData.RealMonster(this.Connector, "", "ChangeDetections"); - GH_ISSUE_183 = new GH_ISSUE_183.GH_ISSUE_183_1(this.Connector, "", "GH_ISSUE_183"); - } -} - public partial class Pokus : AXSharp.Connector.ITwinObject { partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); diff --git a/src/tests.integrations/integrated/src/integrated.twin/.g/POCO/configuration.g.cs b/src/tests.integrations/integrated/src/integrated.twin/.g/POCO/configuration.g.cs index b3d4996be..e45780031 100644 --- a/src/tests.integrations/integrated/src/integrated.twin/.g/POCO/configuration.g.cs +++ b/src/tests.integrations/integrated/src/integrated.twin/.g/POCO/configuration.g.cs @@ -5,43 +5,6 @@ namespace Pocos { - public partial class integratedTwinController - { - public MonsterData.Monster Monster { get; set; } = new MonsterData.Monster(); - public MonsterData.Monster OnlineToPlain_should_copy_entire_structure { get; set; } = new MonsterData.Monster(); - public MonsterData.Monster PlainToOnline_should_copy_entire_structure { get; set; } = new MonsterData.Monster(); - public MonsterData.Monster OnlineToShadowAsync_should_copy_entire_structure { get; set; } = new MonsterData.Monster(); - public MonsterData.Monster ShadowToOnlineAsync_should_copy_entire_structure { get; set; } = new MonsterData.Monster(); - public MonsterData.Monster ITwinObjectOnlineToPlain_should_copy_entire_structure { get; set; } = new MonsterData.Monster(); - public MonsterData.Monster ITwinObjectPlainToOnline_should_copy_entire_structure { get; set; } = new MonsterData.Monster(); - public MonsterData.Monster ITwinObjectOnlineToShadowAsync_should_copy_entire_structure { get; set; } = new MonsterData.Monster(); - public MonsterData.Monster ITwinObjectShadowToOnlineAsync_should_copy_entire_structure { get; set; } = new MonsterData.Monster(); - public MonsterData.Monster ShadowToPlainAsync_should_copy_entire_structure { get; set; } = new MonsterData.Monster(); - public MonsterData.Monster PlainToShadowAsync_should_copy_entire_structure { get; set; } = new MonsterData.Monster(); - public MonsterData.Monster ITwinObjectShadowToPlainAsync_should_copy_entire_structure { get; set; } = new MonsterData.Monster(); - public MonsterData.Monster ITwinObjectPlainToShadowAsync_should_copy_entire_structure { get; set; } = new MonsterData.Monster(); - public Pokus Pokus { get; set; } = new Pokus(); - public RealMonsterData.RealMonster RealMonster { get; set; } = new RealMonsterData.RealMonster(); - public RealMonsterData.RealMonster OnlineToShadow_should_copy { get; set; } = new RealMonsterData.RealMonster(); - public RealMonsterData.RealMonster ShadowToOnline_should_copy { get; set; } = new RealMonsterData.RealMonster(); - public RealMonsterData.RealMonster OnlineToPlain_should_copy { get; set; } = new RealMonsterData.RealMonster(); - public RealMonsterData.RealMonster PlainToOnline_should_copy { get; set; } = new RealMonsterData.RealMonster(); - public RealMonsterData.RealMonster ITwinObjectOnlineToShadow_should_copy { get; set; } = new RealMonsterData.RealMonster(); - public RealMonsterData.RealMonster ITwinObjectShadowToOnline_should_copy { get; set; } = new RealMonsterData.RealMonster(); - public RealMonsterData.RealMonster ITwinObjectOnlineToPlain_should_copy { get; set; } = new RealMonsterData.RealMonster(); - public RealMonsterData.RealMonster ITwinObjectPlainToOnline_should_copy { get; set; } = new RealMonsterData.RealMonster(); - public all_primitives p_online_shadow { get; set; } = new all_primitives(); - public all_primitives p_shadow_online { get; set; } = new all_primitives(); - public all_primitives p_online_plain { get; set; } = new all_primitives(); - public all_primitives p_plain_online { get; set; } = new all_primitives(); - public all_primitives p_shadow_plain { get; set; } = new all_primitives(); - public all_primitives p_plain_shadow { get; set; } = new all_primitives(); - public RealMonsterData.RealMonster StartPolling_should_update_cyclic_property { get; set; } = new RealMonsterData.RealMonster(); - public RealMonsterData.RealMonster StartPolling_ConcurentOverload { get; set; } = new RealMonsterData.RealMonster(); - public RealMonsterData.RealMonster ChangeDetections { get; set; } = new RealMonsterData.RealMonster(); - public GH_ISSUE_183.GH_ISSUE_183_1 GH_ISSUE_183 { get; set; } = new GH_ISSUE_183.GH_ISSUE_183_1(); - } - public partial class Pokus : AXSharp.Connector.IPlain { public Pokus()