-
Notifications
You must be signed in to change notification settings - Fork 23
QuantumGate::Result
Karel Donk edited this page Sep 2, 2018
·
17 revisions
QuantumGate::Result
is a class that represents a return value from a function or operation. Many functions in the QuantumGate API return a QuantumGate::Result
object containing an error code and optionally a value. The error codes and the value types can differ depending on the function being used. Refer to the documentation of the function in question for more details on its return values.
Name | Description |
---|---|
Constructor |
Creates a QuantumGate::Result object. |
GetErrorCode |
Returns the std::error_code . |
GetErrorValue |
Returns the error value. |
GetErrorDescription |
Returns a description of the error code. |
GetErrorCategory |
Returns the error category. |
GetErrorString |
Returns a formatted string of the error code, error description and error category. |
HasValue |
Returns whether the object holds a value. |
GetValue |
Returns a reference to the value. |
operator* , operator->
|
Returns a reference or pointer to the value. |
Succeeded |
Returns whether the operation succeeded or executes a lambda function. |
Failed |
Returns whether the operation failed or executes a lambda function. |
operator bool |
Returns whether the operation succeeded. |
operator== , operator!=
|
Compares the result to a QuantumGate::ResultCode or a std::error_code . |
operator<< |
Outputs the error category, code and description to the stream. |
Clear |
Clears the error code and value and restores the default. |
#include <iostream>
#include <QuantumGate.h>
int main()
{
QuantumGate::StartupParameters params;
// params member assignment here
QuantumGate::Local qg;
const auto result = qg.Startup(params);
if (result.Succeeded())
{
std::wcout << L"Startup successful";
}
else
{
std::wcout << L"Startup failed (" << result << L")";
}
return 0;
}