Hyper API for C++ 0.0.24081
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 <string>
14#include <unordered_map>
15
16namespace hyperapi {
17
21enum class Telemetry {
23 SendUsageDataToTableau = HYPER_ENABLE_TELEMETRY,
25 DoNotSendUsageDataToTableau = HYPER_DISABLE_TELEMETRY
26};
27
35class HyperProcess final {
36 public:
49 explicit HyperProcess(
50 const std::string& hyperPath,
51 Telemetry telemetry,
52 const std::string& userAgent = std::string(),
53 const std::unordered_map<std::string, std::string>& parameters =
54 std::unordered_map<std::string, std::string>());
55
69 explicit HyperProcess(
70 Telemetry telemetry,
71 const std::string& userAgent = std::string(),
72 const std::unordered_map<std::string, std::string>& parameters =
73 std::unordered_map<std::string, std::string>());
74
81
85 ~HyperProcess() noexcept;
86
88 HyperProcess(HyperProcess&& other) noexcept;
89
91 HyperProcess& operator=(HyperProcess&& other) noexcept;
92
107 void shutdown(std::chrono::milliseconds timeoutMs = std::chrono::milliseconds(-1));
108
114
118 bool isOpen() const noexcept;
119
124 void close() noexcept;
125
126 private:
128 hyper_instance_t* handle_ = nullptr;
130 std::string user_agent_;
131
132 friend class Parameters;
133 friend optional<int> internal::getExitCode(hyperapi::HyperProcess&);
134 friend hyper_instance_t* internal::getHyperProcessHandle(const hyperapi::HyperProcess&);
135};
136}
137
138#include <hyperapi/impl/HyperProcess.impl.hpp>
139
140#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:14
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.