From d4222554598601a474ad4bcc6cb425979a4e162b Mon Sep 17 00:00:00 2001 From: malstraem Date: Tue, 24 Dec 2024 18:44:02 +0300 Subject: [PATCH] fix linking break --- docs/index.md | 6 ++++-- docs/package.md | 9 +++++---- readme.md | 4 ++-- source/library/Arinc424.csproj | 5 ++--- source/library/linking/Known{TRecord, TType}.cs | 4 ++-- source/library/linking/Polymorph{TRecord, TType}.cs | 2 +- source/library/linking/Possible{TRecord, TType}.cs | 2 +- source/library/linking/Relationships{TRecord}.cs | 6 ++++-- tests/tests/Arinc424.Tests.csproj | 2 +- 9 files changed, 22 insertions(+), 18 deletions(-) diff --git a/docs/index.md b/docs/index.md index 2693914..0d82f90 100644 --- a/docs/index.md +++ b/docs/index.md @@ -3,11 +3,13 @@ # Overview -While the **ARINC 424** specification describes entities (or records) with 132-byte fixed-length string, this library creates a database object model via building entities using reflection and runtime compilation. +While the **ARINC 424** specification describes entities with 132-byte fixed-length string, this library creates a database object model via building entities using reflection and runtime compilation. Most terms are converted according to the specification into associated enumerations or numeric values ​​on the fly. -In addition, relationships between entities are established after the building stage. In practice, this allows you to explore and manipulate the tree-like representation of **ARINC 424** database. +In addition, relationships between entities are established after the building stage. + +In practice, this allows you to explore and manipulate the tree-like representation of **ARINC 424** database. ## Specification map diff --git a/docs/package.md b/docs/package.md index d2449ba..dd7f35c 100644 --- a/docs/package.md +++ b/docs/package.md @@ -1,12 +1,13 @@ # Overview -While the **ARINC 424** specification describes entities (or records) with 132-byte fixed-length string, +While the **ARINC 424** specification describes entities with 132-byte fixed-length string, this library creates a database object model via building entities using reflection and runtime compilation. Most terms are converted according to the specification into associated enumerations or numeric values ​​on the fly. -In addition, relationships between entities are established after the building stage. In practice, -this allows you to explore and manipulate the tree-like representation of **ARINC 424** database. +In addition, relationships between entities are established after the building stage. + +In practice, this allows you to explore and manipulate the tree-like representation of **ARINC 424** database. See [docs](https://malstraem.github.io/arinc424.net) to know how specification is mapped. @@ -19,7 +20,7 @@ and entities created based on [supplement](https://malstraem.github.io/arinc424. var meta = Meta424.Create(Supplement.V20); ``` -And you can try to get navigation [data](https://malstraem.github.io/arinc424.net/api/Arinc424.Data424.html) from the strings +So you can try to get navigation [data](https://malstraem.github.io/arinc424.net/api/Arinc424.Data424.html) from the strings leaving [builds](https://malstraem.github.io/arinc424.net/api/Arinc424.Building.Build.html) with diagnostics (bad coded fields, missing links, etc) and skipped strings that don't match entity types. diff --git a/readme.md b/readme.md index ba4a9b7..e36077e 100644 --- a/readme.md +++ b/readme.md @@ -9,7 +9,7 @@ This is a long-term research and proof of concept to provide a model and reader for the globally used **`ARINC 424`** aircraft navigation data using metaprogramming. -While the **`ARINC 424`** specification describes entities (*or records in terms*) with 132-byte fixed-length strings, this library creates +While the **`ARINC 424`** specification describes entities with 132-byte fixed-length strings, this library creates a database object model via building entities using reflection and runtime compilation. Most terms are converted according to the specification into associated enumerations or numeric values ​​on the fly. @@ -29,7 +29,7 @@ and entities created based on [supplement](https://malstraem.github.io/arinc424. var meta = Meta424.Create(Supplement.V20); ``` -And you can try to get navigation [data](https://malstraem.github.io/arinc424.net/api/Arinc424.Data424.html) from the strings +So you can try to get navigation [data](https://malstraem.github.io/arinc424.net/api/Arinc424.Data424.html) from the strings leaving [builds](https://malstraem.github.io/arinc424.net/api/Arinc424.Building.Build.html) with diagnostics (bad coded fields, missing links, etc) and skipped strings that don't match entity types. diff --git a/source/library/Arinc424.csproj b/source/library/Arinc424.csproj index 996a153..db194f6 100644 --- a/source/library/Arinc424.csproj +++ b/source/library/Arinc424.csproj @@ -9,7 +9,6 @@ $(DefineConstants);NOPARALLEL - true true @@ -19,7 +18,7 @@ true true - 0.1.1-alpha + 0.1.2 arinc424 ARINC 424 object model @@ -40,6 +39,6 @@ - + diff --git a/source/library/linking/Known{TRecord, TType}.cs b/source/library/linking/Known{TRecord, TType}.cs index cb1a0f9..b14d84b 100644 --- a/source/library/linking/Known{TRecord, TType}.cs +++ b/source/library/linking/Known{TRecord, TType}.cs @@ -25,7 +25,7 @@ internal override bool TryLink(TRecord record, Unique unique, Meta424 meta, [Not var type = property.PropertyType; - if (!foreign.TryGetKey(record.Source!, meta.TypeInfo[property.PropertyType].Primary! /* guarantee by design */, out string? key)) + if (!foreign.TryGetKey(record.Source!, meta.TypeInfo[type].Primary! /* guarantee by design */, out string? key)) return true; if (!unique.TryGetRecords(type, out var records)) @@ -41,7 +41,7 @@ internal override bool TryLink(TRecord record, Unique unique, Meta424 meta, [Not // guarantee by design set(record, Unsafe.As(referenced)); - meta.TypeInfo[type].Relations?.Process(type, referenced, record); + meta.TypeInfo[type].Relations?.Process(referenced, record); return true; } diff --git a/source/library/linking/Polymorph{TRecord, TType}.cs b/source/library/linking/Polymorph{TRecord, TType}.cs index e34ef83..7dddc92 100644 --- a/source/library/linking/Polymorph{TRecord, TType}.cs +++ b/source/library/linking/Polymorph{TRecord, TType}.cs @@ -74,7 +74,7 @@ internal override bool TryLink(TRecord record, Unique unique, Meta424 meta, [Not } set(record, @ref); - meta.TypeInfo[type].Relations?.Process(type, referenced, record); + meta.TypeInfo[type].Relations?.Process(referenced, record); return true; } diff --git a/source/library/linking/Possible{TRecord, TType}.cs b/source/library/linking/Possible{TRecord, TType}.cs index 976af3e..dba80f4 100644 --- a/source/library/linking/Possible{TRecord, TType}.cs +++ b/source/library/linking/Possible{TRecord, TType}.cs @@ -24,7 +24,7 @@ internal override bool TryLink(TRecord record, Unique unique, Meta424 meta, [Not && records.TryGetValue(key, out var referenced)) { set(record, (TType)referenced); - meta.TypeInfo[type].Relations!.Process(type, referenced, record); + meta.TypeInfo[type].Relations!.Process(referenced, record); return true; } } diff --git a/source/library/linking/Relationships{TRecord}.cs b/source/library/linking/Relationships{TRecord}.cs index eed982c..a6f076b 100644 --- a/source/library/linking/Relationships{TRecord}.cs +++ b/source/library/linking/Relationships{TRecord}.cs @@ -14,8 +14,10 @@ internal abstract class Relationships(Type type) #pragma warning restore CS8618 internal abstract void Link(IEnumerable builds, Unique unique, Meta424 meta); - internal void Process(Type type, Record424 self, TRecord referenced) where TRecord : Record424 + internal void Process(Record424 self, TRecord referenced) where TRecord : Record424 { + var type = typeof(TRecord); + // todo: compiled one & many relations if (many.TryGetValue(type, out var property)) { @@ -26,7 +28,7 @@ internal void Process(Type type, Record424 self, TRecord referenced) wh } else if (one.TryGetValue(type, out property)) { - property.SetValue(referenced, referenced); + property.SetValue(self, referenced); } } diff --git a/tests/tests/Arinc424.Tests.csproj b/tests/tests/Arinc424.Tests.csproj index f9444ff..83cc015 100644 --- a/tests/tests/Arinc424.Tests.csproj +++ b/tests/tests/Arinc424.Tests.csproj @@ -8,7 +8,7 @@ + IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />