struct arisen::asset

Public Attributes

Type

Name

int64_t

amount

symbol

symbol

Public Static Attributes

Type

Name

static constexpr int64_t

max_amount

Public Functions

Type

Name

asset (int64_t a, class symbol s)

bool

is_amount_within_range () const

bool

is_valid () const

void

set_amount (int64_t a)

char *

write_as_string (char begin, char end, bool dry_run = false) const
Writes the asset as a string to the provided char buffer.

std::string

to_string () const
asset to std::string

void

print () const
Print the asset

asset ()

Friends

Type

Name

friend DataStream &

operator<<

friend DataStream &

operator>>

Detailed Description

Public Attributes Documentation

variable amount

int64_t arisen::asset::amount;

variable symbol

symbol arisen::asset::symbol;

Public Static Attributes Documentation

constexpr int64_t arisen::asset::max_amount;

Maximum amount possible for this asset. It's capped to 2^62 - 1

Public Functions Documentation

function asset (1/2)

arisen::asset::asset()

function asset (2/2)

arisen::asset::asset(
    int64_t a,
    class symbol s
)

Construct a new asset given the symbol name and the amount

Parameters:

a - The amount of the asset
s - The name of the symbol

function is_amount_within_range

bool arisen::asset::is_amount_within_range() const

Check if the amount doesn't exceed the max amount

Returns:

true - if the amount doesn't exceed the max amount

Returns:

false - otherwise

function is_valid

bool arisen::asset::is_valid() const

Check if the asset is valid. A valid asset has its amount <= max_amount and its symbol name valid

Returns:

true - if the asset is valid

Returns:

false - otherwise

function set_amount

void arisen::asset::set_amount(
    int64_t a
)

Set the amount of the asset

Parameters:

a - New amount for the asset

function write_as_string

char* arisen::asset::write_as_string(
    char * begin,
    char * end,
    bool dry_run = false
) const

Writes the asset as a string to the provided char buffer.

Writes the asset as a string to the provided char buffer

Precondition:

is_valid() == true

Precondition:

The range [begin, end) must be a valid range of memory to write to.

Parameters:

begin - The start of the char buffer
end - Just past the end of the char buffer
dry_run - If true, do not actually write anything into the range.
Returns:

char* - Just past the end of the last character that would be written assuming dry_run == false and end was large enough to provide sufficient space. (Meaning only applies if returned pointer >= begin.)

Post

If the output string fits within the range [begin, end) and dry_run == false, the range [begin, returned pointer) contains the string representation of the asset. Nothing is written if dry_run == true or returned pointer > end (insufficient space) or if returned pointer < begin (overflow in calculating desired end).

function to_string

std::string arisen::asset::to_string() const

asset to std::string

asset to std::string

function print

void arisen::asset::print() const

Print the asset

Print the asset

Friends Documentation

friend operator<<

template<typename DataStream>
DataStream& operator<<(
    DataStream & ds,
    const asset & t
)

friend operator>>

template<typename DataStream>
DataStream& operator>>(
    DataStream & ds,
    asset & t
)

The documentation for this class was generated from the following file: libraries/arisenlib/core/arisen/asset.hpp