@@ -139,16 +139,16 @@ class TreeNode
139139
140140 void haltNode ();
141141
142- bool isHalted () const ;
142+ [[nodiscard]] bool isHalted () const ;
143143
144- NodeStatus status () const ;
144+ [[nodiscard]] NodeStatus status () const ;
145145
146146 // / Name of the instance, not the type
147- const std::string& name () const ;
147+ [[nodiscard]] const std::string& name () const ;
148148
149149 // / Blocking function that will sleep until the setStatus() is called with
150150 // / either RUNNING, FAILURE or SUCCESS.
151- BT::NodeStatus waitValidStatus ();
151+ [[nodiscard]] BT::NodeStatus waitValidStatus ();
152152
153153 virtual NodeType type () const = 0;
154154
@@ -170,7 +170,7 @@ class TreeNode
170170 *
171171 * @return the subscriber handle.
172172 */
173- StatusChangeSubscriber subscribeToStatusChange (StatusChangeCallback callback);
173+ [[nodiscard]] StatusChangeSubscriber subscribeToStatusChange (StatusChangeCallback callback);
174174
175175 /* * This method attaches to the TreeNode a callback with signature:
176176 *
@@ -195,18 +195,18 @@ class TreeNode
195195
196196 // / The unique identifier of this instance of treeNode.
197197 // / It is assigneld by the factory
198- uint16_t UID () const ;
198+ [[nodiscard]] uint16_t UID () const ;
199199
200200 // / Human readable identifier, that includes the hierarchy of Subtrees
201201 // / See tutorial 10 as an example.
202- const std::string& fullPath () const ;
202+ [[nodiscard]] const std::string& fullPath () const ;
203203
204204 // / registrationName is the ID used by BehaviorTreeFactory to create an instance.
205- const std::string& registrationName () const ;
205+ [[nodiscard]] const std::string& registrationName () const ;
206206
207207 // / Configuration passed at construction time. Can never change after the
208208 // / creation of the TreeNode instance.
209- const NodeConfig& config () const ;
209+ [[nodiscard]] const NodeConfig& config () const ;
210210
211211 /* * Read an input port, which, in practice, is an entry in the blackboard.
212212 * If the blackboard contains a std::string and T is not a string,
@@ -223,7 +223,7 @@ class TreeNode
223223 *
224224 * @param key the name of the port.
225225 */
226- template <typename T>
226+ template <typename T> [[nodiscard]]
227227 Expected<T> getInput (const std::string& key) const
228228 {
229229 T out;
@@ -270,24 +270,28 @@ class TreeNode
270270 * @return empty AnyWriteRef if the blackboard entry doesn't exist or the content
271271 * of the port was a static string.
272272 */
273- AnyWriteRef getLockedPortContent (const std::string& key);
273+ [[nodiscard]] AnyPtrWriteLock getLockedPortContent (const std::string& key);
274274
275275 // function provided mostly for debugging purpose to see the raw value
276276 // in the port (no remapping and no conversion to a type)
277- StringView getRawPortValue (const std::string& key) const ;
277+ [[nodiscard]] StringView getRawPortValue (const std::string& key) const ;
278278
279279 // / Check a string and return true if it matches either one of these
280280 // / two patterns: {...} or ${...}
281+ [[nodiscard]]
281282 static bool isBlackboardPointer (StringView str);
282283
284+ [[nodiscard]]
283285 static StringView stripBlackboardPointer (StringView str);
284286
287+ [[nodiscard]]
285288 static Expected<StringView> getRemappedKey (StringView port_name,
286289 StringView remapped_port);
287290
288291 // / Notify that the tree should be ticked again()
289292 void emitWakeUpSignal ();
290293
294+ [[nodiscard]]
291295 bool requiresWakeUp () const ;
292296
293297 /* * Used to inject config into a node, even if it doesn't have the proper
0 commit comments