MTMS main
Modern Turing Machine Simulator
Loading...
Searching...
No Matches
Project Class Reference

Orchestrates configuration ingestion and state saves, abstraction layer bridging core computation with external interfaces (CLI/GUI). More...

#include <project.hpp>

Collaboration diagram for Project:

Public Member Functions

std::shared_ptr< TuringMachineget_machine () noexcept
 Retrieves the pointer to the active Turing Machine instance.
 
std::string_view get_name () const noexcept
 Retrieves the project's friendly configuration name.
 
bool has_active_machine () const noexcept
 Checks if there is a valid Turing Machine instance active.
 
bool load_project (const std::filesystem::path &filepath) noexcept(false)
 Parses a TM configuration file using toml++ and instantiates the TuringMachine.
 
 Project () noexcept
 
bool save_project (const std::filesystem::path &filepath) const noexcept(false)
 Exports the current machine configuration snapshot back to a TOML file.
 

Private Member Functions

bool parse_metadata (const toml::table &config) noexcept
 Extracts project identification block from TOML file.
 

Static Private Member Functions

static std::unordered_set< std::string > compute_reachability (const std::string &start_state, const std::unordered_map< std::string, std::vector< std::string > > &graph) noexcept(false)
 Computes reaching pathways from the start state over the adjacency graph via DFS.
 
static bool parse_alphabets (const toml::table &config, Alphabet &input_alpha, Alphabet &tape_alpha) noexcept(false)
 Validates and builds formal inclusion alphabets (Sigma and Gamma matrices).
 
static bool parse_states (const toml::table &config, std::set< State > &parsed_states, State &initial_state, std::unordered_map< std::string, State > &state_map) noexcept(false)
 Parses and instantiates structural computational states from TOML configuration array.
 
static bool parse_transitions (const toml::table &config, std::size_t tape_count, const std::unordered_map< std::string, State > &state_map, const std::shared_ptr< TuringMachine > &machine, std::unordered_map< std::string, std::vector< std::string > > &graph) noexcept(false)
 Decodes the matrix table containing legal execution step pathways.
 
static bool validate_machine_structure (const std::set< State > &parsed_states, const std::unordered_set< std::string > &reachable, const std::unordered_map< std::string, std::vector< std::string > > &graph) noexcept(false)
 Verifies structural integrity rules against isolated or broken nodes.
 

Private Attributes

std::string description_
 Project description block or summary.
 
std::shared_ptr< TuringMachinemachine_
 Active Turing Machine computation engine backend.
 
std::string name_
 Friendly identifier extracted from config metadata.
 

Detailed Description

Orchestrates configuration ingestion and state saves, abstraction layer bridging core computation with external interfaces (CLI/GUI).

Definition at line 30 of file project.hpp.

Constructor & Destructor Documentation

◆ Project()

Project::Project ( )
inlinenoexcept

Definition at line 33 of file project.hpp.

Member Function Documentation

◆ compute_reachability()

std::unordered_set< std::string > Project::compute_reachability ( const std::string &  start_state,
const std::unordered_map< std::string, std::vector< std::string > > &  graph 
)
staticprivate

Computes reaching pathways from the start state over the adjacency graph via DFS.

Parameters
start_stateThe initial root label node token to start traversal.
graphThe static structural matrix tracker.
Returns
std::unordered_set<std::string> Set containing labels of all states reached from start.

Definition at line 203 of file project.cpp.

◆ get_machine()

std::shared_ptr< TuringMachine > Project::get_machine ( )
inlinenoexcept

Retrieves the pointer to the active Turing Machine instance.

Returns
std::shared_ptr<TuringMachine> The shared reference to the machine.

Definition at line 59 of file project.hpp.

References machine_.

Referenced by main().

◆ get_name()

std::string_view Project::get_name ( ) const
inlinenoexcept

Retrieves the project's friendly configuration name.

Returns
std::string_view View of the project name.

Definition at line 65 of file project.hpp.

References name_.

◆ has_active_machine()

bool Project::has_active_machine ( ) const
inlinenoexcept

Checks if there is a valid Turing Machine instance active.

Returns
true If machine_ is not null, false otherwise.

Definition at line 53 of file project.hpp.

