12 #ifndef OPENVDB_AX_CODEGEN_FUNCTION_REGISTRY_HAS_BEEN_INCLUDED 13 #define OPENVDB_AX_CODEGEN_FUNCTION_REGISTRY_HAS_BEEN_INCLUDED 19 #include <openvdb/version.h> 21 #include <unordered_map> 43 using Ptr = std::shared_ptr<FunctionRegistry>;
44 using UniquePtr = std::unique_ptr<FunctionRegistry>;
56 : mConstructor(creator), mFunction(), mInternal(internal) {}
63 inline const FunctionGroup*
function()
const {
return mFunction.get(); }
74 using RegistryMap = std::unordered_map<std::string, RegisteredFunction>;
82 void insert(
const std::string& identifier,
84 const bool internal =
false);
93 void insertAndCreate(
const std::string& identifier,
96 const bool internal =
false);
105 const FunctionGroup* getOrInsert(
const std::string& identifier,
107 const bool allowInternalAccess);
116 const bool allowInternalAccess)
const;
128 inline bool empty()
const {
return mMap.empty(); }
131 inline void clear() { mMap.clear(); }
142 llvm::LLVMContext* CPtr,
158 #endif // OPENVDB_AX_CODEGEN_FUNCTION_REGISTRY_HAS_BEEN_INCLUDED OPENVDB_AX_API std::pair< FunctionRegistry *, FunctionOptions > GetMappedFunctionRegistry(llvm::LLVMContext *CPtr)
Definition: FunctionRegistry.h:23
bool isInternal() const
Check whether this function should be only internally accesible.
Definition: FunctionRegistry.h:66
Options that control how functions behave.
Definition: CompilerOptions.h:24
void create(const FunctionOptions &op)
Create a function object using this creator of this function.
Definition: FunctionRegistry.h:60
std::unique_ptr< FunctionGroup > UniquePtr
Definition: FunctionTypes.h:1392
FunctionGroup::UniquePtr(*)(const FunctionOptions &) ConstructorT
Definition: FunctionRegistry.h:42
Contains frameworks for creating custom AX functions which can be registered within the FunctionRegis...
OPENVDB_AX_API void InsertMappedFunctionRegistry(llvm::LLVMContext *CPtr, FunctionRegistry *reg, const FunctionOptions &opts)
std::shared_ptr< FunctionGroup > Ptr
Definition: FunctionTypes.h:1391
std::unordered_map< std::string, RegisteredFunction > RegistryMap
Definition: FunctionRegistry.h:74
A group of functions which all have the same name but different signatures. For example: float abs(fl...
Definition: FunctionTypes.h:1389
bool empty() const
Return whether or not the registry is empty.
Definition: FunctionRegistry.h:128
Definition: Exceptions.h:13
OPENVDB_AX_API bool RemoveMappedFunctionRegistry(llvm::LLVMContext *CPtr)
OpenVDB AX Compiler Options.
The function registry which is used for function code generation. Each time a function is visited wit...
Definition: FunctionRegistry.h:39
void clear()
Clear the underlying function registry.
Definition: FunctionRegistry.h:131
std::unique_ptr< FunctionRegistry > UniquePtr
Definition: FunctionRegistry.h:44
An object to represent a registered function, storing its constructor, a pointer to the function defi...
Definition: FunctionRegistry.h:50
const RegistryMap & map() const
Return a const reference to the current registry map.
Definition: FunctionRegistry.h:125
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:121
std::shared_ptr< FunctionRegistry > Ptr
Definition: FunctionRegistry.h:43
RegisteredFunction(const ConstructorT &creator, const bool internal=false)
Constructor.
Definition: FunctionRegistry.h:55
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:218