8.7 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-16T03:41:07.285794+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 54ff68752851044a |
Graph
Documentation: DTS.Serialization.Graph and DTS.Serialization.Graph.Channel
1. Purpose
This module defines core serialization-friendly data structures (Graph and Channel) used to represent test setup configurations in the DTS (Dynamic Test System) framework. The Graph class encapsulates a test configuration as a named, versioned container of one or more Channel instances, each representing a logical test channel tied to either a live Test.Module.Channel object or a placeholder for deserialization scenarios. These classes are designed for XML serialization (evidenced by use of XmlIgnoreAttribute) and serve as a lightweight, serializable abstraction layer over the richer, runtime Test.Module domain model—enabling persistence, transmission, or reconstruction of test setups without coupling to the full test execution engine.
2. Public Interface
DTS.Serialization.TestSetup.Graph
-
Graph()
Default constructor. Initializes_Version.Valueto"1.0.0.0", sets_Name.Valuetonull, and assigns a newGuidtoIdentifier. -
void UnSet()
No-op method (empty implementation). Purpose unclear from source. -
List<Channel> Channels { get; set; }
Gets or sets the list of channels in this graph. Initialized to an empty list by default. -
string Name { get; set; }
Gets or sets the graph’s logical name. Defaults to"". -
string HardwareChannelName { get; set; }
Gets or sets a hardware-specific channel name (e.g., physical port label). Defaults to"". -
string DisplayName { get; }
Computed property: concatenatesNameandHardwareChannelNamewith an underscore (Name + "_" + HardwareChannelName). May yield"_"if both are empty. -
string Version { get; set; }
Gets or sets the graph version string. Note: Constructor sets_Version.Value = "1.0.0.0", but the backing field_Versionis initialized with""as default—this is overwritten in the constructor. -
override string ToString()
ReturnsName. -
bool IsSingleChannelGraph { get; }
ReturnstrueifChannelsis non-null and contains exactly one element. -
Channel FirstChannel { get; }
Returns the first element inChannels. Unsafe: throwsIndexOutOfRangeExceptionifChannelsis null or empty. -
Test.Module.Channel FirstTestChannel { get; }
ReturnsFirstChannel.TestChannel. Unsafe: throwsIndexOutOfRangeExceptionifChannelsis null/empty, orNullReferenceExceptionifFirstChannel.TestChannelis null. -
Guid Identifier { get; private set; }
Unique identifier for the graph instance. Set only in constructor viaGuid.NewGuid().
DTS.Serialization.TestSetup.Graph.Channel
-
Channel()(private)
Internal constructor. SetsChannelId = "Not Set". Not used externally. -
Channel(Test.Module.Channel channel)
Constructor for wrapping an existing runtimeTest.Module.Channel. Populates:ParentTestModule=channel.ParentModuleTestChannel=channelChannelId=channel.ChannelIdChannelGroupName=channel.ChannelGroupName
Note: ATODOcomment indicates intent to use a unique key (e.g.,Identifier) instead ofHardwareChannelName—but this is not implemented.
-
Channel(string channelId)
Constructor for placeholder channel (e.g., deserialization). SetsParentTestModule = null,TestChannel = null, andChannelId = channelId. -
Channel(long groupChannelId)
Constructor for placeholder channel from numeric ID. SetsParentTestModule = null,TestChannel = null, andChannelId = groupChannelId.ToString(). -
override string ToString()
ReturnsTestChannel.ToString()ifTestChannelis non-null; otherwise"Not Set". -
string ChannelId { get; set; }
Logical channel identifier (e.g.,"TestObjectSerial_ChannelType_ChannelId"). Used as a unique key in practice, though not enforced. -
string ChannelGroupName { get; set; }
Group name for the channel (e.g.,"Axial","Radial"). -
string Name { get; }
ReturnsTestChannel.ChannelDescriptionStringifTestChannelis non-null; otherwise"Not Set". -
string SensorName { get; }
ReturnsTestChannel.ChannelDescriptionString.ToString()ifTestChannelis non-null; otherwise"Not Set".
Note: Redundant withName; likely legacy or for XML serialization compatibility. -
string AxisUnit { get; }
Returns engineering units (AnalogInputChannel.EngineeringUnits) ifTestChannelis anAnalogInputChannel; otherwise"EU". -
string SerialNumber { get; }
ReturnsParentTestModule.SerialNumberifParentTestModuleis non-null; otherwise"Not Set". -
Test.Module ParentTestModule;
Public field referencing the parent test module (e.g., sensor or DAQ device). May benullfor placeholder channels. -
Test.Module.Channel TestChannel;
Public field referencing the underlying runtime channel object. May benullfor placeholder channels.
3. Invariants
Graph.Identifieris assigned exactly once during construction and never modified afterward.Graph.Channelsis nevernullafter construction (initialized tonew List<Channel>()in_Channels).Graph.Versionis initialized to"1.0.0.0"in the constructor, overriding the default""in_Version.Channel.ChannelIdis always set (non-null) and used as a logical identifier, though uniqueness is not enforced by the class.Graph.DisplayNamemay be malformed (e.g.,"_","_" + HardwareChannelName) ifNameis empty or whitespace.Graph.FirstChannelandGraph.FirstTestChannelassumeChannels.Count >= 1; no bounds checking is performed.
4. Dependencies
-
Internal Dependencies:
DTS.Common.Utilities(namespace)DTS.Common.Utilities.DotNetProgrammingConstructs(forProperty<T>wrapper)System,System.Collections.Generic,System.Xml.Serialization
-
External Dependencies:
Test.Module(namespace): referenced viaTest.Module.Channel,Test.Module.ParentTestModule,Test.Module.AnalogInputChannel, andTest.Module.Channel.ChannelDescriptionString.
This implies a hard dependency on theTest.Moduleassembly (likelyDTS.TestModule.dllor similar).Exceptional: Base class for bothGraphandChannel(inherited fromTestSetup.Exceptional).
-
Depended Upon By:
- Serialization infrastructure (e.g., XML serializers, given
[XmlIgnore]usage). - Test setup persistence layers (e.g., saving/loading
.xmltest configurations). - UI or tooling that consumes serialized test setups.
- Serialization infrastructure (e.g., XML serializers, given
5. Gotchas
Graph.FirstChannelandGraph.FirstTestChannelare unsafe: No null/empty checks—accessing them on an emptyChannelslist will throwIndexOutOfRangeException.DisplayNamemay produce misleading output: Concatenation ofNameandHardwareChannelNamewithout trimming or validation can yield"_"or"Name_".Channelconstructors are inconsistent in initialization:Channel(Test.Module.Channel)populatesParentTestModuleandTestChannel.Channel(string)andChannel(long)leave themnull.
Code must check for nullTestChannel/ParentTestModulebefore accessing derived properties (Name,SerialNumber, etc.).
SensorNameduplicatesNamelogic: Both useTestChannel.ChannelDescriptionString, butSensorNamecalls.ToString()explicitly—likely redundant or legacy.HardwareChannelNameis unused inChannelconstructor: TheTODOcomment suggestsIdentifiershould be set fromHardwareChannelName, but this is not implemented.IdentifierremainsGuid.NewGuid()(graph-level), whileChannelhas noIdentifierfield.Channelhas noIdentifierfield: UnlikeGraph,Channellacks a unique ID—relying onChannelId(a string) as a de facto key, but this is not enforced or validated.UnSet()is a no-op: Its purpose is unclear; may be a placeholder for future cleanup or legacy pattern.Property<T>behavior: TheProperty<T>wrapper (fromDotNetProgrammingConstructs) likely handles change notifications or serialization metadata, but its exact semantics (e.g., null handling, validation) are not visible here. Default values ("",new List<Channel>()) are set in field initializers, but constructor overrides (e.g.,Version = "1.0.0.0") may conflict with expectations.