semf
semf::esh::Processor Class Reference

Manages esh's command parsing and execution. More...

#include <processor.h>

Collaboration diagram for semf::esh::Processor:
Collaboration graph

Public Types

enum class  ErrorCode : uint8_t { LoadCommand_IsBusy = 0 }
 Error codes for this class. Error ID identify a unique error() / onError call (excluding transferring). More...
 

Public Member Functions

 Processor (const LinkedList< Command > &commands, Printer &printer, char lineBuffer[], size_t lineBufferSize, char **argvBuffer, size_t argvBufferSize)
 Constructor. More...
 
 Processor (const Processor &other)=delete
 
virtual ~Processor ()=default
 
void loadCommand ()
 Load a command for execution according to the current command line. More...
 
void execLoadedCommand ()
 Execute the currenty loaded command. Returns with no error if no command is loaded. Unloads the loaded command after execution. More...
 
 SEMF_SIGNAL (done)
 
 SEMF_SIGNAL (error, Error)
 

Detailed Description

Manages esh's command parsing and execution.

Definition at line 25 of file processor.h.

Member Enumeration Documentation

◆ ErrorCode

enum class semf::esh::Processor::ErrorCode : uint8_t
strong

Error codes for this class. Error ID identify a unique error() / onError call (excluding transferring).

Enumerator
LoadCommand_IsBusy 

Definition at line 31 of file processor.h.

Constructor & Destructor Documentation

◆ Processor() [1/2]

semf::esh::Processor::Processor ( const LinkedList< Command > &  commands,
Printer printer,
char  lineBuffer[],
size_t  lineBufferSize,
char **  argvBuffer,
size_t  argvBufferSize 
)

Constructor.

Parameters
commandsList of available commands.
printerPrinter for printing.
lineBufferBuffer containing the current command line.
lineBufferSizeSize of lineBuffer .
argvBufferPointer array of char* for pointing to arguments. The upper bound for this buffer is lineBufferSize / 2. The lower bound is 1 (no command takes parameters).
argvBufferSizeLength of argvBuffer .

Definition at line 16 of file processor.cpp.

◆ Processor() [2/2]

semf::esh::Processor::Processor ( const Processor other)
delete

◆ ~Processor()

virtual semf::esh::Processor::~Processor ( )
virtualdefault

Member Function Documentation

◆ execLoadedCommand()

void semf::esh::Processor::execLoadedCommand ( )

Execute the currenty loaded command. Returns with no error if no command is loaded. Unloads the loaded command after execution.

Definition at line 56 of file processor.cpp.

Here is the caller graph for this function:

◆ loadCommand()

void semf::esh::Processor::loadCommand ( )

Load a command for execution according to the current command line.

Exceptions
LoadCommand_IsBusyIf object is busy.

Definition at line 27 of file processor.cpp.

◆ SEMF_SIGNAL() [1/2]

semf::esh::Processor::SEMF_SIGNAL ( done  )

Gets emitted after the loaded command was executed.

◆ SEMF_SIGNAL() [2/2]

semf::esh::Processor::SEMF_SIGNAL ( error  ,
Error   
)

Gets emitted on errors.