HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
apex::APEX_Registry Class Reference

#include <APEX_Registry.h>

+ Inheritance diagram for apex::APEX_Registry:

Public Member Functions

 ~APEX_Registry ()
 
 UT_NON_COPYABLE (APEX_Registry)
 
exint numCallbacks (bool include_ancestors=false) const
 Returns the number of callback nodes in the registry. More...
 
const APEX_FunctionBasegetCallback (const UT_StringRef &callback_name, bool include_ancestors=false) const
 Finds the named callback node in the registry. More...
 
APEX_OverloadSetPtr getOverloadSet (const UT_StringRef &name, bool include_ancestors=false) const
 
void iterCallbacks (const UT_Function< void(const APEX_FunctionBase &)> &f, bool include_ancestors=false) const
 Visits all callback nodes and executes the provided function object. More...
 
void iterSubGraphs (const UT_Function< void(const APEX_COWHandle< APEX_Graph > &)> &f, bool include_ancestors=false) const
 Visits all subgraph nodes and executes the provided function object. More...
 
void loadCallbackLibrary (const char *dllpath)
 
bool loadSubGraphLibrary (const char *filepath)
 Loads the subgraph node library (saved as a .bgeo) at the filepath. More...
 
bool loadSubGraphLibrary (const GU_DetailHandle &gdh, const char *filepath="", bool replace=false)
 Loads the subgraph node library from an in memory geometry. More...
 
void loadCompatibilityFile (const char *filepath)
 Loads the compatibility file at the filepath. More...
 
void clearSubGraphs (bool except_geo_loaded=false)
 
void reloadSubGraphLibraries ()
 
exint numSubGraphs (bool include_ancestors=false) const
 Returns the number of subgraph nodes tracked by the registry. More...
 
UT_StringArray getSubGraphNames (const char *version=nullptr, bool include_ancestors=false) const
 Returns an array of subgraph node names. More...
 
const UT_StringHoldergetSubGraphPath (const UT_StringRef &name, bool include_ancestors=false) const
 
const ApexGeometrygetSubGraphGeo (const UT_StringRef &name, bool include_ancestors=false) const
 Returns the subgraph node's geometry representation. More...
 
const APEX_COWHandle
< APEX_Graph > & 
getSubGraph (const UT_StringRef &name, bool include_ancestors=false) const
 Returns the named subgraph node as an APEX_Graph. More...
 
const APEX_CompatibilityMapgetCompatibilityMap () const
 
UT_UniquePtr
< APEX_CompatibilityMap::CompatibilityResolver
getCompatibilityResolver (const UT_StringRef &name, const char *version="", bool include_ancestors=false) const
 
UT_NotifierImpl< const
APEX_RegistryEvent & > & 
getEventNotifier ()
 
GA_DataId getDataId () const
 
 APEX_Registry (const UT_StringHolder &registry_graph_folder, const APEX_RegistryPtrList &parent_registries, const PassKey &)
 Use the createRegistry factory method to create a new registry. More...
 
void addCallback (const APEX_FunctionBase *f)
 
void addCallbacks (std::vector< const APEX_FunctionBase * > &&funcs)
 
GenericFunctions

Generic Functions (functions agnostic to being a callback or subgraph).

bool containsName (const UT_StringRef &name, bool include_ancestors=false) const
 
UT_StringArray findMatchingNames (const char *pattern="*", const char *version="", bool include_ancestors=false) const
 
UT_StringHolder getLatestName (const UT_StringRef &name, bool include_ancestors=false) const
 
void getNamesInPrecedenceOrder (UT_StringArray &precedence_order, const char *fullname, bool include_ancestors=false) const
 
UT_StringHolder getIconName (const UT_StringRef &name, bool include_ancestors=false) const
 
bool getIsHidden (const UT_StringRef &name, bool include_ancestors=false) const
 Returns true if the node should be hidden from the UI. More...
 
UT_StringHolder getMinProductVersion (const UT_StringRef &name, bool include_ancestors=false) const
 Returns the version number in which the node was introduced. More...
 
const DictgetParmDefaults (const UT_StringRef &name, bool include_ancestors=false) const
 Returns the node's default parameters. More...
 
APEX_Signature getSignature (const UT_StringRef &name, bool include_ancestors=false) const
 Returns the signature of the node. More...
 

Static Public Member Functions

static UT_ArrayStringMap
< UT_SharedPtr< APEX_Registry > > & 
allRegistries ()
 Returns the global registry map. Registries are looked up by their name. More...
 
