File tree Expand file tree Collapse file tree 3 files changed +2
-24
lines changed
Expand file tree Collapse file tree 3 files changed +2
-24
lines changed Original file line number Diff line number Diff line change @@ -124,10 +124,8 @@ struct ModuleService::ServiceImpl : viam::module::v1::ModuleService::Service {
124124 }
125125
126126 // if the type isn't reconfigurable by default, replace it
127- try {
128- Stoppable::stop_if_stoppable (res);
129- } catch (const std::exception& err) {
130- VIAM_SDK_LOG (error) << " unable to stop resource: " << err.what ();
127+ if (auto stoppable = std::dynamic_pointer_cast<Stoppable>(res)) {
128+ stoppable->stop ();
131129 }
132130
133131 const std::shared_ptr<const ModelRegistration> reg =
Original file line number Diff line number Diff line change @@ -6,13 +6,5 @@ namespace sdk {
66Stoppable::~Stoppable () = default ;
77Stoppable::Stoppable () = default ;
88
9- void Stoppable::stop_if_stoppable (const std::shared_ptr<Resource>& resource,
10- const ProtoStruct& extra) {
11- auto stoppable_res = std::dynamic_pointer_cast<Stoppable>(resource);
12- if (stoppable_res) {
13- stoppable_res->stop (extra);
14- }
15- }
16-
179} // namespace sdk
1810} // namespace viam
Original file line number Diff line number Diff line change @@ -17,18 +17,6 @@ class Stoppable {
1717 return stop ({});
1818 }
1919
20- // / @brief Stops a Resource if it is Stoppable.
21- // / @param resource The Resource to stop.
22- // / @param extra Extra arguments to pass to the resource's `stop` method.
23- static void stop_if_stoppable (const std::shared_ptr<Resource>& resource,
24- const ProtoStruct& extra);
25-
26- // / @brief Stops a Resource if it is Stoppable.
27- // / @param resource The Resource to stop.
28- inline static void stop_if_stoppable (const std::shared_ptr<Resource>& resource) {
29- return stop_if_stoppable (resource, {});
30- }
31-
3220 protected:
3321 explicit Stoppable ();
3422};
You can’t perform that action at this time.
0 commit comments