souffle  2.0.2-371-g6315b36
Public Member Functions | Protected Member Functions | Private Attributes
souffle::ast::BranchDeclaration Class Reference

Wrapper for the single branch declaration (product type) inside ADT declaration. More...

#include <BranchDeclaration.h>

Inheritance diagram for souffle::ast::BranchDeclaration:
Inheritance graph
Collaboration diagram for souffle::ast::BranchDeclaration:
Collaboration graph

Public Member Functions

 BranchDeclaration (std::string constructor, VecOwn< Attribute > fields, SrcLocation loc={})
 
BranchDeclarationclone () const override
 Create a clone (i.e. More...
 
const std::string & getConstructor () const
 
std::vector< Attribute * > getFields ()
 
- Public Member Functions inherited from souffle::ast::Node
virtual void apply (const NodeMapper &)
 Apply the mapper to all child nodes. More...
 
std::string extloc () const
 Return source location of the syntactic element. More...
 
virtual std::vector< const Node * > getChildNodes () const
 Obtain a list of all embedded AST child nodes. More...
 
const SrcLocationgetSrcLoc () const
 Return source location of the Node. More...
 
 Node (SrcLocation loc={})
 
bool operator!= (const Node &other) const
 Inequality check for two AST nodes. More...
 
bool operator== (const Node &other) const
 Equivalence check for two AST nodes. More...
 
void setSrcLoc (SrcLocation l)
 Set source location for the Node. More...
 
virtual ~Node ()=default
 

Protected Member Functions

void print (std::ostream &os) const override
 Output to a given output stream. More...
 
- Protected Member Functions inherited from souffle::ast::Node
virtual bool equal (const Node &) const
 Abstract equality check for two AST nodes. More...
 

Private Attributes

std::string constructor
 
VecOwn< Attributefields
 

Detailed Description

Wrapper for the single branch declaration (product type) inside ADT declaration.

Parameters
constructorAn entity used to create a variant type. Can be though of as a name of the branch.
fieldsBranch arguments and their types.

A branch declaration corresponds to a product type and forms a part of ADT declaration. Currently it's required for all the branches to have unique names.

Definition at line 48 of file BranchDeclaration.h.

Constructor & Destructor Documentation

◆ BranchDeclaration()

souffle::ast::BranchDeclaration::BranchDeclaration ( std::string  constructor,
VecOwn< Attribute fields,
SrcLocation  loc = {} 
)
inline

Definition at line 50 of file BranchDeclaration.h.

51  {

References fields, and souffle::toPtrVector().

Here is the call graph for this function:

Member Function Documentation

◆ clone()

BranchDeclaration* souffle::ast::BranchDeclaration::clone ( ) const
inlineoverridevirtual

Create a clone (i.e.

deep copy) of this node

Implements souffle::ast::Node.

Definition at line 61 of file BranchDeclaration.h.

61  {%s}", constructor, join(fields, ", "));
62  }
63 

◆ getConstructor()

const std::string& souffle::ast::BranchDeclaration::getConstructor ( ) const
inline

Definition at line 53 of file BranchDeclaration.h.

55  {

◆ getFields()

std::vector<Attribute*> souffle::ast::BranchDeclaration::getFields ( )
inline

Definition at line 57 of file BranchDeclaration.h.

59  :
60  void print(std::ostream& os) const override {

◆ print()

void souffle::ast::BranchDeclaration::print ( std::ostream &  os) const
inlineoverrideprotectedvirtual

Output to a given output stream.

Implements souffle::ast::Node.

Definition at line 66 of file BranchDeclaration.h.

Field Documentation

◆ constructor

std::string souffle::ast::BranchDeclaration::constructor
private

Definition at line 71 of file BranchDeclaration.h.

◆ fields

VecOwn<Attribute> souffle::ast::BranchDeclaration::fields
private

Definition at line 72 of file BranchDeclaration.h.

Referenced by BranchDeclaration().


The documentation for this class was generated from the following file:
souffle::ast::BranchDeclaration::print
void print(std::ostream &os) const override
Output to a given output stream.
Definition: BranchDeclaration.h:66