EVMC
evmc::result Class Reference

The EVM code execution result. More...

#include <evmc.hpp>

Inherits evmc_result.

Public Member Functions

 result (evmc_status_code _status_code, int64_t _gas_left, const uint8_t *_output_data, size_t _output_size) noexcept
 Creates the result from the provided arguments. More...
 
 result (evmc_result const &res) noexcept
 Converting constructor from raw evmc_result.
 
 ~result () noexcept
 Destructor responsible for automatically releasing attached resources.
 
 result (result &&other) noexcept
 Move constructor.
 
resultoperator= (result &&other) noexcept
 Move assignment operator. More...
 
evmc_result release_raw () noexcept
 Releases the ownership and returns the raw copy of evmc_result. More...
 

Detailed Description

The EVM code execution result.

This is a RAII wrapper for evmc_result and objects of this type automatically release attached resources.

Definition at line 266 of file evmc.hpp.

Constructor & Destructor Documentation

◆ result()

evmc::result::result ( evmc_status_code  _status_code,
int64_t  _gas_left,
const uint8_t *  _output_data,
size_t  _output_size 
)
inlinenoexcept

Creates the result from the provided arguments.

The provided output is copied to memory allocated with malloc() and the evmc_result::release function is set to one invoking free().

Parameters
_status_codeThe status code.
_gas_leftThe amount of gas left.
_output_dataThe pointer to the output.
_output_sizeThe output size.

Definition at line 284 of file evmc.hpp.

288  : evmc_result{make_result(_status_code, _gas_left, _output_data, _output_size)}
289  {}
constexpr auto make_result
Alias for evmc_make_result().
Definition: evmc.hpp:260
The EVM code execution result.
Definition: evmc.h:340

Member Function Documentation

◆ operator=()

result& evmc::result::operator= ( result &&  other)
inlinenoexcept

Move assignment operator.

The self-assigment MUST never happen.

Parameters
otherThe other result object.
Returns
The reference to the left-hand side object.

Definition at line 313 of file evmc.hpp.

314  {
315  this->~result(); // Release this object.
316  static_cast<evmc_result&>(*this) = other; // Copy data.
317  other.release = nullptr; // Disable releasing of the rvalue object.
318  return *this;
319  }
~result() noexcept
Destructor responsible for automatically releasing attached resources.
Definition: evmc.hpp:295
evmc_release_result_fn release
The method releasing all resources associated with the result object.
Definition: evmc.h:392
The EVM code execution result.
Definition: evmc.h:340

◆ release_raw()

evmc_result evmc::result::release_raw ( )
inlinenoexcept

Releases the ownership and returns the raw copy of evmc_result.

This method drops the ownership of the result (result's resources are not going to be released when this object is destructed). It is the caller's responsibility having the returned copy of the result to release it. This object MUST NOT be used after this method is invoked.

Returns
The copy of this object converted to raw evmc_result.

Definition at line 329 of file evmc.hpp.

330  {
331  const auto out = evmc_result{*this}; // Copy data.
332  this->release = nullptr; // Disable releasing of this object.
333  return out;
334  }
evmc_release_result_fn release
The method releasing all resources associated with the result object.
Definition: evmc.h:392
The EVM code execution result.
Definition: evmc.h:340

The documentation for this class was generated from the following file: