Hyper API for C++  0.0.15530
Hyper client library for C++ applications
HyperProcess.hpp
Go to the documentation of this file.
1 
5 #ifndef TABLEAU_HYPER_HYPERPROCESS_HPP
6 #define TABLEAU_HYPER_HYPERPROCESS_HPP
7 
8 #include <hyperapi/Endpoint.hpp>
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 
17 namespace hyperapi {
18 
22 enum class Telemetry {
24  SendUsageDataToTableau = HYPER_ENABLE_TELEMETRY,
26  DoNotSendUsageDataToTableau = HYPER_DISABLE_TELEMETRY
27 };
28 
36 class 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 
114  Endpoint getEndpoint() const;
115 
119  bool isOpen() const noexcept;
120 
125  void close() noexcept;
126 
127  private:
129  hyper_instance_t* m_handle = nullptr;
131  std::string m_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
hyperapi::HyperProcess::HyperProcess
HyperProcess()
Constructs a HyperProcess object that does not represent a hyper process.
Definition: HyperProcess.hpp:81
hyperapi::Telemetry
Telemetry
The telemetry modes.
Definition: HyperProcess.hpp:22
hyperapi::HyperProcess::getEndpoint
Endpoint getEndpoint() const
Returns the endpoint descriptor for the given Hyper process.
hyperapi::HyperProcess::isOpen
bool isOpen() const noexcept
Returns whether the Hyper process is open.
hyperapi::HyperProcess::close
void close() noexcept
Closes this Hyper process object.
hyperapi::HyperProcess::~HyperProcess
~HyperProcess() noexcept
Stops the Hyper process.
Endpoint.hpp
hyperapi::Telemetry::SendUsageDataToTableau
Telemetry data will be sent to tableau to help improve the Hyper API.
hyperapi::optional
Surrogate for C++17 std::optional
Definition: optional.hpp:40
hyperapi::Endpoint
Describes a network endpoint at which a Hyper server is accessible.
Definition: Endpoint.hpp:14
hyperapi::HyperProcess
Defines a Hyper process.
Definition: HyperProcess.hpp:36
hyperapi::Telemetry::DoNotSendUsageDataToTableau
No telemetry data will be sent to tableau.
hyperapi
The primary namespace of the Hyper API for C++.
Definition: ByteSpan.hpp:15
hyperapi::HyperProcess::shutdown
void shutdown(std::chrono::milliseconds timeoutMs=std::chrono::milliseconds(-1))
Shuts down the Hyper process.