DataBody
class DataBody
Represents a body containing data. This is used for .data statements and encoded instructions.
constructor DataBody
| DataBody | ( | ); |
constructor DataBody
| DataBody | ( | std::vector< DataBodyElement > data | ); |
| PARAMETER | DESCRIPTION |
|---|---|
data |
method append_subvirtual protected
Append a BodyElement to this body directly, if supported.
If appending is supported, this method returns the resulting body. Otherwise, it returns an empty optional.
The default implementation does not support appending. If a subclass supports appending, it should override this method.
| virtual std::pair< bool, std::optional< Body > > append_sub | ( | const Body & body, | |
| const Body & element | ); |
| PARAMETER | DESCRIPTION |
|---|---|
body |
The body to append to. |
element |
The element to append. |
| RETURNS | DESCRIPTION |
|---|---|
std::pair< bool, std::optional< Body > > |
The resulting body, or {} if not supported. |
method appending
| Body appending | ( | const DataBody * body | ); |
| PARAMETER | DESCRIPTION |
|---|---|
body |
| RETURNS | DESCRIPTION |
|---|---|
Body |
method appendingconst
| Body appending | ( | const std::vector< DataBodyElement > & elements | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
elements |
| RETURNS | DESCRIPTION |
|---|---|
Body |
method cloneconst virtual
| virtual Body clone | ( | const CloneContext & context | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
context |
| RETURNS | DESCRIPTION |
|---|---|
Body |
method createstatic
| static Body create | ( | std::vector< DataBodyElement > data | ); |
| PARAMETER | DESCRIPTION |
|---|---|
data |
| RETURNS | DESCRIPTION |
|---|---|
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.
| virtual void encode | ( | std::string & bytes, | |
| const Memory * memory | ); |
| PARAMETER | DESCRIPTION |
|---|---|
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.
| virtual std::optional< Body > evaluate_process | ( | const EvaluationContext & context | ); |
| PARAMETER | DESCRIPTION |
|---|---|
context |
The evaluation context. |
| RETURNS | DESCRIPTION |
|---|---|
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.
| virtual void serialize | ( | std::ostream & stream, | |
| const std::string & prefix | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
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().
| virtual void traverse | ( | std::function< void(Body &)> body_callable, | |
| std::function< void(Expression &)> expression_callable | ); |
| PARAMETER | DESCRIPTION |
|---|---|
body_callable |
A callable to apply to each sub-body-element. |
expression_callable |
A callable to apply to each sub-expression. |
member data
class DataBodyElement
constructor DataBodyElement
| DataBodyElement | ( | Expression expression, | |
| std::optional< Encoder > encoding | ); |
| PARAMETER | DESCRIPTION |
|---|---|
expression |
|
encoding |
method sizeconst
| std::optional< uint64_t > size | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
std::optional< uint64_t > |
method size_rangeconst
| SizeRange size_range | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
SizeRange |