libgsjj  1
Deterministic finite automata learning library
Static Protected Attributes | List of all members
gsjj::passive::RegisterInFactory< T > Class Template Reference

Helps to register a method in the factory. More...

#include <MethodFactory.h>

Static Protected Attributes

static bool s_registered
 Useful to make sure the template is correctly used by the compiler. More...
 

Detailed Description

template<typename T>
class gsjj::passive::RegisterInFactory< T >

Helps to register a method in the factory.

To register a method (through this helper), the method must inherit from RegisterInFactory (and specify the typename). Due to the annoying (in this context) compiler's optimisations, the method must also have a line that uses s_registered. For example, adding s_registered = s_registered in any function of the method makes everything working as intented.

Each class inheriting this class must implement a function with the following signature :

 static std::string getFactoryName()

The constructor of the class must have the same signature than the built-in methods' constructors (see, for example, gsjj::passive::SMT::BiermannMethod::BiermannMethod)

Template Parameters
TThe type of the method to register

Definition at line 84 of file MethodFactory.h.

Member Data Documentation

◆ s_registered

template<typename T>
bool gsjj::passive::RegisterInFactory< T >::s_registered
staticprotected
Initial value:
= MethodFactory::registerMethod(T::getFactoryName(),
[](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) -> MethodFactory::MethodPtr {
class MethodImplemented : public T {
public:
MethodImplemented(const std::set<std::string> &SpSet, const std::set<std::string> &SmSet, const std::set<std::string> &SSet, const std::set<std::string> &prefixesSet, const std::set<char> &alphabetSet, unsigned int n) : T(SpSet, SmSet, SSet, prefixesSet, alphabetSet, n) {}
};
return std::move(std::make_unique<MethodImplemented>(Sp, Sm, S, prefixes, alphabet, n));
}
)

Useful to make sure the template is correctly used by the compiler.

Please add a line such as

 s_registered = s_registered;

anywhere in the class that inherits this helper.

By default, this variable asks to map T::getFactoryName() to a way to construct T.

Definition at line 97 of file MethodFactory.h.


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