souffle  2.0.2-371-g6315b36
Public Member Functions | Protected Member Functions
souffle::ast::Visitor< R, Params > Struct Template Reference

The generic base type of all AstVisitors realizing the dispatching of visitor calls. More...

#include <Visitor.h>

Inheritance diagram for souffle::ast::Visitor< R, Params >:
Inheritance graph
Collaboration diagram for souffle::ast::Visitor< R, Params >:
Collaboration graph

Public Member Functions

operator() (const Node &node, Params... args)
 The main entry for the user allowing visitors to be utilized as functions. More...
 
virtual R visit (const Node &node, Params... args)
 The main entry for a visit process conducting the dispatching of a visit to the various sub-types of Nodes. More...
 
virtual ~Visitor ()=default
 A virtual destructor. More...
 

Protected Member Functions

 LINK (AlgebraicDataType, Type)
 
 LINK (Argument, Node)
 
 LINK (Attribute, Node)
 
 LINK (Clause, Node)
 
 LINK (Component, Node)
 
 LINK (ComponentInit, Node)
 
 LINK (ComponentType, Node)
 
 LINK (Literal, Node)
 
 LINK (Pragma, Node)
 
 LINK (Program, Node)
 
 LINK (RecordType, Type)
 
 LINK (Relation, Node)
 
 LINK (SubsetType, Type)
 
 LINK (Type, Node)
 
 LINK (UnionType, Type)
 
virtual R visitNode (const Node &, Params...)
 The base case for all visitors – if no more specific overload was defined. More...
 

Detailed Description

template<typename R = void, typename... Params>
struct souffle::ast::Visitor< R, Params >

The generic base type of all AstVisitors realizing the dispatching of visitor calls.

Each visitor may define a return type R and a list of extra parameters to be passed along with the visited Nodes to the corresponding visitor function.

Template Parameters
Rthe result type produced by a visit call
Paramsextra parameters to be passed to the visit call

Definition at line 87 of file Visitor.h.

Constructor & Destructor Documentation

◆ ~Visitor()

template<typename R = void, typename... Params>
virtual souffle::ast::Visitor< R, Params >::~Visitor ( )
virtualdefault

A virtual destructor.

Member Function Documentation

◆ LINK() [1/15]

template<typename R = void, typename... Params>
souffle::ast::Visitor< R, Params >::LINK ( AlgebraicDataType  ,
Type   
)
protected

◆ LINK() [2/15]

template<typename R = void, typename... Params>
souffle::ast::Visitor< R, Params >::LINK ( Argument  ,
Node   
)
protected

◆ LINK() [3/15]

template<typename R = void, typename... Params>
souffle::ast::Visitor< R, Params >::LINK ( Attribute  ,
Node   
)
protected

◆ LINK() [4/15]

template<typename R = void, typename... Params>
souffle::ast::Visitor< R, Params >::LINK ( Clause  ,
Node   
)
protected

◆ LINK() [5/15]

template<typename R = void, typename... Params>
souffle::ast::Visitor< R, Params >::LINK ( Component  ,
Node   
)
protected

◆ LINK() [6/15]

template<typename R = void, typename... Params>
souffle::ast::Visitor< R, Params >::LINK ( ComponentInit  ,
Node   
)
protected

◆ LINK() [7/15]

template<typename R = void, typename... Params>
souffle::ast::Visitor< R, Params >::LINK ( ComponentType  ,
Node   
)
protected

◆ LINK() [8/15]

template<typename R = void, typename... Params>
souffle::ast::Visitor< R, Params >::LINK ( Literal  ,
Node   
)
protected

◆ LINK() [9/15]

template<typename R = void, typename... Params>
souffle::ast::Visitor< R, Params >::LINK ( Pragma  ,
Node   
)
protected

◆ LINK() [10/15]

template<typename R = void, typename... Params>
souffle::ast::Visitor< R, Params >::LINK ( Program  ,
Node   
)
protected

◆ LINK() [11/15]

template<typename R = void, typename... Params>
souffle::ast::Visitor< R, Params >::LINK ( RecordType  ,
Type   
)
protected

◆ LINK() [12/15]

template<typename R = void, typename... Params>
souffle::ast::Visitor< R, Params >::LINK ( Relation  ,
Node   
)
protected

◆ LINK() [13/15]

template<typename R = void, typename... Params>
souffle::ast::Visitor< R, Params >::LINK ( SubsetType  ,
Type   
)
protected

◆ LINK() [14/15]

template<typename R = void, typename... Params>
souffle::ast::Visitor< R, Params >::LINK ( Type  ,
Node   
)
protected

◆ LINK() [15/15]

template<typename R = void, typename... Params>
souffle::ast::Visitor< R, Params >::LINK ( UnionType  ,
Type   
)
protected

◆ operator()()

template<typename R = void, typename... Params>
R souffle::ast::Visitor< R, Params >::operator() ( const Node node,
Params...  args 
)
inline

The main entry for the user allowing visitors to be utilized as functions.

Definition at line 92 of file Visitor.h.

98  {

◆ visit()

template<typename R = void, typename... Params>
virtual R souffle::ast::Visitor< R, Params >::visit ( const Node node,
Params...  args 
)
inlinevirtual

The main entry for a visit process conducting the dispatching of a visit to the various sub-types of Nodes.

Sub-classes may override this implementation to conduct pre-visit operations.

Parameters
nodethe node to be visited
argsa list of extra parameters to be forwarded

Definition at line 104 of file Visitor.h.

148  : %s", typeid(node).name());
149  }
150 
151 protected:
152 #define LINK(Node, Parent) \
153  virtual R visit##Node(const Node& n, Params... args) { \
154  return visit##Parent(n, args...); \
155  }

◆ visitNode()

template<typename R = void, typename... Params>
virtual R souffle::ast::Visitor< R, Params >::visitNode ( const Node ,
Params...   
)
inlineprotectedvirtual

The base case for all visitors – if no more specific overload was defined.

Definition at line 220 of file Visitor.h.

229  {

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