static UT_SharedPtr
< APEX_Registry
findOrCreateRegistry (APEX_RegistryType reg_type)
 Returns the APEX registry using its registry type. More...
 
static APEX_RegistryPtr findRegistry (const UT_StringRef &reg_name)
 Find a registry by its name. More...
 
static APEX_RegistryPtr createRegistry (const UT_StringRef &reg_name, const UT_StringHolder &reg_graph_folder="", const APEX_RegistryPtrList &parent_registries=APEX_RegistryPtrList(), bool add_to_registry_map=true)
 
static UT_SharedPtr
< APEX_Registry
findOrCreateCallbackRegistry (bool load_subgraphs=true)
 Returns the APEX registries. More...
 
static UT_SharedPtr
< APEX_Registry
findOrCreateComponentRegistry (bool load_subgraphs=true)
 Returns the APEX registries. More...
 
static UT_SharedPtr
< APEX_Registry
findOrCreateConstraintRegistry (bool load_subgraphs=true)
 Returns the APEX registries. More...
 
static UT_SharedPtr
< APEX_Registry
findOrCreateControlRegistry (bool load_subgraphs=true)
 Returns the APEX registries. More...
 

Static Public Attributes

static constexpr UT_StringLit theCategoryName = "Apex"
 
static constexpr UT_StringLit theDSOFolder = "apexdso"
 
static constexpr UT_StringLit theCallbackRegistryName = "callback"
 
static constexpr UT_StringLit theCallbackRegistryGraphFolder = "apexgraph"
 
static constexpr UT_StringLit theComponentRegistryName = "component"
 
static constexpr UT_StringLit theComponentRegistryGraphFolder = "apexcomponent"
 
static constexpr UT_StringLit theConstraintRegistryName = "constraint"
 
static constexpr UT_StringLit theConstraintRegistryGraphFolder = "apexconstraint"
 
static constexpr UT_StringLit theControlRegistryName = "control"
 
static constexpr UT_StringLit theControlRegistryGraphFolder = "apexcontrol"
 

Detailed Description

Registries track callback nodes and subgraph nodes. Registries are created in a hierarchy. The "callback" registry holds the essential nodes used by descendent registries. For instance, the "callback" registry is the parent of the "component" registry (which tracks rig component subgraphs). So, each rig component subgraph in the "component" registry can make use of the callback nodes and subgraph nodes available in its parent registry.

Examples:
APEX/apex_external_test.C.

Definition at line 94 of file APEX_Registry.h.

Constructor & Destructor Documentation

apex::APEX_Registry::~APEX_Registry ( )
apex::APEX_Registry::APEX_Registry ( const UT_StringHolder registry_graph_folder,
const APEX_RegistryPtrList parent_registries,
const PassKey &   
)

Use the createRegistry factory method to create a new registry.

Member Function Documentation

void apex::APEX_Registry::addCallback ( const APEX_FunctionBase f)

Adds a new callback node to the registry. The registry holds a pointer to the callback function and does not participate in lifetime management of the callback. Therefore, the callback object must exist for the lifetime of the registry.

Examples:
APEX/apex_external_test.C.
void apex::APEX_Registry::addCallbacks ( std::vector< const APEX_FunctionBase * > &&  funcs)

Adds a new callback node to the registry. The registry holds a pointer to the callback function and does not participate in lifetime management of the callback. Therefore, the callback object must exist for the lifetime of the registry.

UT_ArrayStringMap< UT_SharedPtr< APEX_Registry > > & apex::APEX_Registry::allRegistries ( )
inlinestatic

Returns the global registry map. Registries are looked up by their name.

Definition at line 377 of file APEX_Registry.h.

void apex::APEX_Registry::clearSubGraphs ( bool  except_geo_loaded = false)

Clears all subgraph nodes loaded by the registry.

Parameters
except_geo_loadedWhen true, do not clear subgraphs loaded from in memory geometries.
bool apex::APEX_Registry::containsName ( const UT_StringRef name,
bool  include_ancestors = false 
) const

Checks if the name (as well as any remapping of the name) corresponds to a callback or subgraph tracked by the registry.

static APEX_RegistryPtr apex::APEX_Registry::createRegistry ( const UT_StringRef reg_name,
const UT_StringHolder reg_graph_folder = "",
const APEX_RegistryPtrList parent_registries = APEX_RegistryPtrList(),
bool  add_to_registry_map = true 
)
static

Creates a named registry.

