Class Query

Nested Relationships

Nested Types

Class Documentation

class Query

A class to define a query into a schedule database.

Public Types

template<typename E, typename I, typename F>
using base_iterator = rmf_traffic::detail::bidirectional_iterator<E, I, F>

Public Functions

Spacetime &spacetime()

Get the Spacetime component of this Query.

const Spacetime &spacetime() const

const-qualified spacetime()

Participants &participants()

Get the Participants component of this Query.

const Participants &participants() const

const-qualified participants()

class Participants

A class to describe a filter on which schedule participants to pay attention to.

Public Types

enum class Mode : uint16_t

Values:

enumerator Invalid

Invalid mode, behavior is undefined.

enumerator All

Get all participants.

enumerator Include

Get only the participants listed.

enumerator Exclude

Get all participants except the ones listed.

Public Functions

Participants()

Default constructor, uses All mode.

Mode get_mode() const

Get the mode for this Participants filter.

All *all()

Get the All interface if this Participants filter is in All mode, otherwise get a nullptr.

const All *all() const

const-qualified all()

Include *include()

Get the Include interface if this Participants filter is in Include mode, otherwise get a nullptr.

const Include *include() const

const-qualified include()

Participants &include(std::vector<ParticipantId> ids)

Change this filter to Include mode, and include the specified participant IDs.

Exclude *exclude()

Get the Exclude interface if this Participants filter is in Exclude mode, otherwise get a nullptr.

const Exclude *exclude() const

const-qualified exclude()

Participants &exclude(std::vector<ParticipantId> ids)

Change this filter to Exclude mode, and exclude the specified participant IDs.

Public Static Functions

static const Participants &make_all()

Constructor to use All mode.

static Participants make_only(std::vector<ParticipantId> ids)

Constructor to use Include mode.

Parameters:

ids[in] The IDs of the participants that should be included in the query.

static Participants make_all_except(std::vector<ParticipantId> ids)

Constructor to use Exclude mode.

Parameters:

ids[in] The IDs of the participants that should be excluded from the query.

class All

This is a placeholder class in case we ever want to extend the features of the All mode.

class Exclude

The interface for the Participants::Exclude mode.

Public Functions

Exclude(std::vector<ParticipantId> ids)

Constructor.

const std::vector<ParticipantId> &get_ids() const

Get the IDs of the participants that should be excluded.

Exclude &set_ids(std::vector<ParticipantId> ids)

Set the IDs of the participants that should be excluded.

class Include

The interface for the Participants::Include mode.

Public Functions

Include(std::vector<ParticipantId> ids)

Constructor.

const std::vector<ParticipantId> &get_ids() const

Get the IDs of the participants that should be included.

Include &set_ids(std::vector<ParticipantId> ids)

Set the IDs of the participants that should be included.

class Spacetime

A class to describe spacetime filters for a schedule Query.

Public Types

enum class Mode : uint16_t

This enumerator determines what Spacetime mode the query will be in.

Values:

enumerator Invalid

Invalid mode, behavior is undefined.

enumerator All

Request trajectories throughout all of space and time. This will still be constrained by the version field.

enumerator Regions

Request trajectories in specific regions spacetime regions.

enumerator Timespan

Request trajectories that are active in a specified timespan.

using Space = geometry::Space

Public Functions

Spacetime()

Default constructor, uses All mode.

Spacetime(std::vector<Region> regions)

Regions mode constructor.

Parameters:

regions[in] The regions to use

Spacetime(std::vector<std::string> maps)

Timespan mode constructor.

This will query all trajectories across all time for the specified maps.

Parameters:

maps[in] The maps to query from

Spacetime(std::vector<std::string> maps, Time lower_bound)

Timespan mode constructor.

This will query all trajectories that have at least one waypoint active after the lower bound on the specified maps.

Parameters:
  • maps[in] The maps to query from

  • lower_bound[in] The lower bound on time

Spacetime(std::vector<std::string> maps, Time lower_bound, Time upper_bound)

Timespan mode constructor.

This will query all trajectories that have at least one waypoint active after the lower bound and before the upper bound on the specified maps.

Parameters:
  • maps[in] The maps to query from

  • lower_bound[in] The lower bound on time

  • upper_bound[in] The upper bound on time

Mode get_mode() const

Get the current Spacetime Mode of this query.

All &query_all()

Set the mode of this Spacetime to query for All Trajectories throughout Spacetime.

Regions &query_regions(std::vector<Region> regions = {})

Set the mode of this Spacetime to query for specific Regions.

Parameters:

regions[in] Specify the regions of Spacetime to use.

Regions *regions()

Get the Regions of Spacetime to use for this Query. If this Spacetime is not in Regions mode, then this will return a nullptr.

const Regions *regions() const

const-qualified regions()

Timespan &query_timespan(std::vector<std::string> maps, Time lower_bound, Time upper_bound)

Query a timespan between two bounds for a set of maps.

Timespan &query_timespan(std::vector<std::string> maps, Time lower_bound)

Query from a lower bound in time for a set of maps.

Timespan &query_timespan(std::vector<std::string> maps)

Query for all trajectories on a set of maps.

Timespan &query_timespan(bool query_all_maps = true)

Switch to timespan mode, and specify whether or not to use all maps.

Timespan *timespan()

Get the Timespan of Spacetime to use for this Query. If this Spacetime is not in Timespan mode, then this will return a nullptr.

const Timespan *timespan() const

const-qualified timespan()

class All

This is a placeholder class in case we ever want to extend the features of the All mode.

class Regions

A container class for rmf_traffic::Region instances. Using Regions mode will query for Trajectories that intersect the specified regions.

Public Types

using iterator = base_iterator<Region, IterImpl, Regions>
using const_iterator = base_iterator<const Region, IterImpl, Regions>

Public Functions

void push_back(Region region)

Add a Region to this container.

void pop_back()

Remove the last Region that was added to this container.

iterator erase(iterator it)

Erase a Region based on its iterator.

iterator erase(iterator first, iterator last)

Erase a range of Regions based on their iterators.

iterator begin()

Get the beginning iterator of this container.

const_iterator begin() const

const-qualified begin()

const_iterator cbegin() const

Explicitly const-qualified alternative to begin()

iterator end()

Get the one-past-the-end iterator of this container.

const_iterator end() const

const-qualified end()

const_iterator cend() const

Explicitly const-qualified alternative to end()

std::size_t size() const

Get the number of Spacetime Region elements in this container.

class Timespan

A class for specifying a timespan.

Public Functions

const std::unordered_set<std::string> &maps() const

Get the maps that will be queried.

Timespan &add_map(std::string map_name)

Add a map to the query.

Timespan &remove_map(const std::string &map_name)

Remove a map from the query.

Timespan &clear_maps()

Remove all maps from the query.

bool all_maps() const

Returns true if all maps should be queried. If true, the set of maps mentioned above will be ignored.

Timespan &all_maps(bool query_all_maps)

Set whether all maps should be queried. When true, the set of maps above will be ignored. When false, only the maps in the set above will be included in the query.

const Time *get_lower_time_bound() const

Get the lower bound for the time range.

If there is no lower bound for the time range, then this returns a nullptr.

Timespan &set_lower_time_bound(Time time)

Set the lower bound fore the time range.

Timespan &remove_lower_time_bound()

Remove the lower bound for the time range.

const Time *get_upper_time_bound() const

Get the upper bound for the time range.

If there is no upper bound for the time range, then this returns a nullptr.

Timespan &set_upper_time_bound(Time time)

Set the upper bound for the time range.

Timespan &remove_upper_time_bound()

Remove the upper bound for the time range.