VIPRA Documentation
Loading...
Searching...
No Matches
selector.hpp
1#pragma once
2
3#include "vipra/vipra_behaviors/definitions/behavior_context.hpp"
4#include "vipra/vipra_behaviors/definitions/pedestrian_types.hpp"
5
6#include "vipra/vipra_behaviors/definitions/sim_pack.hpp"
7#include "vipra/vipra_behaviors/selectors/pedestrian_groups.hpp"
8#include "vipra/vipra_behaviors/selectors/subselector.hpp"
9
10namespace VIPRA::Behaviors {
11
16class Selector {
17 DEFAULT_CONSTRUCTIBLE(Selector)
18 COPYABLE(Selector)
19 MOVEABLE(Selector)
20
21 public:
22 void initialize(std::string const& /*behaviorName*/, Simpack pack);
23
24 void set_all_types(Ptype types) { _allTypes = types; }
25 void add_sub_selector(SubSelector const& subselector)
26 {
27 _subSelectors.push_back(subselector);
28 }
29
30 [[nodiscard]] auto get_groups() -> GroupsContainer& { return _pedGroups; }
31 [[nodiscard]] auto get_groups() const -> GroupsContainer const& { return _pedGroups; }
32
33 [[nodiscard]] auto selector_count() const -> VIPRA::size
34 {
35 return _subSelectors.size();
36 }
37
38 private:
39 Ptype _allTypes;
40 std::vector<SubSelector> _subSelectors;
41 GroupsContainer _pedGroups;
42
43 [[nodiscard]] auto select_peds_from_group(SubSelector& /*selector*/, Simpack pack,
44 std::string const& behaviorName)
45 -> VIPRA::idxVec;
46
47 static void check_for_duplicates(const VIPRA::idxVec& order);
48
49 [[nodiscard]] auto order_selectors() -> VIPRA::idxVec;
50 [[nodiscard]] static auto filter_used_peds(
51 const VIPRA::idxVec& /*peds*/, std::vector<bool> const& /*used*/) -> VIPRA::idxVec;
52
53 void run_selectors(const VIPRA::idxVec& /*selectorIdxs*/,
54 std::string const& /*behaviorName*/, auto pack);
55 void update_ped_groups(const VIPRA::idxVec& /*selectedPeds*/, SubSelector& /*selector*/,
56 BehaviorContext& /*context*/, std::string const& /*unused*/);
57 void sort_groups();
58};
59
60} // namespace VIPRA::Behaviors
Holds the indexes for pedestrians in each type group.
Definition pedestrian_groups.hpp:16
Pedestrian Type, used as a composite of typeUIDs.
Definition pedestrian_types.hpp:23
Combines/Organizes SubSelectors to select pedestrians for types.
Definition selector.hpp:16
void initialize(std::string const &, Simpack pack)
Initializes the pedestrian groups, and runs the sub selectors over them.
Definition selector.cpp:15
Selects pedestrians for one type, gets combined with other SubSelectors in Selector.
Definition subselector.hpp:33
The context in which a simulation is run. This includes the elapsed time, the random number generator...
Definition behavior_context.hpp:24
Holds references to commonly used parameters for simpler passing.
Definition sim_pack.hpp:23