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

a directive has a type (e.g. input/output/printsize/limitsize), qualified relation name, and a key value map for storing parameters of the directive. More...

#include <Directive.h>

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

Public Member Functions

void addParameter (const std::string &key, std::string value)
 Add new parameter. More...
 
Directiveclone () const override
 Create a clone (i.e. More...
 
 Directive (DirectiveType type, QualifiedName name, SrcLocation loc={})
 
const std::string & getParameter (const std::string &key) const
 Get parameter. More...
 
const std::map< std::string, std::string > & getParameters () const
 Get parameters. More...
 
const QualifiedNamegetQualifiedName () const
 Get relation name. More...
 
DirectiveType getType () const
 Get directive type. More...
 
bool hasParameter (const std::string &key) const
 Check for a parameter. More...
 
void setQualifiedName (QualifiedName name)
 Set relation name. More...
 
void setType (DirectiveType type)
 Set directive type. More...
 
- 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

bool equal (const Node &node) const override
 Abstract equality check for two AST nodes. More...
 
void print (std::ostream &os) const override
 Output to a given output stream. More...
 

Protected Attributes

QualifiedName name
 Relation name of the directive. More...
 
std::map< std::string, std::string > parameters
 Parameters of directive. More...
 
DirectiveType type
 Type of directive. More...
 

Detailed Description

a directive has a type (e.g. input/output/printsize/limitsize), qualified relation name, and a key value map for storing parameters of the directive.

Definition at line 56 of file Directive.h.

Constructor & Destructor Documentation

◆ Directive()

souffle::ast::Directive::Directive ( DirectiveType  type,
QualifiedName  name,
SrcLocation  loc = {} 
)
inline

Definition at line 58 of file Directive.h.

61  {

Member Function Documentation

◆ addParameter()

void souffle::ast::Directive::addParameter ( const std::string &  key,
std::string  value 
)
inline

Add new parameter.

Definition at line 87 of file Directive.h.

◆ clone()

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

Create a clone (i.e.

deep copy) of this node

Implements souffle::ast::Node.

Definition at line 101 of file Directive.h.

101  :
102  void print(std::ostream& os) const override {
103  os << "." << type << " " << name;
104  if (!parameters.empty()) {
105  os << "(" << join(parameters, ",", [](std::ostream& out, const auto& arg) {

References souffle::join(), name, parameters, and type.

Here is the call graph for this function:

◆ equal()

bool souffle::ast::Directive::equal ( const Node ) const
inlineoverrideprotectedvirtual

Abstract equality check for two AST nodes.

Reimplemented from souffle::ast::Node.

Definition at line 117 of file Directive.h.

◆ getParameter()

const std::string& souffle::ast::Directive::getParameter ( const std::string &  key) const
inline

Get parameter.

Definition at line 82 of file Directive.h.

◆ getParameters()

const std::map<std::string, std::string>& souffle::ast::Directive::getParameters ( ) const
inline

Get parameters.

Definition at line 97 of file Directive.h.

101  :
102  void print(std::ostream& os) const override {

◆ getQualifiedName()

const QualifiedName& souffle::ast::Directive::getQualifiedName ( ) const
inline

Get relation name.

Definition at line 72 of file Directive.h.

◆ getType()

DirectiveType souffle::ast::Directive::getType ( ) const
inline

Get directive type.

Definition at line 62 of file Directive.h.

66  {

◆ hasParameter()

bool souffle::ast::Directive::hasParameter ( const std::string &  key) const
inline

Check for a parameter.

Definition at line 92 of file Directive.h.

95  {

◆ print()

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

Output to a given output stream.

Implements souffle::ast::Node.

Definition at line 108 of file Directive.h.

111  {
112  const auto& other = static_cast<const Directive&>(node);
113  return other.type == type && other.name == name && other.parameters == parameters;
114  }
115 

◆ setQualifiedName()

void souffle::ast::Directive::setQualifiedName ( QualifiedName  name)
inline

Set relation name.

Definition at line 77 of file Directive.h.

◆ setType()

void souffle::ast::Directive::setType ( DirectiveType  type)
inline

Set directive type.

Definition at line 67 of file Directive.h.

71  {

Field Documentation

◆ name

QualifiedName souffle::ast::Directive::name
protected

Relation name of the directive.

Definition at line 126 of file Directive.h.

Referenced by clone().

◆ parameters

std::map<std::string, std::string> souffle::ast::Directive::parameters
protected

Parameters of directive.

Definition at line 129 of file Directive.h.

Referenced by clone().

◆ type

DirectiveType souffle::ast::Directive::type
protected

Type of directive.

Definition at line 123 of file Directive.h.

Referenced by clone().


The documentation for this class was generated from the following file:
souffle::ast::Directive::type
DirectiveType type
Type of directive.
Definition: Directive.h:123
souffle::ast::Directive::name
QualifiedName name
Relation name of the directive.
Definition: Directive.h:126
souffle::ast::Directive::Directive
Directive(DirectiveType type, QualifiedName name, SrcLocation loc={})
Definition: Directive.h:58
souffle::ast::Directive::print
void print(std::ostream &os) const override
Output to a given output stream.
Definition: Directive.h:108
souffle::join
detail::joined_sequence< Iter, Printer > join(const Iter &a, const Iter &b, const std::string &sep, const Printer &p)
Creates an object to be forwarded to some output stream for printing sequences of elements interspers...
Definition: StreamUtil.h:175
souffle::ast::Directive::parameters
std::map< std::string, std::string > parameters
Parameters of directive.
Definition: Directive.h:129