Files
2026-04-17 14:55:32 -04:00

57 lines
4.3 KiB
Markdown

---
source_files:
- Common/DTS.Common.Serialization/TestSetup/Graph/Graph.cs
- Common/DTS.Common.Serialization/TestSetup/Graph/Channel.cs
generated_at: "2026-04-17T16:26:22.110592+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "1596815b04ddd43d"
---
# Graph
### Purpose
This module defines the data structure for a `TestSetup.Graph` and its nested `Channel` objects. It serves as a serialization-compatible model for test configurations, wrapping properties in a custom `Property` construct (likely for change tracking or validation) and exposing metadata about test channels, hardware associations, and versioning. It acts as a bridge between raw test module definitions and serialized storage formats.
### Public Interface
**Class: `TestSetup.Graph`**
* `Graph()` - Constructor. Initializes `Name` to null, `Version` to "1.0.0.0", and generates a new `Identifier`.
* `void UnSet()` - No-op implementation in current source.
* `List<Channel> Channels` - Gets or sets the list of channels associated with this graph.
* `string Name` - Gets or sets the name of the graph.
* `string HardwareChannelName` - Gets or sets the hardware channel name.
* `string DisplayName` - Read-only. Returns `_Name.Value + "_" + _HardwareChannelName.Value`.
* `string Version` - Gets or sets the version string.
* `bool IsSingleChannelGraph` - (XmlIgnore) Returns true if `Channels` is not null and contains exactly one channel.
* `Channel FirstChannel` - (XmlIgnore) Returns the first channel in the `Channels` list.
* `Test.Module.Channel FirstTestChannel` - (XmlIgnore) Returns the `TestChannel` property of the first channel in the list.
* `Guid Identifier` - (XmlIgnore) Gets a unique identifier for this graph instance; set privately by constructor.
**Class: `TestSetup.Graph.Channel`**
* `Channel(Test.Module.Channel channel)` - Constructor. Initializes the channel from a `Test.Module.Channel` object.
* `Channel(string channelId)` - Constructor. Initializes with a specific string ID; sets `ParentTestModule` and `TestChannel` to null.
* `Channel(long groupChannelId)` - Constructor. Initializes with a long ID converted to string; sets `ParentTestModule` and `TestChannel` to null.
* `string ChannelId` - Gets or sets the unique ID for the logical channel.
* `string ChannelGroupName` - Gets or sets the group name.
* `string Name` - Read-only. Returns `TestChannel.ChannelDescriptionString` or "Not Set".
* `string SensorName` - (XmlIgnore) Returns `TestChannel.ChannelDescriptionString` or "Not Set".
* `string AxisUnit` - (XmlIgnore) Returns engineering units if `TestChannel` is an `AnalogInputChannel`, otherwise "EU".
* `string SerialNumber` - (XmlIgnore) Returns `ParentTestModule.SerialNumber` or "Not Set".
* `Test.Module ParentTestModule` - (XmlIgnore) Field holding a reference to the parent test module.
* `Test.Module.Channel TestChannel` - (XmlIgnore) Field holding a reference to the underlying test channel.
### Invariants
* `Graph.Identifier` is immutable after construction (private setter).
* `Graph.Version` defaults to "1.0.0.0" upon instantiation.
* `Channel` has a private parameterless constructor, enforcing that instances must be created via one of the public constructors providing data.
* `Channel.Name`, `SensorName`, `AxisUnit`, and `SerialNumber` all return "Not Set" (or "EU" for units) if `TestChannel` is null.
### Dependencies
* **Depends on**: `System`, `System.Collections.Generic`, `DTS.Common.Utilities`, `DTS.Common.Utilities.DotNetProgrammingConstructs`, `Test.Module` (referenced in `Channel` constructors and properties).
* **Dependents**: Unknown from source alone, but likely serialization logic or test setup management components.
### Gotchas
* **Indexing Risks**: The properties `FirstChannel` and `FirstTestChannel` access `Channels[0]` directly without bounds checking. If `Channels` is null or empty, this will throw an exception.
* **DisplayName Format**: `DisplayName` concatenates values with an underscore. If `_Name.Value` is null (the default), the result will start with an underscore (e.g., `_HardwareName`).
* **Internal Property Wrappers**: Public properties are backed by `Property` objects. The behavior of these wrappers (e.g., validation logic) is defined in `DTS.Common.Utilities.DotNetProgrammingConstructs` and is not visible here.