Fabcoin Core  0.16.2
P2P Digital Currency
Public Member Functions | Private Attributes | List of all members
dev::eth::owning_bytes_ref Class Reference

Reference to a slice of buffer that also owns the buffer. More...

#include <ExtVMFace.h>

Inheritance diagram for dev::eth::owning_bytes_ref:
[legend]
Collaboration diagram for dev::eth::owning_bytes_ref:
[legend]

Public Member Functions

 owning_bytes_ref ()=default
 
 owning_bytes_ref (bytes &&_bytes, size_t _begin, size_t _size)
 
 owning_bytes_ref (owning_bytes_ref const &)=delete
 
 owning_bytes_ref (owning_bytes_ref &&)=default
 
owning_bytes_refoperator= (owning_bytes_ref const &)=delete
 
owning_bytes_refoperator= (owning_bytes_ref &&)=default
 
- Public Member Functions inherited from dev::vector_ref< byte const >
 vector_ref ()
 
 vector_ref (byte const *_data, size_t _count)
 Creates a new vector_ref to point to _count elements starting at _data. More...
 
 vector_ref (typename std::conditional< std::is_const< byte const >::value, std::string const *, std::string * >::type _data)
 Creates a new vector_ref pointing to the data part of a string (given as pointer). More...
 
 vector_ref (typename std::conditional< std::is_const< byte const >::value, std::vector< typename std::remove_const< byte const >::type > const *, std::vector< byte const > * >::type _data)
 Creates a new vector_ref pointing to the data part of a vector (given as pointer). More...
 
 vector_ref (typename std::conditional< std::is_const< byte const >::value, std::string const &, std::string & >::type _data)
 Creates a new vector_ref pointing to the data part of a string (given as reference). More...
 
 operator bool () const
 
bool contentsEqual (std::vector< mutable_value_type > const &_c) const
 
std::vector< mutable_value_typetoVector () const
 
std::vector< unsigned char > toBytes () const
 
std::string toString () const
 
 operator vector_ref< _T2 > () const
 
 operator vector_ref< byte const const > () const
 
byte const * data () const
 
size_t count () const
 
size_t size () const
 
bool empty () const
 
vector_ref< byte const > next () const
 
vector_ref< byte const > cropped (size_t _begin, size_t _count) const
 
vector_ref< byte const > cropped (size_t _begin) const
 
void retarget (byte const *_d, size_t _s)
 
void retarget (std::vector< byte const > const &_t)
 
bool overlapsWith (vector_ref< T > _t) const
 
void copyTo (vector_ref< typename std::remove_const< byte const >::type > _t) const
 Copies the contents of this vector_ref to the contents of _t, up to the max size of _t. More...
 
void populate (vector_ref< typename std::remove_const< byte const >::type > _t) const
 Copies the contents of this vector_ref to the contents of _t, and zeros further trailing elements in _t. More...
 
void cleanse ()
 Securely overwrite the memory. More...
 
byte const * begin ()
 
byte const const * begin () const
 
byte const * end ()
 
byte const const * end () const
 
byte const & operator[] (size_t _i)
 
byte const const & operator[] (size_t _i) const
 
bool operator== (vector_ref< byte const > const &_cmp) const
 
bool operator!= (vector_ref< byte const > const &_cmp) const
 
void reset ()
 

Private Attributes

bytes m_bytes
 

Additional Inherited Members

- Public Types inherited from dev::vector_ref< byte const >
using value_type = byte const
 
using element_type = byte const
 
using mutable_value_type = typename std::conditional< std::is_const< byte const >::value, typename std::remove_const< byte const >::type, byte const >::type
 

Detailed Description

Reference to a slice of buffer that also owns the buffer.

This is extension to the concept C++ STL library names as array_view (also known as gsl::span, array_ref, here vector_ref) – reference to continuous non-modifiable memory. The extension makes the object also owning the referenced buffer.

This type is used by VMs to return output coming from RETURN instruction. To avoid memory copy, a VM returns its whole memory + the information what part of this memory is actually the output. This simplifies the VM design, because there are multiple options how the output will be used (can be ignored, part of it copied, or all of it copied). The decision what to do with it was moved out of VM interface making VMs "stateless".

The type is movable, but not copyable. Default constructor available.

Definition at line 56 of file ExtVMFace.h.

Constructor & Destructor Documentation

dev::eth::owning_bytes_ref::owning_bytes_ref ( )
default

Here is the caller graph for this function:

dev::eth::owning_bytes_ref::owning_bytes_ref ( bytes &&  _bytes,
size_t  _begin,
size_t  _size 
)
inline
Parameters
_bytesThe buffer.
_beginThe index of the first referenced byte.
_sizeThe number of referenced bytes.

Definition at line 64 of file ExtVMFace.h.

Here is the call graph for this function:

dev::eth::owning_bytes_ref::owning_bytes_ref ( owning_bytes_ref const &  )
delete
dev::eth::owning_bytes_ref::owning_bytes_ref ( owning_bytes_ref &&  )
default

Member Function Documentation

owning_bytes_ref& dev::eth::owning_bytes_ref::operator= ( owning_bytes_ref const &  )
delete

Here is the caller graph for this function:

owning_bytes_ref& dev::eth::owning_bytes_ref::operator= ( owning_bytes_ref &&  )
default

Member Data Documentation

bytes dev::eth::owning_bytes_ref::m_bytes
private

Definition at line 78 of file ExtVMFace.h.


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