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

Defines a type cast class for expressions. More...

#include <TypeCast.h>

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

Public Member Functions

void apply (const NodeMapper &map) override
 Apply the mapper to all child nodes. More...
 
TypeCastclone () const override
 Create clone. More...
 
std::vector< const Node * > getChildNodes () const override
 Obtain a list of all embedded AST child nodes. More...
 
const QualifiedNamegetType () const
 Return cast type. More...
 
ArgumentgetValue () const
 Return value. More...
 
void setType (const QualifiedName &type)
 Set cast type. More...
 
 TypeCast (Own< Argument > value, QualifiedName type, SrcLocation loc={})
 
- Public Member Functions inherited from souffle::ast::Argument
 Node (SrcLocation loc={})
 
- Public Member Functions inherited from souffle::ast::Node
std::string extloc () const
 Return source location of the syntactic element. 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 type
 Cast type. More...
 
Own< Argumentvalue
 Casted value. More...
 

Detailed Description

Defines a type cast class for expressions.

Definition at line 46 of file TypeCast.h.

Constructor & Destructor Documentation

◆ TypeCast()

souffle::ast::TypeCast::TypeCast ( Own< Argument value,
QualifiedName  type,
SrcLocation  loc = {} 
)
inline

Definition at line 48 of file TypeCast.h.

51  {

Referenced by getChildNodes().

Member Function Documentation

◆ apply()

void souffle::ast::TypeCast::apply ( const NodeMapper )
inlineoverridevirtual

Apply the mapper to all child nodes.

Reimplemented from souffle::ast::Node.

Definition at line 76 of file TypeCast.h.

79  {

◆ clone()

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

Create clone.

Implements souffle::ast::Argument.

Definition at line 72 of file TypeCast.h.

74  :
75  void print(std::ostream& os) const override {

◆ equal()

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

Abstract equality check for two AST nodes.

Reimplemented from souffle::ast::Node.

Definition at line 85 of file TypeCast.h.

◆ getChildNodes()

std::vector<const Node*> souffle::ast::TypeCast::getChildNodes ( ) const
inlineoverridevirtual

Obtain a list of all embedded AST child nodes.

Reimplemented from souffle::ast::Node.

Definition at line 66 of file TypeCast.h.

66  {
67  return new TypeCast(souffle::clone(value), type, getSrcLoc());
68  }
69 
70  void apply(const NodeMapper& map) override {

References souffle::clone(), souffle::ast::Node::getSrcLoc(), type, TypeCast(), and value.

Here is the call graph for this function:

◆ getType()

const QualifiedName& souffle::ast::TypeCast::getType ( ) const
inline

Return cast type.

Definition at line 57 of file TypeCast.h.

Referenced by souffle::ast::analysis::TypeConstraintsAnalysis::visitCounter().

◆ getValue()

Argument* souffle::ast::TypeCast::getValue ( ) const
inline

Return value.

Definition at line 52 of file TypeCast.h.

56  {

◆ print()

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

Output to a given output stream.

Implements souffle::ast::Node.

Definition at line 81 of file TypeCast.h.

◆ setType()

void souffle::ast::TypeCast::setType ( const QualifiedName type)
inline

Set cast type.

Definition at line 62 of file TypeCast.h.

66  {

Field Documentation

◆ type

QualifiedName souffle::ast::TypeCast::type
protected

Cast type.

Definition at line 94 of file TypeCast.h.

Referenced by getChildNodes().

◆ value

Own<Argument> souffle::ast::TypeCast::value
protected

Casted value.

Definition at line 91 of file TypeCast.h.

Referenced by getChildNodes().


The documentation for this class was generated from the following file:
souffle::ast::TypeCast::TypeCast
TypeCast(Own< Argument > value, QualifiedName type, SrcLocation loc={})
Definition: TypeCast.h:48
souffle::ast::TypeCast::value
Own< Argument > value
Casted value.
Definition: TypeCast.h:91
souffle::map
auto map(const std::vector< A > &xs, F &&f)
Applies a function to each element of a vector and returns the results.
Definition: ContainerUtil.h:158
souffle::clone
auto clone(const std::vector< A * > &xs)
Definition: ContainerUtil.h:172
souffle::ast::TypeCast::print
void print(std::ostream &os) const override
Output to a given output stream.
Definition: TypeCast.h:81
souffle::ast::TypeCast::type
QualifiedName type
Cast type.
Definition: TypeCast.h:94
souffle::ast::TypeCast::apply
void apply(const NodeMapper &map) override
Apply the mapper to all child nodes.
Definition: TypeCast.h:76
souffle::ast::Node::getSrcLoc
const SrcLocation & getSrcLoc() const
Return source location of the Node.
Definition: Node.h:46