Parameters
reg_nameThe name of the new registry.
reg_graph_folderThe name of the folder on the HOUDINI_PATH holding subgraphs which should be loaded by the new registry.
parent_registriesA list of parent registries whose contents are accessible by the new registry.
add_to_registry_mapWhen true, the registry is added to the global registry map. If a registry with the same name already exists in the global map, it is replaced with the new registry.
UT_StringArray apex::APEX_Registry::findMatchingNames ( const char *  pattern = "*",
const char *  version = "",
bool  include_ancestors = false 
) const

Finds the names of node types matching the pattern. The default version "" matches against the current set of names in the registry. When version is nullptr, then all names (including the names found in the compatibility files) are candidates for matching. Otherwise, when a specific version is given, the names are matched against the names available in that product version.

static UT_SharedPtr<APEX_Registry> apex::APEX_Registry::findOrCreateCallbackRegistry ( bool  load_subgraphs = true)
static

Returns the APEX registries.

static UT_SharedPtr<APEX_Registry> apex::APEX_Registry::findOrCreateComponentRegistry ( bool  load_subgraphs = true)
static

Returns the APEX registries.

static UT_SharedPtr<APEX_Registry> apex::APEX_Registry::findOrCreateConstraintRegistry ( bool  load_subgraphs = true)
static

Returns the APEX registries.

static UT_SharedPtr<APEX_Registry> apex::APEX_Registry::findOrCreateControlRegistry ( bool  load_subgraphs = true)
static

Returns the APEX registries.

UT_SharedPtr< APEX_Registry > apex::APEX_Registry::findOrCreateRegistry ( APEX_RegistryType  reg_type)
inlinestatic

Returns the APEX registry using its registry type.

Definition at line 386 of file APEX_Registry.h.

static APEX_RegistryPtr apex::APEX_Registry::findRegistry ( const UT_StringRef reg_name)
static

Find a registry by its name.

const APEX_FunctionBase* apex::APEX_Registry::getCallback ( const UT_StringRef callback_name,
bool  include_ancestors = false 
) const

Finds the named callback node in the registry.

const APEX_CompatibilityMap & apex::APEX_Registry::getCompatibilityMap ( ) const
inline

Definition at line 430 of file APEX_Registry.h.

UT_UniquePtr<APEX_CompatibilityMap::CompatibilityResolver> apex::APEX_Registry::getCompatibilityResolver ( const UT_StringRef name,
const char *  version = "",
bool  include_ancestors = false 
) const

Gets a CompatibilityResolver which builds a mapping from the type definition of name at version to its current type definition. If version is an empty string, then it is assumed to be the original version of the node type and all compatibility entries are used.

GA_DataId apex::APEX_Registry::getDataId ( ) const
inline

Returns the registry's DataID. The DataID is updated each time the registry is modified.

Definition at line 437 of file APEX_Registry.h.

UT_NotifierImpl< const APEX_RegistryEvent & > & apex::APEX_Registry::getEventNotifier ( )
inline

Returns an object used for notifying interested parties about new callbacks and subgraphs being added.

Definition at line 470 of file APEX_Registry.h.

UT_StringHolder apex::APEX_Registry::getIconName ( const UT_StringRef name,
bool  include_ancestors = false 
) const

Get the icon name for given callback

This is first done by mapping it through getLatestName().

bool apex::APEX_Registry::getIsHidden ( const UT_StringRef name,
bool  include_ancestors = false 
) const

Returns true if the node should be hidden from the UI.

UT_StringHolder apex::APEX_Registry::getLatestName ( const UT_StringRef name,
bool  include_ancestors = false 
) const

A convenience function which checks the compatibility map for name and returns its latest name in the registry. If name is not in the compatibility map, it is assumed to already be up to date.

UT_StringHolder apex::APEX_Registry::getMinProductVersion ( const UT_StringRef name,
bool  include_ancestors = false 
) const

Returns the version number in which the node was introduced.

void apex::APEX_Registry::getNamesInPrecedenceOrder ( UT_StringArray precedence_order,
const char *  fullname,
bool  include_ancestors = false 
) const

Gets a list of available node names that have the same base (core) name as the given name. The list is sorted in descending precedence order.

APEX_OverloadSetPtr apex::APEX_Registry::getOverloadSet ( const UT_StringRef name,
bool  include_ancestors = false 
) const

Returns the overload set which contains all versions of a generic callback node. The name of the overload set must contain "<>".

const Dict& apex::APEX_Registry::getParmDefaults ( const UT_StringRef name,
bool  include_ancestors = false 
) const

Returns the node's default parameters.