References machine_.

◆ load_project()

bool Project::load_project ( const std::filesystem::path &  filepath)

Parses a TM configuration file using toml++ and instantiates the TuringMachine.

Parameters
filepathPath to the target validation .toml file.
Returns
true If serialization and validation passed smoothly, false otherwise.

Definition at line 265 of file project.cpp.

References Alphabet::contains().

Referenced by main().

◆ parse_alphabets()

bool Project::parse_alphabets ( const toml::table &  config,
Alphabet input_alpha,
Alphabet tape_alpha 
)
staticprivate

Validates and builds formal inclusion alphabets (Sigma and Gamma matrices).

Parameters
configReference to the parsed TOML table structure.
input_alphaOutput destination reference holding the parsed Sigma symbols subset.
tape_alphaOutput destination reference holding the parsed Gamma symbols subset.
Returns
true If sets do not breach standard formal rules (e.g., Sigma containing Blank character).

Definition at line 62 of file project.cpp.

References Symbol::get_char(), and kBlank.

◆ parse_metadata()

bool Project::parse_metadata ( const toml::table &  config)
privatenoexcept

Extracts project identification block from TOML file.

Parameters
configReference to the loaded TOML table root structure.
Returns
true If extraction succeeded without strict type breaks.

Definition at line 20 of file project.cpp.

◆ parse_states()

bool Project::parse_states ( const toml::table &  config,
std::set< State > &  parsed_states,
State initial_state,
std::unordered_map< std::string, State > &  state_map 
)
staticprivate

Parses and instantiates structural computational states from TOML configuration array.

Parameters
configReference to the parsed TOML table structure.
parsed_statesTarget unique set to populate with active valid states.
initial_stateOutput wrapper reference pointing to the set's verified initial state node.
state_mapReference dictionary mapping text state keys to object values for sub-routine lookup.
Returns
true If states are successfully declared without critical key duplicates.

Definition at line 27 of file project.cpp.

◆ parse_transitions()

bool Project::parse_transitions ( const toml::table &  config,
std::size_t  tape_count,
const std::unordered_map< std::string, State > &  state_map,
const std::shared_ptr< TuringMachine > &  machine,
std::unordered_map< std::string, std::vector< std::string > > &  graph 
)
staticprivate

Decodes the matrix table containing legal execution step pathways.

Parameters
configReference to the parsed TOML table structure.
tape_countDimensional bounds required per sub-array alignment.
state_mapInternal registry to cross-reference mapped text nodes against objects.
machineShared pointer to the active Turing Machine instance to populate with transitions.
graphAdjacency map tracker built to accelerate structural connectivity queries.
Returns
true If arrays successfully map out a valid deterministic runtime framework.

Definition at line 107 of file project.cpp.

References kBlank, LEFT, RIGHT, and STAY.

◆ save_project()

bool Project::save_project ( const std::filesystem::path &  filepath) const

Exports the current machine configuration snapshot back to a TOML file.

Parameters
filepathOutput path footprint.
Returns
true On successful file flush.

Definition at line 331 of file project.cpp.

References LEFT, and RIGHT.

Referenced by main().

◆ validate_machine_structure()

bool Project::validate_machine_structure ( const std::set< State > &  parsed_states,
const std::unordered_set< std::string > &  reachable,
const std::unordered_map< std::string, std::vector< std::string > > &  graph 
)
staticprivate

Verifies structural integrity rules against isolated or broken nodes.

Parameters
parsed_statesUnique set containing every configured state object.
reachableEvaluated cluster tracking every accessible node token.
graphStructural adjacency map tracker.
Returns
true If there are no non-accepting states missing critical processing pathways.

Definition at line 235 of file project.cpp.

Member Data Documentation

◆ description_

std::string Project::description_
private

Project description block or summary.

Definition at line 70 of file project.hpp.

◆ machine_

std::shared_ptr<TuringMachine> Project::machine_
private

Active Turing Machine computation engine backend.

Definition at line 68 of file project.hpp.

Referenced by get_machine(), and has_active_machine().

◆ name_

std::string Project::name_
private

Friendly identifier extracted from config metadata.

Definition at line 69 of file project.hpp.

Referenced by get_name().


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