Hyper API for C++ 0.0.19484
Hyper client library for C++ applications
Loading...
Searching...
No Matches
HyperProcess.hpp
Go to the documentation of this file.
1
5#ifndef TABLEAU_HYPER_HYPERPROCESS_HPP
6#define TABLEAU_HYPER_HYPERPROCESS_HPP
7
9#include <hyperapi/impl/infra.hpp>
10#include <hyperapi/hyperapi.h>
11
12#include <chrono>
13#include <new>
14#include <string>
15#include <unordered_map>
16
17namespace hyperapi {
18
22enum class Telemetry {
24 SendUsageDataToTableau = HYPER_ENABLE_TELEMETRY,
26 DoNotSendUsageDataToTableau = HYPER_DISABLE_TELEMETRY
27};
28
36class HyperProcess final {
37 public:
50 explicit HyperProcess(
51 const std::string& hyperPath,
52 Telemetry telemetry,
53 const std::string& userAgent = std::string(),
54 const std::unordered_map<std::string, std::string>& parameters =
55 std::unordered_map<std::string, std::string>());
56
70 explicit HyperProcess(
71 Telemetry telemetry,
72 const std::string& userAgent = std::string(),
73 const std::unordered_map<std::string, std::string>& parameters =
74 std::unordered_map<std::string, std::string>());
75
82
86 ~HyperProcess() noexcept;
87
89 HyperProcess(HyperProcess&& other) noexcept;
90
92 HyperProcess& operator=(HyperProcess&& other) noexcept;
93
108 void shutdown(std::chrono::milliseconds timeoutMs = std::chrono::milliseconds(-1));
109
115
119 bool isOpen() const noexcept;
120
125 void close() noexcept;
126
127 private:
129 hyper_instance_t* handle_ = nullptr;
131 std::string user_agent_;
132
133 friend class Parameters;
134 friend optional<int> internal::getExitCode(hyperapi::HyperProcess&);
135 friend hyper_instance_t* internal::getHyperProcessHandle(const hyperapi::HyperProcess&);
136};
137}
138
139#include <hyperapi/impl/HyperProcess.impl.hpp>
140
141#endif
Describes a network endpoint at which a Hyper server is accessible.
Definition Endpoint.hpp:14
Defines a Hyper process.
HyperProcess(Telemetry telemetry, const std::string &userAgent=std::string(), const std::unordered_map< std::string, std::string > &parameters=std::unordered_map< std::string, std::string >())
Starts a Hyper process.
Endpoint getEndpoint() const
Returns the endpoint descriptor for the given Hyper process.
HyperProcess()
Constructs a HyperProcess object that does not represent a hyper process.
~HyperProcess() noexcept
Stops the Hyper process.
void shutdown(std::chrono::milliseconds timeoutMs=std::chrono::milliseconds(-1))
Shuts down the Hyper process.
bool isOpen() const noexcept
Returns whether the Hyper process is open.
HyperProcess(const std::string &hyperPath, Telemetry telemetry, const std::string &userAgent=std::string(), const std::unordered_map< std::string, std::string > &parameters=std::unordered_map< std::string, std::string >())
Starts a Hyper process with the given parameters.
void close() noexcept
Closes this Hyper process object.
Surrogate for C++17 std::optional
Definition optional.hpp:40
The primary namespace of the Hyper API for C++.
Definition ByteSpan.hpp:15
Telemetry
The telemetry modes.
@ DoNotSendUsageDataToTableau
No telemetry data will be sent to tableau.
@ SendUsageDataToTableau
Telemetry data will be sent to tableau to help improve the Hyper API.