:)
Loading...
Searching...
No Matches
RustyCLI Class Reference

CLI class on low-priority UI thread. More...

#include <RustyCLI.hpp>

Public Member Functions

 RustyCLI (const CLIcallback &cb)
 Constructor for RustyCLI.
 
void run ()
 Initialises CLI.
 
void parser (std::string rawInput)
 Parses user input from CLI run()
 
void commandHandler ()
 Handles parsed commands from parser()
 
void listCommand ()
 Prints list of commands.
 

Private Attributes

CLIcallback _callback
 CLI callback.
 
std::vector< std::string > _inputParsed
 Vector of input words.
 
std::vector< std::string > topLevelCommands {"-ls", "--list", "-p", "--processors", "-m", "--modulators", "-param"}
 Vector of commands.
 

Detailed Description

CLI class on low-priority UI thread.

This class handles user interaction with RustyProcessor instances and RustyModulator instances. Running on a dedicated thread to ensure it doesn't interfere with high priority audio thread.

Definition at line 30 of file RustyCLI.hpp.

Constructor & Destructor Documentation

◆ RustyCLI()

RustyCLI::RustyCLI ( const CLIcallback &  cb)
inline

Constructor for RustyCLI.


Takes initial parameters for RustyCLI which is just a callback reference to RustyAudioLib. This allows parsing functions inside the CLI to callback to RustyAudioLibAPI which then calls relevant functions in the RustyAudioEngine.

Parameters
CLIcallbackTakes reference to function for callback

Definition at line 44 of file RustyCLI.hpp.

◆ ~RustyCLI()

RustyCLI::~RustyCLI ( )
inline

Definition at line 45 of file RustyCLI.hpp.

Member Function Documentation

◆ run()

void RustyCLI::run ( )

Initialises CLI.


Initialises CLI by beginning infinite loop that listens for user console input. From here user input is passed to the parser() and then the commandHandler().

See also
parser()
commandHandler()

Definition at line 3 of file RustyCLI.cpp.

◆ parser()

void RustyCLI::parser ( std::string  rawInput)

Parses user input from CLI run()


Parses user input on a char by char basis. Function splits input at whitespaces and places full strings of the command words into a vector of parsed commands.

See also
commandHandler()

Definition at line 19 of file RustyCLI.cpp.

◆ commandHandler()

void RustyCLI::commandHandler ( )

Handles parsed commands from parser()


A series of logic statements that determine whether the user input was a good input or not. If bad there should be a corresponding error message and the commands will be deleted before execution to avoid runtime crashes.

See also
parser()

Definition at line 39 of file RustyCLI.cpp.

◆ listCommand()

void RustyCLI::listCommand ( )

Prints list of commands.


Separated list command into it's own function to allow formatting of the text easier.

Definition at line 77 of file RustyCLI.cpp.

Member Data Documentation

◆ _callback

CLIcallback RustyCLI::_callback
private

CLI callback.

Definition at line 95 of file RustyCLI.hpp.

◆ _inputParsed

std::vector<std::string> RustyCLI::_inputParsed
private

Vector of input words.

Definition at line 96 of file RustyCLI.hpp.

◆ topLevelCommands

std::vector<std::string> RustyCLI::topLevelCommands {"-ls", "--list", "-p", "--processors", "-m", "--modulators", "-param"}
private

Vector of commands.

Definition at line 97 of file RustyCLI.hpp.


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