Skip to content

Commit

Permalink
Merge branch 'main' into safer_phase_switch
Browse files Browse the repository at this point in the history
  • Loading branch information
mxgrey authored Mar 1, 2024
2 parents b828890 + cf29dbd commit 9693cf0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
15 changes: 13 additions & 2 deletions rmf_task/include/rmf_task/Task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,15 @@ class Task::Booking
///
/// \param[in] automatic
/// Whether this booking was automatically generated
///
/// \param[in] labels
/// Labels to describe the purpose of the task dispatch request.
Booking(
std::string id,
rmf_traffic::Time earliest_start_time,
ConstPriorityPtr priority,
bool automatic = false);
bool automatic = false,
const std::vector<std::string>& labels = {});

/// Constructor
///
Expand All @@ -105,13 +109,17 @@ class Task::Booking
/// \param[in] automatic
/// Whether this booking was automatically generated, default value as
/// false.
///
/// \param[in] labels
/// Labels to describe the purpose of the task dispatch request.
Booking(
std::string id,
rmf_traffic::Time earliest_start_time,
ConstPriorityPtr priority,
const std::string& requester,
rmf_traffic::Time request_time,
bool automatic = false);
bool automatic = false,
const std::vector<std::string>& labels = {});

/// The unique id for this booking.
const std::string& id() const;
Expand All @@ -133,6 +141,9 @@ class Task::Booking
// Returns true if this booking was automatically generated.
bool automatic() const;

/// Get the labels that describe the purpose of the task dispatch request.
std::vector<std::string> labels() const;

class Implementation;
private:
rmf_utils::impl_ptr<Implementation> _pimpl;
Expand Down
15 changes: 13 additions & 2 deletions rmf_task/src/rmf_task/Task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@ class Task::Booking::Implementation
std::optional<std::string> requester;
std::optional<rmf_traffic::Time> request_time;
bool automatic;
std::vector<std::string> labels;
};

//==============================================================================
Task::Booking::Booking(
std::string id,
rmf_traffic::Time earliest_start_time,
ConstPriorityPtr priority,
bool automatic)
bool automatic,
const std::vector<std::string>& labels)
: _pimpl(rmf_utils::make_impl<Implementation>(
Implementation{
std::move(id),
Expand All @@ -47,6 +49,7 @@ Task::Booking::Booking(
std::nullopt,
std::nullopt,
automatic,
labels,
}))
{
// Do nothing
Expand All @@ -59,7 +62,8 @@ Task::Booking::Booking(
ConstPriorityPtr priority,
const std::string& requester,
rmf_traffic::Time request_time,
bool automatic)
bool automatic,
const std::vector<std::string>& labels)
: _pimpl(rmf_utils::make_impl<Implementation>(
Implementation{
std::move(id),
Expand All @@ -68,6 +72,7 @@ Task::Booking::Booking(
requester,
std::move(request_time),
automatic,
labels,
}))
{
// Do nothing
Expand Down Expand Up @@ -109,6 +114,12 @@ bool Task::Booking::automatic() const
return _pimpl->automatic;
}

//==============================================================================
std::vector<std::string> Task::Booking::labels() const
{
return _pimpl->labels;
}

//==============================================================================
class Task::Tag::Implementation
{
Expand Down

0 comments on commit 9693cf0

Please sign in to comment.