SOMHunter Core
eval-server-client.h
Go to the documentation of this file.
1 /* This file is part of SOMHunter.
2  *
3  * Copyright (C) 2021 Frantisek Mejzlik <frankmejzlik@protonmail.com>
4  * Mirek Kratochvil <exa.exa@gmail.com>
5  * Patrik Vesely <prtrikvesely@gmail.com>
6  *
7  * SOMHunter is free software: you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License as published by the Free
9  * Software Foundation, either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * SOMHunter is distributed in the hope that it will be useful, but WITHOUT ANY
13  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15  * details.
16  *
17  * You should have received a copy of the GNU General Public License along with
18  * SOMHunter. If not, see <https://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef EVAL_SERVER_CLIENT_H_
22 #define EVAL_SERVER_CLIENT_H_
23 
24 #include <memory>
25 #include <mutex>
26 #include <string>
27 #include <vector>
28 // ---
29 #include <nlohmann/json.hpp>
30 // ---
31 #include "client-dres.h"
32 #include "common.h"
33 
34 namespace sh {
35 struct VideoFrame;
36 
38  // *** METHODS ***
39 public:
40  EvalServerClient(const EvalServerSettings& settings);
41  virtual ~EvalServerClient() noexcept = default;
42  // ---
43  bool login();
44  bool logout();
45  bool submit(const VideoFrame& frame);
46  bool send_results_log(const nlohmann::json& log_JSON);
47  bool send_interactions_log(const nlohmann::json& log_JSON);
48 
50  nlohmann::json get_current_task();
51  const std::string& get_user_token() const;
52 
53  // *** MEMBER VARIABLES ***
54 private:
56  std::unique_ptr<IServerClient> _p_client;
57  std::string _dummy{ "" };
58 };
59 
60 }; // namespace sh
61 
62 #endif // EVAL_SERVER_CLIENT_H_
Definition: eval-server-client.h:37
std::string _dummy
Definition: eval-server-client.h:57
nlohmann::json get_current_task()
Definition: eval-server-client.cpp:59
EvalServerSettings _submitter_settings
Definition: eval-server-client.h:55
UnixTimestamp get_server_ts()
Definition: eval-server-client.cpp:55
EvalServerClient(const EvalServerSettings &settings)
Definition: eval-server-client.cpp:32
bool send_results_log(const nlohmann::json &log_JSON)
Definition: eval-server-client.cpp:47
bool send_interactions_log(const nlohmann::json &log_JSON)
Definition: eval-server-client.cpp:51
bool submit(const VideoFrame &frame)
Definition: eval-server-client.cpp:45
std::unique_ptr< IServerClient > _p_client
Definition: eval-server-client.h:56
bool login()
Definition: eval-server-client.cpp:41
bool logout()
Definition: eval-server-client.cpp:43
virtual ~EvalServerClient() noexcept=default
const std::string & get_user_token() const
Definition: eval-server-client.cpp:57
Unified interface for all remote evaluation servers.
Definition: client-dres.h:34
Definition: common-types.h:33
std::int64_t UnixTimestamp
Definition: common-types.h:54
Definition: settings.h:59
Definition: dataset-frames.h:40