12#ifndef OPENVDB_AX_COMPILER_AST_SCANNERS_HAS_BEEN_INCLUDED 
   13#define OPENVDB_AX_COMPILER_AST_SCANNERS_HAS_BEEN_INCLUDED 
   18#include <openvdb/version.h> 
   38    const std::string& name,
 
   50    const std::string& name,
 
   62        std::vector<const ast::Variable*>* readOnly,
 
   63        std::vector<const ast::Variable*>* writeOnly,
 
   64        std::vector<const ast::Variable*>* readWrite,
 
   65        const bool locals = 
true,
 
   66        const bool attributes = 
true);
 
   82        std::vector<std::string>* readOnly,
 
   83        std::vector<std::string>* writeOnly,
 
   84        std::vector<std::string>* readWrite);
 
   88        const std::string& name,
 
   90        std::vector<std::string>& dependencies);
 
   99template <
typename NodeT, 
typename OpT>
 
  104template<
typename NodeT, 
typename ContainerType = std::vector<const NodeT*>>
 
  117template <
typename NodeTypeList, 
typename ContainerType = std::vector<const Node*>>
 
  134template<
typename ContainerType, 
typename T, 
typename ...Ts>
 
  135struct CollectForEach {
 
  136    static void exec(
const ast::Node&, ContainerType&) {}
 
  139template<
typename ContainerType, 
typename T, 
typename ...Ts>
 
  140struct CollectForEach<ContainerType, 
TypeList<T, Ts...>> {
 
  141    static void exec(
const ast::Node& node, ContainerType& C) {
 
  142        collectNodeType<T, ContainerType>(node, C);
 
  143        CollectForEach<ContainerType, 
TypeList<Ts...>>::exec(node, C);
 
  150template<
typename NodeT, 
typename ContainerType>
 
  154        array.push_back(&node);
 
 
  159template <
typename NodeTypeList, 
typename ContainerType>
 
  162    internal::CollectForEach<ContainerType, NodeTypeList>::exec(node, array);
 
 
  165template <
typename NodeT, 
typename OpT, 
typename Derived = 
void>
 
  168        std::is_same<Derived, void>::value,
 
  169        VisitNodeType<NodeT, OpT>,
 
  173        std::is_same<Derived, void>::value,
 
  181        return std::is_abstract<NodeT>::value;
 
 
  186    inline bool visit(
const NodeT* node) {
 
  187        if (node) 
return mOp(*node);
 
 
 
  194template <
typename NodeT, 
typename OpT>
 
Provides the definition for every abstract and concrete derived class which represent a particular ab...
Contains the AX AST Node Visitor, providing default and customizable traversal and visitation methods...
CoreType
Definition Tokens.h:32
@ UNKNOWN
Definition Tokens.h:63
OPENVDB_AX_API const ast::Variable * firstUse(const ast::Node &node, const std::string &token)
OPENVDB_AX_API bool callsFunction(const ast::Node &node, const std::string &name)
Returns whether or not a given branch of an AST calls a function.
OPENVDB_AX_API void catalogueAttributeTokens(const ast::Node &node, std::vector< std::string > *readOnly, std::vector< std::string > *writeOnly, std::vector< std::string > *readWrite)
Parse all attributes into three unique vectors which represent how they are accessed within the synta...
void collectNodeType(const ast::Node &node, ContainerType &array)
Visit all nodes of a given type and store pointers to them in a provided compatible container.
Definition Scanners.h:151
OPENVDB_AX_API bool writesToAttribute(const ast::Node &node, const std::string &name, const tokens::CoreType type=tokens::UNKNOWN)
Returns whether or not a given branch of an AST writes to a given attribute.
void collectNodeTypes(const ast::Node &node, ContainerType &array)
Visit all nodes of the given types and store pointers to them in a container of base ast::Node pointe...
Definition Scanners.h:160
OPENVDB_AX_API const ast::Variable * lastUse(const ast::Node &node, const std::string &token)
OPENVDB_AX_API bool usesAttribute(const ast::Node &node, const std::string &name, const tokens::CoreType type=tokens::UNKNOWN)
Returns whether or not a given branch of an AST reads from or writes to a given attribute.
OPENVDB_AX_API void catalogueVariables(const ast::Node &node, std::vector< const ast::Variable * > *readOnly, std::vector< const ast::Variable * > *writeOnly, std::vector< const ast::Variable * > *readWrite, const bool locals=true, const bool attributes=true)
todo
void visitNodeType(const ast::Node &node, const OpT &op)
For an AST node of a given type, search for and call a custom const operator() which takes a const re...
Definition Scanners.h:195
OPENVDB_AX_API void linearize(const ast::Node &node, std::vector< const ast::Node * > &list)
Flatten the provided AST branch into a linear list using post order traversal.
OPENVDB_AX_API void attributeDependencyTokens(const ast::Tree &tree, const std::string &name, const tokens::CoreType type, std::vector< std::string > &dependencies)
Populate a list of attribute names which the given attribute depends on.
Definition PointDataGrid.h:170
Definition Exceptions.h:13
A list of types (not necessarily unique)
Definition TypeList.h:578
The base abstract node which determines the interface and required methods for all derived concrete n...
Definition AST.h:103
A Tree is the highest concrete (non-abstract) node in the entire AX AST hierarchy....
Definition AST.h:563
Variables are a base type for Locals, Attributes and ExternalVariables. Unlike other abstract types,...
Definition AST.h:338
Definition Scanners.h:171
typename std::conditional< std::is_same< Derived, void >::value, VisitNodeType< NodeT, OpT >, Derived >::type VisitorT
Definition Scanners.h:172
bool visit(const NodeT *node)
Definition Scanners.h:186
bool visitNodeHierarchies() const
Definition Scanners.h:180
VisitNodeType(const OpT &op)
Definition Scanners.h:184
The Visitor class uses the Curiously Recursive Template Pattern (CRTP) to provide a customizable inte...
Definition Visitor.h:96
bool traverse(NodeType< ast::Tree > *tree)
Definition Visitor.h:161
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition version.h.in:121
#define OPENVDB_USE_VERSION_NAMESPACE
Definition version.h.in:218