souffle  2.0.2-371-g6315b36
Type.h
Go to the documentation of this file.
1 /*
2  * Souffle - A Datalog Compiler
3  * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved
4  * Licensed under the Universal Permissive License v 1.0 as shown at:
5  * - https://opensource.org/licenses/UPL
6  * - <souffle root>/licenses/SOUFFLE-UPL.txt
7  */
8 
9 /************************************************************************
10  *
11  * @file Type.h
12  *
13  * Defines the type class
14  *
15  ***********************************************************************/
16 
17 #pragma once
18 
19 #include "ast/Node.h"
20 #include "ast/QualifiedName.h"
21 #include "parser/SrcLocation.h"
22 #include <string>
23 #include <utility>
24 
25 namespace souffle::ast {
26 
27 /**
28  * @class Type
29  * @brief An abstract base class for types
30  */
31 class Type : public Node {
32 public:
33  Type(QualifiedName name = {}, SrcLocation loc = {}) : Node(std::move(loc)), name(std::move(name)) {}
34 
35  /** Return type name */
36  const QualifiedName& getQualifiedName() const {
37  return name;
38  }
39 
40  /** Set type name */
42  this->name = std::move(name);
43  }
44 
45  Type* clone() const override = 0;
46 
47 private:
48  /** type name */
50 };
51 
52 } // namespace souffle::ast
souffle::ast::Type::setQualifiedName
void setQualifiedName(QualifiedName name)
Set type name.
Definition: Type.h:47
SrcLocation.h
souffle::ast::analysis::Type
An abstract base class for types to be covered within a type environment.
Definition: TypeSystem.h:51
souffle::ast::Type::getQualifiedName
const QualifiedName & getQualifiedName() const
Return type name.
Definition: Type.h:42
souffle::clone
auto clone(const std::vector< A * > &xs)
Definition: ContainerUtil.h:172
Node.h
souffle::ast::analysis::Type::name
QualifiedName name
Definition: TypeSystem.h:92
souffle::ast::analysis::Type::Type
Type(const Type &other)=delete
QualifiedName.h
souffle::ast::Node::Node
Node(SrcLocation loc={})
Definition: Node.h:42
souffle::ast
Definition: Aggregator.h:35
souffle::ast::QualifiedName
Qualified Name class defines fully/partially qualified names to identify objects in components.
Definition: QualifiedName.h:39