Skip to content

SimpleRepeatBody

INCLUDE FILE
#include "Body/SimpleRepeatBody.h"

class SimpleRepeatBody

Represents a body that repeats a block of code a specified number of times, not using a variable.

DEFINITION
class SimpleRepeatBody;

constructor SimpleRepeatBody

DEFINITION
SimpleRepeatBody ( RepeatRange  range,
Body  body );
PARAMETERDESCRIPTION
range
body

method cloneconst virtual

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

method createstatic

DEFINITION
static Body  create ( RepeatRange  range,
Body  body );
PARAMETERDESCRIPTION
range
body
RETURNSDESCRIPTION
Body

method createstatic

DEFINITION
static Body  create ( Expression  start,
Expression  end,
Body  body );
PARAMETERDESCRIPTION
start
end
body
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 protected

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 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 simplifystatic private

DEFINITION
static std::optional< Body >  simplify ( const RepeatRange & range,
const Body & body,
bool  always_create );
PARAMETERDESCRIPTION
range
body
always_create
RETURNSDESCRIPTION
std::optional< Body >