HiveMind
Public Member Functions | Private Attributes | List of all members
BittyBuzzVm Class Reference

#include <BittyBuzzVm.h>

Inheritance diagram for BittyBuzzVm:
Inheritance graph
Collaboration diagram for BittyBuzzVm:
Collaboration graph

Public Member Functions

 BittyBuzzVm (const IBittyBuzzBytecode &bytecode, const IBittyBuzzStringResolver &stringResolver, IBittyBuzzMessageHandler &messageHandler, IBittyBuzzClosureRegister &closureRegister, IBittyBuzzMessageService &messageService, IBittyBuzzNeighborsManager &neighborsManager, IUserUI &userUI, IBSP &bsp, ILogger &logger, IUserInterface &ui)
 The constructor of the bbvm. More...
 
 ~BittyBuzzVm () override=default
 
bool init (const std::reference_wrapper< IBittyBuzzLib > *bbzLibs, uint32_t bbzLibsLength) override
 Init the virtual machine. More...
 
bool start () override
 Starts the vm. More...
 
void stop () override
 Stops the vm, can be called in another thread or in an interrupt. More...
 
BBVMRet step () override
 Does one execution step in the virtual machine. Thus execute the buzz code in the step function. More...
 
void terminate () override
 Terminate the virtual machine and removes all messages that were supposed to be processed. More...
 
void logDump (LogLevel logLevel) override
 Logs the virtual machine state, stack, heap and table segments. More...
 
bbzvm_state getState () const override
 Get the state of the vm. More...
 
bbzvm_error getError () const override
 Get the error state of the VM. More...
 
bbzvm_instr getInstruction () const override
 Get the current instruction of the VM. More...
 
- Public Member Functions inherited from IBittyBuzzVm
virtual ~IBittyBuzzVm ()=default
 

Private Attributes

const IBittyBuzzBytecodem_bytecode
 
const IBSPm_bsp
 
IBittyBuzzMessageHandlerm_messageHandler
 
IBittyBuzzMessageServicem_messageService
 
IBittyBuzzNeighborsManagerm_neighborsManager
 
IBittyBuzzClosureRegisterm_closureRegister
 
ILoggerm_logger
 
IUserInterfacem_ui
 
bbzvm_t m_bbzVm
 

Constructor & Destructor Documentation

◆ BittyBuzzVm()

BittyBuzzVm::BittyBuzzVm ( const IBittyBuzzBytecode bytecode,
const IBittyBuzzStringResolver stringResolver,
IBittyBuzzMessageHandler messageHandler,
IBittyBuzzClosureRegister closureRegister,
IBittyBuzzMessageService messageService,
IBittyBuzzNeighborsManager neighborsManager,
IUserUI userUI,
IBSP bsp,
ILogger logger,
IUserInterface ui 
)

The constructor of the bbvm.

Parameters
bytecodethe bytecode that the vm will run
stringResolverthe string resolver used in the VM
messageHandlera reference to a buzz message handler, called on step
closureRegistera reference to the closure register
messageServicea reference to the message service
neighborsManagera reference to a neighbors manager
userUIthe ui accessible to the user (led, hex display, etc)
bspa reference to the bsp
loggera reference to a logger
uia reference to a user interface

◆ ~BittyBuzzVm()

BittyBuzzVm::~BittyBuzzVm ( )
overridedefault

Member Function Documentation

◆ getError()

bbzvm_error BittyBuzzVm::getError ( ) const
overridevirtual

Get the error state of the VM.

Implements IBittyBuzzVm.

Here is the caller graph for this function:

◆ getInstruction()

bbzvm_instr BittyBuzzVm::getInstruction ( ) const
overridevirtual

Get the current instruction of the VM.

Implements IBittyBuzzVm.

◆ getState()

bbzvm_state BittyBuzzVm::getState ( ) const
overridevirtual

Get the state of the vm.

Implements IBittyBuzzVm.

Here is the caller graph for this function:

◆ init()

bool BittyBuzzVm::init ( const std::reference_wrapper< IBittyBuzzLib > *  bbzLibs,
uint32_t  bbzLibsLength 
)
overridevirtual

Init the virtual machine.

Parameters
bbzLibsan array of the libraries to init
bbzLibsLengththe length of the libraries to init

Implements IBittyBuzzVm.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ logDump()

void BittyBuzzVm::logDump ( LogLevel  logLevel)
overridevirtual

Logs the virtual machine state, stack, heap and table segments.

Parameters
logLevelThe desired log level for the dumped information

Implements IBittyBuzzVm.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ start()

bool BittyBuzzVm::start ( )
overridevirtual

Starts the vm.

Implements IBittyBuzzVm.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ step()

BBVMRet BittyBuzzVm::step ( )
overridevirtual

Does one execution step in the virtual machine. Thus execute the buzz code in the step function.

Implements IBittyBuzzVm.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stop()

void BittyBuzzVm::stop ( )
overridevirtual

Stops the vm, can be called in another thread or in an interrupt.

Implements IBittyBuzzVm.

Here is the caller graph for this function:

◆ terminate()

void BittyBuzzVm::terminate ( )
overridevirtual

Terminate the virtual machine and removes all messages that were supposed to be processed.

Implements IBittyBuzzVm.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_bbzVm

bbzvm_t BittyBuzzVm::m_bbzVm
private

◆ m_bsp

const IBSP& BittyBuzzVm::m_bsp
private

◆ m_bytecode

const IBittyBuzzBytecode& BittyBuzzVm::m_bytecode
private

◆ m_closureRegister

IBittyBuzzClosureRegister& BittyBuzzVm::m_closureRegister
private

◆ m_logger

ILogger& BittyBuzzVm::m_logger
private

◆ m_messageHandler

IBittyBuzzMessageHandler& BittyBuzzVm::m_messageHandler
private

◆ m_messageService

IBittyBuzzMessageService& BittyBuzzVm::m_messageService
private

◆ m_neighborsManager

IBittyBuzzNeighborsManager& BittyBuzzVm::m_neighborsManager
private

◆ m_ui

IUserInterface& BittyBuzzVm::m_ui
private

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