SkyWay for Linux
読み取り中…
検索中…
一致する文字列を見つけられません
p2p_room.hpp
1//
2// p2p_room.hpp
3// skyway
4//
5// Created by Naoto Takahashi on 2023/11/22.
6// Copyright © 2023 NTT Communications. All rights reserved.
7//
8#ifndef SKYWAY_ROOM_P2P_P2P_ROOM_HPP
9#define SKYWAY_ROOM_P2P_P2P_ROOM_HPP
10
11#include "skyway/room/abstract/room.hpp"
12#include "skyway/room/p2p/local_p2p_room_member.hpp"
13#include "skyway/room/p2p/room_domain_factory.hpp"
14
15namespace skyway {
16namespace room {
17namespace p2p {
18
20class P2PRoomFactory : public interface::RoomFactory {
21public:
22 std::shared_ptr<interface::Room> Create(
23 interface::RoomInitOptions options,
24 std::unique_ptr<interface::RoomDomainFactory> domain_factory) override;
25 std::shared_ptr<interface::Room> Find(
26 interface::RoomQuery query,
27 std::unique_ptr<interface::RoomDomainFactory> domain_factory) override;
28 std::shared_ptr<interface::Room> FindOrCreate(
29 interface::RoomInitOptions options,
30 std::unique_ptr<interface::RoomDomainFactory> domain_factory) override;
31};
33
35class P2PRoom : public abstract::Room, public std::enable_shared_from_this<P2PRoom> {
36public:
37 P2PRoom(std::shared_ptr<core::interface::Channel> channel,
38 std::unique_ptr<interface::RoomDomainFactory> factory);
39 interface::RoomType Type() override;
40
42 static std::shared_ptr<P2PRoom> Create(
44 std::unique_ptr<interface::RoomFactory> room_factory = std::make_unique<P2PRoomFactory>(),
45 std::unique_ptr<interface::RoomDomainFactory> domain_factory =
46 std::make_unique<RoomDomainFactory>());
48 static std::shared_ptr<P2PRoom> Create();
50 static std::shared_ptr<P2PRoom> Find(
52 std::unique_ptr<interface::RoomFactory> room_factory = std::make_unique<P2PRoomFactory>(),
53 std::unique_ptr<interface::RoomDomainFactory> domain_factory =
54 std::make_unique<RoomDomainFactory>());
56 static std::shared_ptr<P2PRoom> FindOrCreate(
58 std::unique_ptr<interface::RoomFactory> room_factory = std::make_unique<P2PRoomFactory>(),
59 std::unique_ptr<interface::RoomDomainFactory> domain_factory =
60 std::make_unique<RoomDomainFactory>());
62 std::unique_ptr<LocalP2PRoomMember> Join(interface::RoomMemberInitOptions options);
63
64private:
65 static std::shared_ptr<P2PRoom> CreateShared(
66 std::shared_ptr<core::interface::Channel> channel,
67 std::unique_ptr<interface::RoomDomainFactory> factory);
68
69public:
71 friend class P2PRoomFactory;
72 friend class P2PRoomTest;
73 friend class LocalP2PRoomMemberTest;
75};
76
77} // namespace p2p
78} // namespace room
79} // namespace skyway
80
81#endif /* SKYWAY_ROOM_P2P_P2P_ROOM_HPP */
Roomの操作を行う抽象クラス
Definition room.hpp:20
P2PRoomの操作を行うクラス
Definition p2p_room.hpp:35
static std::shared_ptr< P2PRoom > Create()
P2PRoomを作成します。
static std::shared_ptr< P2PRoom > Find(interface::RoomQuery query, std::unique_ptr< interface::RoomFactory > room_factory=std::make_unique< P2PRoomFactory >(), std::unique_ptr< interface::RoomDomainFactory > domain_factory=std::make_unique< RoomDomainFactory >())
P2PRoomの検索をします。
interface::RoomType Type() override
RoomのTypeを取得します。
std::unique_ptr< LocalP2PRoomMember > Join(interface::RoomMemberInitOptions options)
P2PRoomへ参加します。
static std::shared_ptr< P2PRoom > Create(interface::RoomInitOptions options, std::unique_ptr< interface::RoomFactory > room_factory=std::make_unique< P2PRoomFactory >(), std::unique_ptr< interface::RoomDomainFactory > domain_factory=std::make_unique< RoomDomainFactory >())
P2PRoomを作成します。
static std::shared_ptr< P2PRoom > FindOrCreate(interface::RoomInitOptions options, std::unique_ptr< interface::RoomFactory > room_factory=std::make_unique< P2PRoomFactory >(), std::unique_ptr< interface::RoomDomainFactory > domain_factory=std::make_unique< RoomDomainFactory >())
P2PRoomの検索をし、存在しなければ作成します。
RoomのCreate/FindOrCreateで扱うオプション
Definition room.hpp:23
MemberのCreateで扱うオプション
Definition room.hpp:55
RoomのFind/FindOrCreateで扱うオプション
Definition room.hpp:39