ContRap-Core
Public Types | Public Member Functions | Protected Attributes

crp::Block Class Reference

Class Block represents blocks in the control flow structure. More...

#include <block.h>

Inheritance diagram for crp::Block:
crp::Command crp::Object

Public Types

enum  BlockType { PURE, SEQUENCE, QUOTE, CLASS }
 

Enumerates possible block types.

More...

Public Member Functions

 Block (BlockType type=PURE)
 Constructs an empty block with the given type.
 Block (BlockType type, const SPtr< List > &commands)
 Constructs a block with the given commands.
virtual ~Block ()
 Virtual destructor.
BlockType get_block_type () const
 Returns the block type.
void add_command (const DPtr &command)
 Adds a command to the end of the block.
SPtr< List > & get_commands ()
 Returns the block commands.
const SPtr< List > & get_commands () const
 Returns the block commands.
virtual CommandType get_command_type () const
 Returns the enumerated type of the command.
virtual std::string to_string () const
 Converts the object to a non-formatted string.

Protected Attributes

BlockType type
 Sequence flag.
SPtr< Listcommands
 List of commands.

Detailed Description

Class Block represents blocks in the control flow structure.

Blocks differ in their evaluation behavior. For pure blocks a new scope is created for the evaluation. Sequences and quotes are not evaluated in a new scope.


Member Enumeration Documentation

Enumerates possible block types.

Enumerator:
PURE 
SEQUENCE 
QUOTE 
CLASS 

Constructor & Destructor Documentation

crp::Block::Block ( BlockType  type = PURE)

Constructs an empty block with the given type.

Parameters:
typeType of the block
crp::Block::Block ( BlockType  type,
const SPtr< List > &  commands 
)

Constructs a block with the given commands.

Parameters:
typeType of the block
commandsCommands of the block
virtual crp::Block::~Block ( ) [inline, virtual]

Virtual destructor.


Member Function Documentation

void crp::Block::add_command ( const DPtr command) [inline]

Adds a command to the end of the block.

Parameters:
commandCommand to add
BlockType crp::Block::get_block_type ( ) const [inline]

Returns the block type.

Returns:
Type of the block
virtual CommandType crp::Block::get_command_type ( ) const [inline, virtual]

Returns the enumerated type of the command.

Returns:
Type of the object

Implements crp::Command.

const SPtr<List>& crp::Block::get_commands ( ) const [inline]

Returns the block commands.

Returns:
List of block commands
SPtr<List>& crp::Block::get_commands ( ) [inline]

Returns the block commands.

Returns:
List of block commands
virtual std::string crp::Block::to_string ( ) const [virtual]

Converts the object to a non-formatted string.

This method is thought to be used for debugging purposes only.

Returns:
String representation of the object

Reimplemented from crp::Command.


Field Documentation

List of commands.

Sequence flag.


The documentation for this class was generated from the following file: