Skip to content

ChecksumBody

INCLUDE FILE
#include "Body/ChecksumBody.h"

class ChecksumBody

Represents a body element that computes a checksum over a range of memory: .checksum algorithm start end [parameters].

DEFINITION
class ChecksumBody;

constructor ChecksumBody

DEFINITION
ChecksumBody ( std::shared_ptr< ChecksumAlgorithm >  algorithm_,
Expression  start,
Expression  end,
std::unordered_map< Symbol, Expression >  parameters );
PARAMETERDESCRIPTION
algorithm_
start
end
parameters

method cloneconst virtual

DEFINITION
virtual Body  clone ( const CloneContext & context ) const;
PARAMETERDESCRIPTION
context
RETURNSDESCRIPTION
Body

method encodevirtual

Encode the BodyElement into a byte string.

The default implementation does nothing. Subclasses that represent data or instructions should override this method.

DEFINITION
virtual void  encode ( std::string & bytes,
const Memory * memory );
PARAMETERDESCRIPTION
bytes

The byte string to encode into.

memory

The memory context for encoding.

method evaluate_processvirtual

Evaluate the body element after all sub-body-elements and sub-expressions have been evaluated.

The default implementation does nothing.

DEFINITION
virtual std::optional< Body >  evaluate_process ( const EvaluationContext & context );
PARAMETERDESCRIPTION
context

The evaluation context.

RETURNSDESCRIPTION
std::optional< Body >

The Body to replace this BodyElement with, {} if no replacement is needed.

method parsestatic

DEFINITION
static Body  parse ( Tokenizer & tokenizer );
PARAMETERDESCRIPTION
tokenizer
RETURNSDESCRIPTION
Body

method serializeconst virtual

Serialize the BodyElement to a stream.

Subclasses must implement this method.

DEFINITION
virtual void  serialize ( std::ostream & stream,
const std::string & prefix ) const;
PARAMETERDESCRIPTION
stream

The stream to serialize to.

prefix

The prefix for each line of the serialized output.

method traversevirtual

Traverse the BodyElement.

This function is used by the default implementations of resolve() and expand_calls(). Unless a subclass overrides both of these methods, it should override traverse().

DEFINITION
virtual void  traverse ( std::function< void(Body &)>  body_callable,
std::function< void(Expression &)>  expression_callable );
PARAMETERDESCRIPTION
body_callable

A callable to apply to each sub-body-element.

expression_callable

A callable to apply to each sub-expression.

member algorithmprivate

DEFINITION
std::shared_ptr< ChecksumAlgorithm >  algorithm;

member endprivate

DEFINITION
Expression  end;

member parametersprivate

DEFINITION
std::unordered_map< Symbol, Expression >  parameters;

member startprivate

DEFINITION
Expression  start;