|
OpenCBDC Transaction Processor
|
This class contains a value that can be serialized into, or was deserialized from, a Recursive Length Prefix (RLP) encoded representation. More...
#include <rlp.hpp>
Public Member Functions | |
| rlp_value () | |
| Default constructor. Sets m_type to rlp_value_type::buffer. | |
| rlp_value (rlp_value_type type) | |
| Constructor. | |
| rlp_value (const buffer &data) | |
| Constructs an RLP value of type rlp_value_type::buffer and assigns the given data to its internal buffer. | |
| void | assign (const buffer &data) |
| Assigns the given data to the internal buffer of this rlp_value can only be used for rlp_value instances of type rlp_value_type::buffer. | |
| auto | push_back (const rlp_value &val) -> bool |
| Pushes an rlp_value into an rlp_value of type rlp_value_type::array You can push both rlp_value_type::buffer and rlp_value_type::array. | |
| void | write_to (serializer &ser) const |
| Serializes the rlp_value in RLP representation into the passed serializer. | |
| void | read_from (serializer &ser) |
| Deserializes the rlp_value in RLP representation from the passed serializer into the current rlp_value instance. | |
| auto | value_at (size_t idx) const -> rlp_value |
| Returns the rlp_value at the given index for RLP values of type rlp_value_type::array. | |
| auto | size () const -> size_t |
| Get the size of the rlp_value. | |
| auto | type () const -> rlp_value_type |
| Get the type of rlp_value. | |
| auto | data () const -> const void * |
| Returns a raw pointer to the start of the buffer data for rlp_value of type rlp_buffer. | |
| template<typename T > | |
| auto | value () const -> typename std::enable_if_t< std::is_same< T, evmc::bytes32 >::value||std::is_same< T, evmc::address >::value, T > |
| Return RLP value as address or byte array. | |
This class contains a value that can be serialized into, or was deserialized from, a Recursive Length Prefix (RLP) encoded representation.
| cbdc::rlp_value::rlp_value | ( | ) |
Default constructor. Sets m_type to rlp_value_type::buffer.
|
explicit |
|
explicit |
Constructs an RLP value of type rlp_value_type::buffer and assigns the given data to its internal buffer.
| data | The data to be assigned to the internal buffer |
Definition at line 11 of file rlp.cpp.
References assign(), and data().

| void cbdc::rlp_value::assign | ( | const buffer & | data | ) |
Assigns the given data to the internal buffer of this rlp_value can only be used for rlp_value instances of type rlp_value_type::buffer.
| data | The data to be assigned to the internal buffer |
Definition at line 14 of file rlp.cpp.
References cbdc::buffer::clear(), cbdc::buffer::data(), data(), and cbdc::buffer::extend().
Referenced by rlp_value().

|
nodiscard |
Returns a raw pointer to the start of the buffer data for rlp_value of type rlp_buffer.
Definition at line 31 of file rlp.cpp.
References cbdc::buffer::data().
Referenced by assign(), and rlp_value().

| auto cbdc::rlp_value::push_back | ( | const rlp_value & | val | ) | -> bool |
Pushes an rlp_value into an rlp_value of type rlp_value_type::array You can push both rlp_value_type::buffer and rlp_value_type::array.
| val | The rlp_value to append to the end of the array |
Definition at line 19 of file rlp.cpp.
References cbdc::array.
| void cbdc::rlp_value::read_from | ( | serializer & | ser | ) |
Deserializes the rlp_value in RLP representation from the passed serializer into the current rlp_value instance.
| ser | Serializer instance to read the RLP value from |
Definition at line 10 of file rlp_reader.cpp.
References cbdc::buffer, cbdc::buffer::clear(), cbdc::buffer::data(), cbdc::deserialize_size(), cbdc::buffer::extend(), and cbdc::serializer::read().

|
nodiscard |
Get the size of the rlp_value.
Definition at line 35 of file rlp.cpp.
References cbdc::array, and cbdc::buffer::size().

|
nodiscard |
|
inlinenodiscard |
Return RLP value as address or byte array.
| address | or byte array type. |
Definition at line 93 of file rlp.hpp.
References cbdc::buffer, cbdc::buffer::data(), and cbdc::buffer::size().

|
nodiscard |
Returns the rlp_value at the given index for RLP values of type rlp_value_type::array.
| idx | the index in the array |
| void cbdc::rlp_value::write_to | ( | serializer & | ser | ) | const |
Serializes the rlp_value in RLP representation into the passed serializer.
| ser | Serializer instance to write the RLP value to |
Definition at line 10 of file rlp_writer.cpp.
References cbdc::buffer.