9#include "webcface/common/webcface-config.h"
19 std::shared_ptr<internal::ClientData> data;
42 explicit Client(
const std::string &name,
43 const std::string &host =
"127.0.0.1",
58 explicit Client(
const std::wstring &name,
59 const std::wstring &host = L
"127.0.0.1",
67 const std::shared_ptr<internal::ClientData> &data);
83 template <
typename F,
typename std::enable_if_t<std::is_invocable_v<F>,
84 std::
nullptr_t> =
nullptr>
87 [callback = std::move(callback)](
const auto &) { callback(); });
99 template <
typename F,
typename std::enable_if_t<std::is_invocable_v<F>,
100 std::
nullptr_t> =
nullptr>
103 [callback = std::move(callback)](
const auto &) { callback(); });
116 const Client &close()
const;
126 const Client &autoReconnect(
bool enabled)
const;
131 bool autoReconnect()
const;
138 const Client &start()
const;
151 const Client &waitConnection()
const;
155 syncImpl(std::optional<std::chrono::microseconds> timeout)
const;
173 return syncImpl(std::chrono::microseconds(0));
189 return syncImpl(timeout);
200 template <
typename Clock,
typename Duration>
203 return syncImpl(std::chrono::duration_cast<std::chrono::microseconds>(
204 timeout - Clock::now()));
241 return Member{data, name};
254 return member(SharedString::encode(name));
264 return member(SharedString::encode(name));
272 std::vector<Member> members();
280 std::vector<Member> members()
const;
306 std::streambuf *loggerStreamBuf()
const;
314 std::streambuf *loggerStreamBuf(std::string_view name)
const;
327 std::ostream &loggerOStream()
const;
335 std::ostream &loggerOStream(std::string_view name)
const;
341 std::wstreambuf *loggerWStreamBuf()
const;
349 std::wstreambuf *loggerWStreamBuf(std::wstring_view name)
const;
355 std::wostream &loggerWOStream()
const;
363 std::wostream &loggerWOStream(std::wstring_view name)
const;
369 const std::string &serverVersion()
const;
377 const std::string &serverName()
const;
382 const std::string &serverHostName()
const;
サーバーに接続するクライアント。
Definition client.h:18
const Client & loopSyncFor(std::chrono::microseconds timeout) const
送信用にセットしたデータをすべて送信キューに入れ、受信したデータを処理する。
Definition client.h:188
const Client & onConnect(F callback) const
サーバーに接続したときに呼び出されるコールバックを設定
Definition client.h:101
const Client & loopSync() const
送信用にセットしたデータをすべて送信キューに入れ、受信したデータを処理する。
Definition client.h:217
const Client & loopSyncUntil(std::chrono::time_point< Clock, Duration > timeout) const
送信用にセットしたデータをすべて送信キューに入れ、受信したデータを処理する。
Definition client.h:202
const Client & onDisconnect(F callback) const
切断したときに呼び出されるコールバックを設定
Definition client.h:85
Client()
名前を指定せずサーバーに接続する
Definition client.h:31
Client(const Client &)=delete
Client(const std::wstring &name, const std::wstring &host=L"127.0.0.1", int port=7530)
名前を指定しサーバーに接続する (wstring)
Definition client.h:58
const Client & sync() const
送信用にセットしたデータをすべて送信キューに入れ、受信したデータを処理する。
Definition client.h:172
Member member(std::string_view name) const
他のmemberにアクセスする
Definition client.h:253
Client(const std::string &name, const std::string &host="127.0.0.1", int port=7530)
名前を指定しサーバーに接続する
Definition client.h:42
Member member(std::wstring_view name) const
他のmemberにアクセスする (wstring)
Definition client.h:263
const Client & operator=(const Client &)=delete
Memberを指すクラス
Definition member.h:23
const Member & onConnect(std::function< void(Member)> callback) const
Memberがサーバーに接続したときに呼び出されるコールバックを設定
Definition member.cc:47
const Member & onDisconnect(std::function< void(Member)> callback) const
Memberが切断したときに呼び出されるコールバックを設定
Definition member.cc:40
bool connected() const
Memberがサーバーに接続できているときtrueを返す
Definition member.cc:30
u8stringとstringとwstringをshared_ptrで持ち共有する
Definition encoding.h:67
bool empty() const
Definition encoding.cc:118
Member_ member() const
Memberを返す
Definition field.h:107
#define WEBCFACE_DLL
Definition webcface-config.h:69
#define WEBCFACE_NS_END
Definition webcface-config.h:118
#define WEBCFACE_NS_BEGIN
Definition webcface-config.h:117
#define WEBCFACE_DEFAULT_PORT
Definition webcface-config.h:4
#define WEBCFACE_CALL_FP
Definition webcface-config.h:107