|
OpenVDB 11.0.0
|
The function registry which is used for function code generation. Each time a function is visited within the AST, its identifier is used as a key into this registry for the corresponding function retrieval and execution. Functions can be inserted into the registry using insert() with a given identifier and pointer. More...
#include <openvdb_ax/codegen/FunctionRegistry.h>
Classes | |
| struct | RegisteredFunction |
| An object to represent a registered function, storing its constructor, a pointer to the function definition and whether it should only be available internally (i.e. to a developer, not a user) More... | |
Public Types | |
| using | ConstructorT = FunctionGroup::UniquePtr(*)(const FunctionOptions &) |
| using | Ptr = std::shared_ptr< FunctionRegistry > |
| using | UniquePtr = std::unique_ptr< FunctionRegistry > |
| using | RegistryMap = std::unordered_map< std::string, RegisteredFunction > |
Public Member Functions | |
| void | insert (const std::string &identifier, const ConstructorT creator, const bool internal=false) |
| Insert and register a function object to a function identifier. | |
| void | insertAndCreate (const std::string &identifier, const ConstructorT creator, const FunctionOptions &op, const bool internal=false) |
| Insert and register a function object to a function identifier. | |
| const FunctionGroup * | getOrInsert (const std::string &identifier, const FunctionOptions &op, const bool allowInternalAccess) |
| Return the corresponding function from a provided function identifier. | |
| const FunctionGroup * | get (const std::string &identifier, const bool allowInternalAccess) const |
| Return the corresponding function from a provided function identifier. | |
| void | createAll (const FunctionOptions &op, const bool verify=false) |
| Force the (re)creations of all function objects for all registered functions. | |
| const RegistryMap & | map () const |
| Return a const reference to the current registry map. | |
| bool | empty () const |
| Return whether or not the registry is empty. | |
| void | clear () |
| Clear the underlying function registry. | |
The function registry which is used for function code generation. Each time a function is visited within the AST, its identifier is used as a key into this registry for the corresponding function retrieval and execution. Functions can be inserted into the registry using insert() with a given identifier and pointer.
| using Ptr = std::shared_ptr<FunctionRegistry> |
| using RegistryMap = std::unordered_map<std::string, RegisteredFunction> |
| using UniquePtr = std::unique_ptr<FunctionRegistry> |
|
inline |
Clear the underlying function registry.
Force the (re)creations of all function objects for all registered functions.
| op | The current function options |
| verify | Checks functions are created and have valid identifiers/symbols |
|
inline |
Return whether or not the registry is empty.
| const FunctionGroup * get | ( | const std::string & | identifier, |
| const bool | allowInternalAccess | ||
| ) | const |
Return the corresponding function from a provided function identifier.
| identifier | The function identifier |
| allowInternalAccess | Whether to look in the 'internal' functions |
| const FunctionGroup * getOrInsert | ( | const std::string & | identifier, |
| const FunctionOptions & | op, | ||
| const bool | allowInternalAccess | ||
| ) |
Return the corresponding function from a provided function identifier.
| identifier | The function identifier |
| op | FunctionOptions to pass the function constructor |
| allowInternalAccess | Whether to look in the 'internal' functions |
| void insert | ( | const std::string & | identifier, |
| const ConstructorT | creator, | ||
| const bool | internal = false |
||
| ) |
Insert and register a function object to a function identifier.
| identifier | The function identifier to register |
| creator | The function to link to the provided identifier |
| internal | Whether to mark the function as only internally accessible |
| void insertAndCreate | ( | const std::string & | identifier, |
| const ConstructorT | creator, | ||
| const FunctionOptions & | op, | ||
| const bool | internal = false |
||
| ) |
Insert and register a function object to a function identifier.
| identifier | The function identifier to register |
| creator | The function to link to the provided identifier |
| op | FunctionOptions to pass the function constructor |
| internal | Whether to mark the function as only internally accessible |
|
inline |
Return a const reference to the current registry map.