Files
DP44/enriched-qwen3-coder-next/Common/DTS.Common.SerializationPlus/Control/Event.md
2026-04-17 14:55:32 -04:00

110 lines
7.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
source_files:
- Common/DTS.Common.SerializationPlus/Control/Event/DasModuleAccessor.cs
- Common/DTS.Common.SerializationPlus/Control/Event/DasChannelAccessor.cs
- Common/DTS.Common.SerializationPlus/Control/Event/ChannelAccessor.cs
- Common/DTS.Common.SerializationPlus/Control/Event/ModuleChannelAccessor.cs
- Common/DTS.Common.SerializationPlus/Control/Event/DasModuleChannelAccessor.cs
- Common/DTS.Common.SerializationPlus/Control/Event/TestInformation.cs
generated_at: "2026-04-16T03:30:58.722127+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "cdfba6906b172be2"
---
# Event
## Documentation: DTS.Slice.Control.Event Accessor Types
---
### 1. **Purpose**
This module defines a set of specialized accessor types used to navigate hierarchical channel and module data associated with a DAS (Data Acquisition System) event. These types (`DasModuleAccessor`, `DasChannelAccessor`, `DasModuleChannelAccessor`, `ModuleChannelAccessor`, `ChannelAccessor`) are nested within the `Event` class and provide structured, type-safe access to event data indexed by DAS identifiers (e.g., DAS ID, module number, channel number). They are intended to be instantiated and populated during `Event` construction, enabling consumers to retrieve module and channel information using multi-level keys. The module also includes `TestInformation`, an internal helper class to encapsulate test metadata (ID and description) associated with the event.
---
### 2. **Public Interface**
All classes are nested within `DTS.Slice.Control.Event` and are declared `public`.
| Type | Inheritance | Constructor(s) | Key Type | Value Type | Description |
|------|-------------|----------------|----------|------------|-------------|
| `DasModuleAccessor` | `ExceptionalDictionary<Common.DAS.Concepts.DAS.Id, List<Module>>` | `DasModuleAccessor()` | `Common.DAS.Concepts.DAS.Id` | `List<Module>` | Maps a DAS ID to a list of modules associated with that DAS in the event. |
| `DasChannelAccessor` | `ExceptionalDictionary<Common.DAS.Concepts.DAS.Id, List<Module.Channel>>` | `DasChannelAccessor()` | `Common.DAS.Concepts.DAS.Id` | `List<Module.Channel>` | Maps a DAS ID to a list of channels (across all modules) associated with that DAS in the event. |
| `ChannelAccessor` | `ExceptionalDictionary<int, Module.Channel>` | `ChannelAccessor()` | `int` | `Module.Channel` | Maps a *module-local* channel number (as `int`) to a `Module.Channel` instance. Used internally by `ModuleChannelAccessor`. |
| `ModuleChannelAccessor` | `ExceptionalDictionary<int, ChannelAccessor>` | `ModuleChannelAccessor()` | `int` | `ChannelAccessor` | Maps a *module ID* (as `int`) to a `ChannelAccessor`, which in turn maps channel numbers to channels. Used internally by `DasModuleChannelAccessor`. |
| `DasModuleChannelAccessor` | `ExceptionalDictionary<Common.DAS.Concepts.DAS.Id, ModuleChannelAccessor>` | `DasModuleChannelAccessor()` | `Common.DAS.Concepts.DAS.Id` | `ModuleChannelAccessor` | Maps a DAS ID to a `ModuleChannelAccessor`, enabling lookup of channels by DAS ID → module ID → channel number. |
| `TestInformation` | `Exceptional` | `TestInformation()`<br>`TestInformation(string id, string description)` | — | — | Internal class holding test ID and description. Not intended for direct external use. |
> **Note**: All accessor types inherit from `ExceptionalDictionary<TKey, TValue>` (from `DTS.Common.Utilities`), implying they support exception-based error handling for missing keys (e.g., `KeyNotFoundException` or custom behavior defined in `ExceptionalDictionary`).
---
### 3. **Invariants**
- **Hierarchical Key Structure**:
- `DasModuleChannelAccessor``ModuleChannelAccessor``ChannelAccessor``Module.Channel`
provides a 3-level lookup: `DAS.Id``int (module ID)``int (channel number)``Module.Channel`.
- `DasModuleAccessor` and `DasChannelAccessor` provide 2-level lookup: `DAS.Id``List<Module>` or `List<Module.Channel>`.
- **Null Handling**:
- All `Property<T>` fields in `TestInformation` are initialized with `null` as the default value and `false` for `allowNull` (per constructor args), but the `Property<T>` wrapper likely enforces nullability semantics (exact behavior depends on `Property<T>` implementation, not visible here).
- **No Validation Logic Visible**:
- No validation rules (e.g., range checks on channel/module IDs) are present in the source. Assumption: validation (if any) is handled upstream or by `ExceptionalDictionary`.
- **Partial Class**:
- All types are declared `partial class Event`, meaning these accessors are part of a larger `Event` class defined elsewhere (likely in `DTS.Slice.Control.Event.cs`, referenced in comments).
---
### 4. **Dependencies**
#### Internal Dependencies (from source):
- `DTS.Common.Utilities.ExceptionalDictionary<TKey, TValue>`
Base class for all accessor types.
- `DTS.Common.Utilities.Property<T>`
Used in `TestInformation` for property encapsulation.
- `DTS.Common.DASResource`
Namespace imported by `TestInformation` (likely contains DAS resource types).
- `DTS.Common.Utilities.DotNetProgrammingConstructs`
Namespace imported by `TestInformation` (likely contains `Property<T>` or similar constructs).
- `DTS.Slice.Control.Event`
All types are nested inside `Event` (partial class).
- `Common.DAS.Concepts.DAS.Id`
Key type for DAS-level accessors (`DasModuleAccessor`, `DasChannelAccessor`, `DasModuleChannelAccessor`).
#### External Dependencies (inferred):
- `DTS.Slice.Control.Module` and `Module.Channel`
Referenced as value types in `DasModuleAccessor` and `DasChannelAccessor`. Must be defined elsewhere in the `DTS.Slice.Control` namespace.
- `DTS.Common.Utilities`
Core utilities library (contains `ExceptionalDictionary`, `Property<T>`, `Strings`).
#### What Depends on This Module?
- Any code that consumes `Event` objects and needs to access channel/module data by DAS identifiers (e.g., event processing, analysis, or reporting modules).
- Likely used in serialization/deserialization logic for `Event` (given `SerializationPlus` in namespace path).
---
### 5. **Gotchas**
- **Ambiguous Integer Keys**:
- `ChannelAccessor` uses `int` as key for channel number, and `ModuleChannelAccessor` uses `int` as key for module ID. These are *not* strongly typed (e.g., no `DAS.Module.Id` or `DAS.Module.Channel.Id`), despite comments (`xxx change this int to ...`) suggesting future refactoring. This risks confusion or misuse if module/channel IDs overlap or are misinterpreted.
- **No Public Setters or Initialization Logic Visible**:
- All accessor types have only parameterless constructors. It is unclear how they are populated (likely via internal logic in the parent `Event` class). Consumers must assume they are constructed and filled by the `Event` constructor.
- **`TestInformation` is `private sealed class`**:
- Not exposed outside `Event`, so external code cannot instantiate or inspect it directly. Only accessible via `Event`s public surface (not shown here).
- **Missing Context on `ExceptionalDictionary` Behavior**:
- Since all types inherit from `ExceptionalDictionary`, behavior for missing keys (e.g., exceptions, defaults) depends on that base class. Without its source, exact runtime behavior is unknown.
- **No Documentation for `Module` or `Module.Channel` Types**:
- The types `Module` and `Module.Channel` are used as value types but not defined here. Their structure and relationship to DAS IDs is critical for correct usage but not documented in this module.
- **Historical Quirk in Comments**:
- All files include `// *** see DTS.Slice.Control.Event.cs ***`, indicating these are fragments of a larger file split for maintainability. This may complicate navigation for new developers.
None identified beyond the above.