|
libgsjj
1
Deterministic finite automata learning library
|
The Factory Builder design pattern adapted to our methods. More...
#include <MethodFactory.h>
Public Types | |
| using | MethodPtr = std::unique_ptr< Method > |
| The type the function create will return. More... | |
| using | MethodConstructor = std::function< MethodPtr(const std::set< std::string > &Sp, const std::set< std::string > &Sm, const std::set< std::string > &S, const std::set< std::string > &prefixes, const std::set< char > &alphabet, unsigned int n)> |
| The type of the constructor the registerMethod must receive. More... | |
Public Member Functions | |
| MethodFactory ()=delete | |
Static Public Member Functions | |
| static bool | registerMethod (const std::string &name, MethodConstructor const &constructor) |
| Registers a method. More... | |
| static MethodPtr | create (const std::string &name, unsigned int n, const std::set< std::string > &Sp, const std::set< std::string > &Sm, const std::set< std::string > &S, const std::set< std::string > &prefixes, const std::set< char > &alphabet) |
| Creates a unique_ptr to a method. More... | |
The Factory Builder design pattern adapted to our methods.
The methods must register themselves to this factory.
Some implementation details are inspired from https://dzone.com/articles/factory-with-self-registering-types
Definition at line 19 of file MethodFactory.h.
| using gsjj::passive::MethodFactory::MethodConstructor = std::function<MethodPtr( const std::set<std::string>& Sp, const std::set<std::string>& Sm, const std::set<std::string>& S, const std::set<std::string>& prefixes, const std::set<char>& alphabet, unsigned int n )> |
The type of the constructor the registerMethod must receive.
Definition at line 35 of file MethodFactory.h.
| using gsjj::passive::MethodFactory::MethodPtr = std::unique_ptr<Method> |
The type the function create will return.
Definition at line 24 of file MethodFactory.h.
|
delete |
|
static |
Creates a unique_ptr to a method.
The method must have been registered before!
Please use constructMethod instead of this function
| name | The name of the method to construct |
| n | The number of states |
| Sp | The set |
| Sm | The set |
| S | The |
| prefixes | The prefixes set |
| alphabet | The alphabet |
Definition at line 31 of file MethodFactory.cpp.
|
static |
Registers a method.
| name | The name of the method to register |
| constructor | A pointer to the constructor of the method |
Definition at line 19 of file MethodFactory.cpp.
1.8.13