ComputeResponse Class
The ComputeResponse
class represents the response received from the OpenVector network after a computation has been performed. It contains the status of the computation and any resulting data.
Public Enums
enum class Status
enum class Status
Indicates the status of the computation.
Values:
OK
: The computation was successful.ERROR
: An error occurred during the computation.
Constructors
ComputeResponse(Status status, std::string data);
ComputeResponse(Status status, std::string data);
Creates a compute response with the specified status and data.
Parameters:
status
: The status of the computation (OK
orERROR
).data
: The result data as a string. The format and content depend on the computation performed.
Member Functions
Status& status();
Returns a reference to the status of the computation.
const Status& status() const;
Returns a constant reference to the status of the computation.
std::string& data();
Returns a reference to the result data string.
const std::string& data() const;
Returns a constant reference to the result data string.
std::string to_string() const;
Serializes the compute response to a string.
static ComputeResponse from_string(const std::string& str);
Deserializes a compute response from a string.
Usage Example
Notes
The
data
field contains the serialized result of the computation. You need to deserialize it using the appropriate method from theCryptoSystem
.Always check the
status
before attempting to use thedata
.In case of an error, the
data
field may contain an error message or be empty.
See Also
Last updated