APEX_Signature apex::APEX_Registry::getSignature ( const UT_StringRef name,
bool  include_ancestors = false 
) const

Returns the signature of the node.

const APEX_COWHandle<APEX_Graph>& apex::APEX_Registry::getSubGraph ( const UT_StringRef name,
bool  include_ancestors = false 
) const

Returns the named subgraph node as an APEX_Graph.

const ApexGeometry& apex::APEX_Registry::getSubGraphGeo ( const UT_StringRef name,
bool  include_ancestors = false 
) const

Returns the subgraph node's geometry representation.

UT_StringArray apex::APEX_Registry::getSubGraphNames ( const char *  version = nullptr,
bool  include_ancestors = false 
) const

Returns an array of subgraph node names.

const UT_StringHolder& apex::APEX_Registry::getSubGraphPath ( const UT_StringRef name,
bool  include_ancestors = false 
) const

Returns the path of the subgraph library from which a named subgraph node was loaded. If the subgraph node was loaded from a geometry, returns "<subgraph>".

void apex::APEX_Registry::iterCallbacks ( const UT_Function< void(const APEX_FunctionBase &)> &  f,
bool  include_ancestors = false 
) const

Visits all callback nodes and executes the provided function object.

void apex::APEX_Registry::iterSubGraphs ( const UT_Function< void(const APEX_COWHandle< APEX_Graph > &)> &  f,
bool  include_ancestors = false 
) const

Visits all subgraph nodes and executes the provided function object.

void apex::APEX_Registry::loadCallbackLibrary ( const char *  dllpath)

Loads callback nodes from the dynamic library. The dynamic library should define the entry point "addApexFunction" with the signature given by addApexFunctionPtr. To register callback nodes, use the registry passed to the entry point function to call addCallback or addCallbacks.

void apex::APEX_Registry::loadCompatibilityFile ( const char *  filepath)

Loads the compatibility file at the filepath.

bool apex::APEX_Registry::loadSubGraphLibrary ( const char *  filepath)

Loads the subgraph node library (saved as a .bgeo) at the filepath.

bool apex::APEX_Registry::loadSubGraphLibrary ( const GU_DetailHandle gdh,
const char *  filepath = "",
bool  replace = false 
)

Loads the subgraph node library from an in memory geometry.

exint apex::APEX_Registry::numCallbacks ( bool  include_ancestors = false) const
inline

Returns the number of callback nodes in the registry.

Definition at line 418 of file APEX_Registry.h.

exint apex::APEX_Registry::numSubGraphs ( bool  include_ancestors = false) const
inline

Returns the number of subgraph nodes tracked by the registry.

Definition at line 406 of file APEX_Registry.h.

void apex::APEX_Registry::reloadSubGraphLibraries ( )

Reload the subgraph node libraries from the registry's graph folder (which was specified when creating the registry).

apex::APEX_Registry::UT_NON_COPYABLE ( APEX_Registry  )

Member Data Documentation

constexpr UT_StringLit apex::APEX_Registry::theCallbackRegistryGraphFolder = "apexgraph"
static

Definition at line 104 of file APEX_Registry.h.

constexpr UT_StringLit apex::APEX_Registry::theCallbackRegistryName = "callback"
static

Definition at line 103 of file APEX_Registry.h.

constexpr UT_StringLit apex::APEX_Registry::theCategoryName = "Apex"
static

Definition at line 101 of file APEX_Registry.h.

constexpr UT_StringLit apex::APEX_Registry::theComponentRegistryGraphFolder = "apexcomponent"
static

Definition at line 106 of file APEX_Registry.h.

constexpr UT_StringLit apex::APEX_Registry::theComponentRegistryName = "component"
static

Definition at line 105 of file APEX_Registry.h.

constexpr UT_StringLit apex::APEX_Registry::theConstraintRegistryGraphFolder = "apexconstraint"
static

Definition at line 108 of file APEX_Registry.h.

constexpr UT_StringLit apex::APEX_Registry::theConstraintRegistryName = "constraint"
static

Definition at line 107 of file APEX_Registry.h.

constexpr UT_StringLit apex::APEX_Registry::theControlRegistryGraphFolder = "apexcontrol"
static

Definition at line 110 of file APEX_Registry.h.

constexpr UT_StringLit apex::APEX_Registry::theControlRegistryName = "control"
static

Definition at line 109 of file APEX_Registry.h.

constexpr UT_StringLit apex::APEX_Registry::theDSOFolder = "apexdso"
static

Definition at line 102 of file APEX_Registry.h.


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