BitShares-Core
7.0.2
BitShares blockchain node software and command-line wallet software
|
An ID for some votable object. More...
#include <vote.hpp>
Public Types | |
enum | vote_type { committee, witness, worker, VOTE_TYPE_COUNT } |
Public Member Functions | |
vote_id_type ()=default | |
vote_id_type (vote_type type, uint32_t instance=0) | |
Construct this vote_id_type with provided type and instance. More... | |
vote_id_type (const std::string &serial) | |
Construct this vote_id_type from a serial string in the form "type:instance". More... | |
void | set_type (vote_type type) |
Set the type of this vote_id_type. More... | |
vote_type | type () const |
Get the type of this vote_id_type. More... | |
void | set_instance (uint32_t instance) |
Set the instance of this vote_id_type. More... | |
uint32_t | instance () const |
Get the instance of this vote_id_type. More... | |
vote_id_type & | operator= (vote_id_type other) |
vote_id_type & | operator= (uint32_t instance) |
Set the instance of this vote_id_type. More... | |
operator uint32_t () const | |
Get the instance of this vote_id_type. More... | |
operator std::string () const | |
Convert this vote_id_type to a serial string in the form "type:instance". More... | |
Public Attributes | |
uint32_t | content = 0 |
Friends | |
size_t | hash_value (vote_id_type v) |
An ID for some votable object.
This class stores an ID for a votable object. The ID is comprised of two fields: a type, and an instance. The type field stores which kind of object is being voted on, and the instance stores which specific object of that type is being referenced by this ID.
A value of vote_id_type is implicitly convertible to an unsigned 32-bit integer containing only the instance. It may also be implicitly assigned from a uint32_t, which will update the instance. It may not, however, be implicitly constructed from a uint32_t, as in this case, the type would be unknown.
On the wire, a vote_id_type is represented as a 32-bit integer with the type in the lower 8 bits and the instance in the upper 24 bits. This means that types may never exceed 8 bits, and instances may never exceed 24 bits.
In JSON, a vote_id_type is represented as a string "type:instance", i.e. "1:5" would be type 1 and instance 5.
|
default |
|
inlineexplicit |
Construct this vote_id_type with provided type and instance.
|
inlineexplicit |
Construct this vote_id_type from a serial string in the form "type:instance".
|
inline |
Get the instance of this vote_id_type.
|
inlineexplicit |
Convert this vote_id_type to a serial string in the form "type:instance".
|
inline |
Get the instance of this vote_id_type.
|
inline |
Set the instance of this vote_id_type.
|
inline |
|
inline |
Set the instance of this vote_id_type.
|
inline |
Set the type of this vote_id_type.
|
inline |
Get the type of this vote_id_type.
|
friend |
uint32_t graphene::protocol::vote_id_type::content = 0 |