FastLED 3.9.15
Loading...
Searching...
No Matches
response_aware_traits.h
Go to the documentation of this file.
1#pragma once
2
4
5namespace fl {
6
7// Forward declaration
8class ResponseSend;
9
10// =============================================================================
11// ResponseAware Traits - Detect and strip ResponseSend& from function signatures
12// =============================================================================
13
38
39// =============================================================================
40// Primary template: Not response-aware
41// =============================================================================
42
43template<typename Sig>
45 static constexpr bool is_response_aware = false;
46 using signature = Sig; // Original signature
47};
48
49// =============================================================================
50// Specialization for response-aware signatures: R(ResponseSend&, Args...)
51// =============================================================================
52
53template<typename R, typename... Args>
55 static constexpr bool is_response_aware = true;
56 using signature = R(Args...); // Stripped signature (without ResponseSend&)
57 using full_signature = R(ResponseSend&, Args...); // Original signature
58};
59
60// =============================================================================
61// Specialization for function pointers: R(*)(ResponseSend&, Args...)
62// =============================================================================
63
64template<typename R, typename... Args>
65struct response_aware_signature<R(*)(ResponseSend&, Args...)> {
66 static constexpr bool is_response_aware = true;
67 using signature = R(Args...); // Stripped signature
68 using full_signature = R(ResponseSend&, Args...); // Original signature
69};
70
71// =============================================================================
72// Helper to check if a type is ResponseSend (any cv-qualification or reference)
73// =============================================================================
74
75template<typename T>
77
78template<>
80
81template<>
83
84template<>
86
87template<>
89
90} // namespace fl
Helper class for sending responses in async/streaming RPC methods.
integral_constant< bool, true > true_type
Definition s16x16x4.h:27
integral_constant< bool, false > false_type
Definition s16x16x4.h:28
Base definition for an LED controller.
Definition crgb.hpp:179
static constexpr bool is_response_aware
Type trait to detect if a function signature has ResponseSend& as first parameter.