HDK
|
#include <APEX_CompatibilityMap.h>
Public Member Functions | |
APEX_CompatibilityMap () | |
~APEX_CompatibilityMap () | |
bool | load (UT_IStream &is) |
Loads the json representation of the compatibility map. More... | |
bool | load (const char *filepath) |
const UT_StringHolder & | findName (const UT_StringRef &name, const char *version=nullptr) const |
UT_StringArray | getKeys (const char *version=nullptr) const |
template<typename NodeTypeT > | |
UT_UniquePtr < CompatibilityResolver > | createCompatibilityResolver (const UT_StringRef &name, const UT_StringRef &version, const NodeTypeT &nodetype) const |
const UT_StringHolder & | oldName () const |
const UT_StringHolder & | newName () const |
const APEX_Signature & | oldSignature () const |
const APEX_Signature & | newSignature () const |
exint | numInputs () const |
exint | numOutputs () const |
bool | isValid () const |
UT_ErrorManager & | errorManager () |
Returns the error manager. More... | |
CompatibilityResolver (const UT_StringRef &name, const UT_StringRef &version, const APEX_FunctionBase &callback, const APEX_CompatibilityMap &map, const PassKey &) | |
CompatibilityResolver (const UT_StringRef &name, const UT_StringRef &version, const APEX_Graph &subgraph, const APEX_CompatibilityMap &map, const PassKey &) | |
InputPortMappings | |
Functions to map input ports from the old signature to the new signature. | |
exint | inputIndex (exint old_index) const |
exint | inputIndex (const UT_StringRef &old_name) const |
const UT_StringHolder & | inputName (exint old_index) const |
const UT_StringHolder & | inputName (const UT_StringRef &old_name) const |
OutputPortMappings | |
Functions to map output ports from the old signature to the new signature. | |
exint | outputIndex (exint old_index) const |
exint | outputIndex (const UT_StringRef &old_name) const |
const UT_StringHolder & | outputName (exint old_index) const |
const UT_StringHolder & | outputName (const UT_StringRef &old_name) const |
Friends | |
class | APEX_CompatibilityMap |
APEX_CompatibilityMap tracks backwards compatible transformations to callback and subgraph node types.
The map is stored in json format with the following schema:
"oldname" : { "remap" : ["newname", "oldname start version", "newname start version"], "updates" : { "product version string": [ [ "renameport", "old[in]", "new" ], [ "renameport", "mesh[out]", "geo" ], [ "insertport", "name[in]", 2 ], [ "moveport", "success[out]", -1 ] ], "21.0.20": [ [ "insertport", "value[in]", 2 ] ] } }
Users do not need to provide the "update" or "remap" entries if it is not applicable to their type.
A CompatibilityResolver builds the mapping between an old type definition and a new type definition based on the updates recorded in a compatibility map.
Definition at line 62 of file APEX_CompatibilityMap.h.
apex::APEX_CompatibilityMap::APEX_CompatibilityMap | ( | ) |
apex::APEX_CompatibilityMap::~APEX_CompatibilityMap | ( | ) |
apex::APEX_CompatibilityMap::CompatibilityResolver | ( | const UT_StringRef & | name, |
const UT_StringRef & | version, | ||
const APEX_FunctionBase & | callback, | ||
const APEX_CompatibilityMap & | map, | ||
const PassKey & | |||
) |
apex::APEX_CompatibilityMap::CompatibilityResolver | ( | const UT_StringRef & | name, |
const UT_StringRef & | version, | ||
const APEX_Graph & | subgraph, | ||
const APEX_CompatibilityMap & | map, | ||
const PassKey & | |||
) |
UT_UniquePtr< APEX_CompatibilityMap::CompatibilityResolver > apex::APEX_CompatibilityMap::createCompatibilityResolver | ( | const UT_StringRef & | name, |
const UT_StringRef & | version, | ||
const NodeTypeT & | nodetype | ||
) | const |
Creates a Resolver which builds a mapping from the type definition of name at version to its current type nodetype. If version is an empty string, then it is assumed to be the original version and all compatibility entries are used.
Definition at line 193 of file APEX_CompatibilityMap.h.
|
inline |
Returns the error manager.
Definition at line 148 of file APEX_CompatibilityMap.h.
const UT_StringHolder& apex::APEX_CompatibilityMap::findName | ( | const UT_StringRef & | name, |
const char * | version = nullptr |
||
) | const |
Returns the current name associated with name at version. When name is not found in the compatibility map, the empty string is returned. When version is null, the current name is always returned. In most scenarios, this function should be called with a null version argument in order to find the current name of the node. The version is useful for tracking the history of a name for the purpose of creating a set of candidate nodes at a particular version (e.g. deciding which namespace versioned nodes existed at a particular product version so that their precedence order can be reconstructed at that version). When version is "", it is interpreted as version "0".
UT_StringArray apex::APEX_CompatibilityMap::getKeys | ( | const char * | version = nullptr | ) | const |
Returns the keys of the compatibility map which were current node types at version. If a version is not provided, then all keys are returned. When version is "", it is interpreted as version "0".
exint apex::APEX_CompatibilityMap::inputIndex | ( | const UT_StringRef & | old_name | ) | const |
const UT_StringHolder& apex::APEX_CompatibilityMap::inputName | ( | exint | old_index | ) | const |
const UT_StringHolder& apex::APEX_CompatibilityMap::inputName | ( | const UT_StringRef & | old_name | ) | const |
|
inline |
Returns false if the resolver encountered an error. Errors can be retrieved with errorManager().
Definition at line 145 of file APEX_CompatibilityMap.h.
bool apex::APEX_CompatibilityMap::load | ( | UT_IStream & | is | ) |
Loads the json representation of the compatibility map.
bool apex::APEX_CompatibilityMap::load | ( | const char * | filepath | ) |
|
inline |
Definition at line 115 of file APEX_CompatibilityMap.h.
|
inline |
Definition at line 118 of file APEX_CompatibilityMap.h.
|
inline |
Definition at line 120 of file APEX_CompatibilityMap.h.
|
inline |
Definition at line 121 of file APEX_CompatibilityMap.h.
|
inline |
Definition at line 114 of file APEX_CompatibilityMap.h.
|
inline |
Definition at line 117 of file APEX_CompatibilityMap.h.
exint apex::APEX_CompatibilityMap::outputIndex | ( | const UT_StringRef & | old_name | ) | const |
const UT_StringHolder& apex::APEX_CompatibilityMap::outputName | ( | exint | old_index | ) | const |
const UT_StringHolder& apex::APEX_CompatibilityMap::outputName | ( | const UT_StringRef & | old_name | ) | const |
|
friend |
Definition at line 169 of file APEX_CompatibilityMap.h.