|
AsmGrader 0.0.0
|
A global singleton registrar. Used with Assignments for now.
More...
#include <global_registrar.hpp>
Public Member Functions | |
| void | add_test (std::unique_ptr< TestBase > test) noexcept |
| Registers the test to be made accessible. | |
| template<typename Func > requires (std::is_void_v<std::invoke_result_t<Func, Assignment>>) | |
| void | for_each_assignment (Func &&fun) |
| template<typename Func > requires (!std::is_void_v<std::invoke_result_t<Func, Assignment>>) | |
| std::vector< std::invoke_result_t< Func, Assignment > > | for_each_assignment (Func &&fun) |
| auto | get_assignments () noexcept |
| std::optional< std::reference_wrapper< Assignment > > | get_assignment (std::string_view name) |
| template<typename... MetadataAttrs> | |
| Assignment & | find_or_create_assignment (metadata::Metadata< MetadataAttrs... > metadata) |
Find the assignment corresponding to the Assignment attribute of metadata, or create a new assignment if one does not exist. | |
| std::vector< std::string_view > | get_assignment_names () |
| Obtain a list of all assignment names. | |
| std::size_t | get_num_registered () const |
Static Public Member Functions | |
| static GlobalRegistrar & | get () noexcept |
| Safe global singleton pattern (first intro. by Scott Meyers for C++, I think) | |
A global singleton registrar. Used with Assignments for now.
Construct this class with the assignment we want to register, and that assignement will be made accessible at the CLI-level, premitting the user to run the grader on that assignment.
add might be better named register if not for the fact for it being a reserved keyword.
|
noexcept |
Registers the test to be made accessible.
| Assignment & asmgrader::GlobalRegistrar::find_or_create_assignment | ( | metadata::Metadata< MetadataAttrs... > | metadata | ) |
Find the assignment corresponding to the Assignment attribute of metadata, or create a new assignment if one does not exist.
| void asmgrader::GlobalRegistrar::for_each_assignment | ( | Func && | fun | ) |
| std::vector< std::invoke_result_t< Func, Assignment > > asmgrader::GlobalRegistrar::for_each_assignment | ( | Func && | fun | ) |
|
staticnoexcept |
Safe global singleton pattern (first intro. by Scott Meyers for C++, I think)
|
inline |
| std::vector< std::string_view > asmgrader::GlobalRegistrar::get_assignment_names | ( | ) |
Obtain a list of all assignment names.
|
inlinenoexcept |
| std::size_t asmgrader::GlobalRegistrar::get_num_registered | ( | ) | const |