19 #ifndef MIR_SCENE_PROMPT_SESSION_CONTAINER_H_
20 #define MIR_SCENE_PROMPT_SESSION_CONTAINER_H_
22 #include <sys/types.h>
24 #include <unordered_map>
26 #include <boost/multi_index_container.hpp>
27 #include <boost/multi_index/member.hpp>
28 #include <boost/multi_index/ordered_index.hpp>
29 #include <boost/multi_index/composite_key.hpp>
30 #include <boost/multi_index/mem_fun.hpp>
34 using boost::multi_index_container;
55 void insert_prompt_session(std::shared_ptr<PromptSession>
const& prompt_session);
56 void remove_prompt_session(std::shared_ptr<PromptSession>
const& prompt_session);
58 bool insert_participant(
PromptSession* prompt_session, std::weak_ptr<Session>
const& session, ParticipantType participant_type);
59 bool remove_participant(
PromptSession* prompt_session, std::weak_ptr<Session>
const& session, ParticipantType participant_type);
61 void for_each_participant_in_prompt_session(
PromptSession* prompt_session, std::function<
void(std::weak_ptr<Session>
const&, ParticipantType)> f)
const;
62 void for_each_prompt_session_with_participant(std::weak_ptr<Session>
const& participant, ParticipantType participant_type, std::function<
void(std::shared_ptr<PromptSession>
const&)> f)
const;
63 void for_each_prompt_session_with_participant(std::weak_ptr<Session>
const& participant, std::function<
void(std::shared_ptr<PromptSession>
const&, ParticipantType)> f)
const;
66 std::mutex
mutable mutex;
68 std::unordered_map<PromptSession*, std::shared_ptr<PromptSession>> prompt_sessions;
73 std::weak_ptr<Session> session;
74 ParticipantType participant_type;
85 typedef multi_index_container<
91 member<Participant, PromptSession*, &Participant::prompt_session>,
92 member<Participant, uint, &Participant::insert_order>
98 member<Participant, std::weak_ptr<Session>, &Participant::session>,
99 member<Participant, ParticipantType, &Participant::participant_type>,
100 member<Participant, PromptSession*, &Participant::prompt_session>
102 composite_key_compare<
103 std::owner_less<std::weak_ptr<Session>>,
104 std::less<ParticipantType>,
105 std::less<PromptSession*>>
108 > PromptSessionParticipants;
110 typedef nth_index<PromptSessionParticipants,0>::type participant_by_prompt_session;
111 typedef nth_index<PromptSessionParticipants,1>::type participant_by_session;
113 PromptSessionParticipants participant_map;
114 participant_by_prompt_session& prompt_session_index;
115 participant_by_session& participant_index;
121 #endif // MIR_SCENE_PROMPT_SESSION_CONTAINER_H_
All things Mir.
Definition: aging_buffer.h:24
Definition: prompt_session.h:30
void helper(const char *server)
Definition: prompt_session.c:140
ParticipantType
Definition: prompt_session_container.h:48
Definition: prompt_session_container.h:42