13#if !defined(VITA_PRIMITIVE_FACTORY_H)
14#define VITA_PRIMITIVE_FACTORY_H
43 std::unique_ptr<symbol>
make(
const std::string &, cvect = {0});
49 std::size_t
args(
const std::string &)
const;
52 using build_func = std::unique_ptr<symbol> (*)(
const cvect &);
54 template<
class T>
static std::unique_ptr<symbol> build(
const cvect &c)
55 {
return std::make_unique<T>(c); }
64 std::map<std::string, build_info> factory_;
81 return factory_.insert({name, build_info{build<T>, n}}).second;
An abstract factory for symbols.
symbol_factory()
The factory is preloaded with a number of common symbols.
std::size_t args(const std::string &) const
bool unregister_symbol(const std::string &)
Unregister the symbol from the factory.
std::unique_ptr< symbol > make(const std::string &, cvect={0})
Creates a specific instance of a symbol.
bool register_symbol(const std::string &, std::size_t)
Registers a new symbol inside the factory.
The main namespace for the project.
domain_t
In an environment where a symbol such as '+' may have many different meanings, it's useful to specify...
std::size_t category_t
A category provide operations which supplement or supersede those of the domain but which are restric...