@@ -53,24 +53,16 @@ class IntrusiveSingleLinkedList
53
53
{
54
54
other.SetNotInList ();
55
55
}
56
- IntrusiveSingleLinkedList (const IntrusiveSingleLinkedList & other) :
57
- mNext ((other.mNext == &other) ? static_cast <SELF *>(this ) : other.mNext )
58
- {}
59
- IntrusiveSingleLinkedList & operator =(const IntrusiveSingleLinkedList & other)
60
- {
61
- if (&other != this )
62
- {
63
- mNext = (other.mNext == &other) ? static_cast <SELF *>(this ) : other.mNext ;
64
- }
65
- return *this ;
66
- }
67
56
IntrusiveSingleLinkedList & operator =(IntrusiveSingleLinkedList && other)
68
57
{
69
58
mNext = (other.mNext == &other) ? static_cast <SELF *>(this ) : other.mNext ;
70
59
other.SetNotInList ();
71
60
return *this ;
72
61
}
73
62
63
+ IntrusiveSingleLinkedList (const IntrusiveSingleLinkedList & other) = delete ;
64
+ IntrusiveSingleLinkedList & operator =(const IntrusiveSingleLinkedList & other) = delete ;
65
+
74
66
// / Determines whether this object is part of a linked list already.
75
67
[[nodiscard]] bool IsInList () const { return (mNext != this ); }
76
68
@@ -85,8 +77,17 @@ class IntrusiveSingleLinkedList
85
77
return mNext ;
86
78
}
87
79
88
- // / Sets the "next" pointer when the SELF is assumed to be
89
- // / part of a SINGLE linked list.
80
+ // / Sets the "next" pointer.
81
+ // /
82
+ // / A `SELF` has a `next` pointer when it is part of a linked list.
83
+ // / `SELF` is only allowed to be part of a SINGLE linked list at
84
+ // / one time (there is only one `next`).
85
+ // /
86
+ // / `value` MUST be an element that already is part of a single linked
87
+ // / list (or nullptr).
88
+ // /
89
+ // / NOTE: the marker of `next == this` is a flag that marks
90
+ // / that `SELF` is not part of a linked list.
90
91
// /
91
92
// / Returns the old value of "next"
92
93
SELF * SetNextListItem (SELF * value)
@@ -107,7 +108,10 @@ class IntrusiveSingleLinkedList
107
108
108
109
} // namespace detail
109
110
110
- // / Defines an active cluster on an endpoint.
111
+ // / Handles cluster interactions for a specific cluster id.
112
+ // /
113
+ // / A `ServerClusterInterface` is generally associated with a single endpoint id and represents
114
+ // / a cluster that exists at a given `endpoint_id/cluster_id` path.
111
115
// /
112
116
// / Provides metadata as well as interaction processing (attribute read/write and command handling).
113
117
// /
@@ -122,16 +126,16 @@ class ServerClusterInterface : public detail::IntrusiveSingleLinkedList<ServerCl
122
126
ServerClusterInterface () = default ;
123
127
virtual ~ServerClusterInterface () = default ;
124
128
125
- ServerClusterInterface (const ServerClusterInterface & other) = default ;
126
129
ServerClusterInterface (ServerClusterInterface && other) = default ;
127
- ServerClusterInterface & operator =(const ServerClusterInterface & other) = default ;
128
130
ServerClusterInterface & operator =(ServerClusterInterface && other) = default ;
129
131
132
+ ServerClusterInterface (const ServerClusterInterface & other) = delete ;
133
+ ServerClusterInterface & operator =(const ServerClusterInterface & other) = delete ;
134
+
130
135
// /////////////////////////////////// Cluster Metadata Support //////////////////////////////////////////////////
131
136
[[nodiscard]] virtual ClusterId GetClusterId () const = 0;
132
137
133
- // Every cluster instance must have a data version. Base class implementation to avoid
134
- // code duplication
138
+ // Every cluster instance must have a data version.
135
139
//
136
140
// SPEC - 7.10.3. Cluster Data Version
137
141
// A cluster data version is a metadata increment-only counter value, maintained for each cluster instance.
@@ -144,19 +148,19 @@ class ServerClusterInterface : public detail::IntrusiveSingleLinkedList<ServerCl
144
148
//
145
149
[[nodiscard]] virtual DataVersion GetDataVersion () const = 0;
146
150
147
- // / Cluster flags can be overridden, however most clusters likely have a default of "nothing special".
148
- // /
149
- // / Default implementation returns a 0/empty quality list.
150
151
[[nodiscard]] virtual BitFlags<DataModel::ClusterQualityFlags> GetClusterFlags () const = 0;
151
152
152
153
// /////////////////////////////////// Attribute Support ////////////////////////////////////////////////////////
153
154
154
- // / ReadAttribute MUST be done on a valid attribute path. `request.path` is expected to have `GetClusterId` as the cluster
155
- // / id as well as an attribute that is included in a `Attributes` call.
155
+ // / ReadAttribute MUST be done on an "existent" attribute path: only on attributes that are
156
+ // / returned in an `Attributes` call for this cluster.
157
+ // /
158
+ // / `request.path` is expected to have `GetClusterId` as the cluster id as well as an attribute that is
159
+ // / included in a `Attributes` call.
156
160
// /
157
161
// / This MUST HANDLE the following global attributes:
158
- // / - FeatureMap::Id - generally 0 as a default
159
- // / - ClusterRevision::Id - this is implementation defined
162
+ // / - FeatureMap::Id
163
+ // / - ClusterRevision::Id
160
164
// /
161
165
// / This function WILL NOT be called for attributes that can be built out of cluster metadata.
162
166
// / Specifically this WILL NOT be called (and does not need to implement handling for) the
@@ -167,8 +171,11 @@ class ServerClusterInterface : public detail::IntrusiveSingleLinkedList<ServerCl
167
171
virtual DataModel::ActionReturnStatus ReadAttribute (const DataModel::ReadAttributeRequest & request,
168
172
AttributeValueEncoder & encoder) = 0;
169
173
170
- // / WriteAttribute MUST be done on a valid attribute path. `request.path` is expected to have `GetClusterId` as the cluster
171
- // / id as well as an attribute that is included in a `Attributes` call.
174
+ // / WriteAttribute MUST be done on an "existent" attribute path: only on attributes that are
175
+ // / returned in an `Attributes` call for this cluster.
176
+ // /
177
+ // / `request.path` is expected to have `GetClusterId` as the cluster id as well as an attribute that is
178
+ // / included in a `Attributes` call.
172
179
virtual DataModel::ActionReturnStatus WriteAttribute (const DataModel::WriteAttributeRequest & request,
173
180
AttributeValueDecoder & decoder) = 0;
174
181
0 commit comments