This repository was archived by the owner on Jul 22, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
include/rmf_traffic/schedule Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,17 @@ class StubbornNegotiator : public Negotiator
45
45
// / The Participant who wants to be stubborn.
46
46
StubbornNegotiator (const Participant& participant);
47
47
48
+ // / Owning Constructor
49
+ // /
50
+ // / The StubbornNegotiator instance will now hold a shared reference to the
51
+ // / participant to ensure it maintains its lifetime. This constructor should
52
+ // / be used in cases where the StubbornNegotiator instance has a prolonged
53
+ // / lifecycle.
54
+ // /
55
+ // / \param[in] participant
56
+ // / The Participant who wants to be stubborn.
57
+ StubbornNegotiator (std::shared_ptr<const Participant> participant);
58
+
48
59
void respond (
49
60
const schedule::Negotiation::Table::ViewerPtr& table_viewer,
50
61
const ResponderPtr& responder) final ;
Original file line number Diff line number Diff line change @@ -27,12 +27,23 @@ class StubbornNegotiator::Implementation
27
27
public:
28
28
29
29
const Participant* participant;
30
+ std::shared_ptr<const Participant> shared_ref;
30
31
31
32
};
32
33
33
34
// ==============================================================================
34
35
StubbornNegotiator::StubbornNegotiator (const Participant& participant)
35
- : _pimpl(rmf_utils::make_impl<Implementation>(Implementation{&participant}))
36
+ : _pimpl(rmf_utils::make_impl<Implementation>(
37
+ Implementation{&participant, nullptr }))
38
+ {
39
+ // Do nothing
40
+ }
41
+
42
+ // ==============================================================================
43
+ StubbornNegotiator::StubbornNegotiator (
44
+ std::shared_ptr<const Participant> participant)
45
+ : _pimpl(rmf_utils::make_impl<Implementation>(
46
+ Implementation{participant.get (), participant}))
36
47
{
37
48
// Do nothing
38
49
}
You can’t perform that action at this time.
0 commit comments