63#if QW_CONCEPTS_AVAILABLE
75concept HasTypeSpecificUpdateErrorFlag =
requires(T& obj,
const T& other) {
76 { obj.UpdateErrorFlag(&other) } -> std::same_as<void>;
86concept HasPolymorphicUpdateErrorFlag =
requires(T& obj,
const VQwDataElement* base_ptr) {
87 { obj.UpdateErrorFlag(base_ptr) } -> std::same_as<void>;
98concept ImplementsDualOperatorUpdateErrorFlag =
99 HasTypeSpecificUpdateErrorFlag<T> &&
100 HasPolymorphicUpdateErrorFlag<T>;
113concept HasTypeSpecificArithmetic =
requires(T& obj,
const T& other) {
114 { obj += other } -> std::same_as<T&>;
115 { obj -= other } -> std::same_as<T&>;
116 { obj.Sum(other, other) } -> std::same_as<void>;
117 { obj.Difference(other, other) } -> std::same_as<void>;
118 { obj.Ratio(other, other) } -> std::same_as<T&>;
127concept HasPolymorphicArithmetic =
requires(T& obj,
const VQwDataElement& base) {
128 { obj += base } -> std::same_as<VQwDataElement&>;
129 { obj -= base } -> std::same_as<VQwDataElement&>;
130 { obj.Sum(base, base) } -> std::same_as<void>;
131 { obj.Difference(base, base) } -> std::same_as<void>;
132 { obj.Ratio(base, base) } -> std::same_as<VQwDataElement&>;
139concept ImplementsDualOperatorArithmetic =
140 HasTypeSpecificArithmetic<T> &&
141 HasPolymorphicArithmetic<T>;
155concept HasTypeSpecificEventCutsAndDiagnostics =
requires(T& obj,
const T* other) {
156 { obj.SetSingleEventCuts(0U, 0.0, 0.0, 0.0) } -> std::same_as<void>;
157 { obj.CheckForBurpFail(other) } -> std::same_as<bool>;
166concept HasPolymorphicEventCutsAndDiagnostics =
requires(T& obj,
const VQwDataElement* base) {
167 { obj.SetSingleEventCuts(0U, 0.0, 0.0, 0.0) } -> std::same_as<void>;
168 { obj.CheckForBurpFail(base) } -> std::same_as<bool>;
175concept ImplementsDualOperatorEventCutsAndDiagnostics =
176 HasTypeSpecificEventCutsAndDiagnostics<T> &&
177 HasPolymorphicEventCutsAndDiagnostics<T>;
190concept SpecializedBaseWithPolymorphicUpdateErrorFlag = std::is_abstract_v<T> &&
191 requires(T& obj,
const T* typed_ptr) {
192 { obj.UpdateErrorFlag(typed_ptr) } -> std::same_as<void>;
202concept SpecializedBaseWithPolymorphicCheckForBurpFail = std::is_abstract_v<T> &&
203 requires(T& obj,
const T* typed_ptr) {
204 { obj.CheckForBurpFail(typed_ptr) } -> std::same_as<bool>;
211concept ImplementsSpecializedBasePattern =
212 SpecializedBaseWithPolymorphicUpdateErrorFlag<T> &&
213 SpecializedBaseWithPolymorphicCheckForBurpFail<T>;
236concept ImplementsContainerDelegationPattern =
requires(T& obj,
const T& other) {
238 { obj += other } -> std::same_as<T&>;
239 { obj -= other } -> std::same_as<T&>;
240 { obj.Sum(other, other) } -> std::same_as<void>;
251concept ImplementsPolymorphicSubsystemPattern =
requires(T& obj,
VQwSubsystem* other) {
253 { obj += other } -> std::same_as<VQwSubsystem&>;
254 { obj -= other } -> std::same_as<VQwSubsystem&>;
255 { obj.Sum(other, other) } -> std::same_as<void>;
265struct IsContainerClass {
266 static constexpr bool value =
false;
272 static constexpr bool value =
true;
277 static constexpr bool value =
true;
292concept ValidVQwDataElementDerivative =
293 std::is_base_of_v<VQwDataElement, T> &&
294 !std::is_abstract_v<T> &&
295 ImplementsDualOperatorArithmetic<T> &&
296 ImplementsDualOperatorUpdateErrorFlag<T> &&
297 ImplementsDualOperatorEventCutsAndDiagnostics<T>;
306concept ValidVQwHardwareChannelDerivative =
307 std::is_base_of_v<VQwHardwareChannel, T> &&
308 !std::is_abstract_v<T> &&
309 ValidVQwDataElementDerivative<T>;
318concept ValidSpecializedBase =
319 std::is_abstract_v<T> &&
320 std::is_base_of_v<VQwDataElement, T> &&
321 ImplementsSpecializedBasePattern<T>;
329concept ValidContainerClass =
330 ImplementsContainerDelegationPattern<T>;
338concept ValidPolymorphicSubsystem =
339 std::is_base_of_v<VQwSubsystem, T> &&
340 !std::is_abstract_v<T> &&
341 ImplementsPolymorphicSubsystemPattern<T>;
350concept ValidSubsystemClass =
351 (IsContainerClass<T>::value && ValidContainerClass<T>) ||
352 (!IsContainerClass<T>::value && ValidPolymorphicSubsystem<T>);
368#if QW_CONCEPTS_AVAILABLE
369#define VALIDATE_DATA_ELEMENT_PATTERN(ClassName) \
370 static_assert(QwArchitecture::ValidVQwDataElementDerivative<ClassName>, \
371 #ClassName " must implement complete Dual-Operator Pattern for all required methods. " \
372 "See copilot-instructions.md for implementation requirements. " \
373 "(C++20 concept validation active)"); \
374 static_assert(QwArchitecture::HasTypeSpecificUpdateErrorFlag<ClassName>, \
375 #ClassName " must implement type-specific UpdateErrorFlag(const " #ClassName "*) " \
376 "(C++20 concept validation active)"); \
377 static_assert(QwArchitecture::HasPolymorphicUpdateErrorFlag<ClassName>, \
378 #ClassName " must implement polymorphic delegator UpdateErrorFlag(const VQwDataElement*) " \
379 "(C++20 concept validation active)"); \
380 static_assert(QwArchitecture::HasTypeSpecificArithmetic<ClassName>, \
381 #ClassName " must implement type-specific arithmetic operators (+=, -=, Sum, Difference, Ratio) " \
382 "(C++20 concept validation active)"); \
383 static_assert(QwArchitecture::HasPolymorphicArithmetic<ClassName>, \
384 #ClassName " must implement polymorphic arithmetic delegators " \
385 "(C++20 concept validation active)"); \
386 static_assert(QwArchitecture::ImplementsDualOperatorEventCutsAndDiagnostics<ClassName>, \
387 #ClassName " must implement SetSingleEventCuts and CheckForBurpFail patterns " \
388 "(C++20 concept validation active)");
390#define VALIDATE_DATA_ELEMENT_PATTERN(ClassName) \
392 static_assert(true, #ClassName " architectural requirements documented (upgrade to C++20 for validation)");
402#if QW_CONCEPTS_AVAILABLE
403#define VALIDATE_DATA_HANDLER_PATTERN(ClassName) \
404 static_assert(std::is_base_of_v<VQwDataHandler, ClassName>, \
405 #ClassName " must inherit from VQwDataHandler for factory registration. " \
406 "(C++20 concept validation active)");
408#define VALIDATE_DATA_HANDLER_PATTERN(ClassName) \
410 static_assert(true, #ClassName " data handler requirements documented (upgrade to C++20 for validation)");
416#if QW_CONCEPTS_AVAILABLE
417#define VALIDATE_SUBSYSTEM_PATTERN(ClassName) \
418 static_assert(QwArchitecture::ValidSubsystemClass<ClassName>, \
419 #ClassName " must implement appropriate subsystem pattern. Containers use Container-Delegation, " \
420 "regular subsystems use Polymorphic Subsystem patterns. " \
421 "(C++20 concept validation active)");
423#define VALIDATE_SUBSYSTEM_PATTERN(ClassName) \
425 static_assert(true, #ClassName " subsystem requirements documented (upgrade to C++20 for validation)");