ACT Library
Loading...
Searching...
No Matches
basetype.h
Go to the documentation of this file.
1/*************************************************************************
2 *
3 * This file is part of the ACT library
4 *
5 * Copyright (c) 2018-2019 Rajit Manohar
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21 *
22 **************************************************************************
23 */
24#ifndef __ACT_BASETYPE_H__
25#define __ACT_BASETYPE_H__
26
27class ActNamespace;
28class Scope;
29struct inst_param;
30
45class Type {
46 public:
47 Type() { };
48 ~Type() { };
49
54 virtual const char *getName () = 0;
55
66 virtual Type *Expand (ActNamespace *ns, Scope *s, int nt, inst_param *ip) = 0;
67
73 virtual int isEqual (const Type *t) const = 0;
74
79 static void Init();
80
87 enum direction {
88 NONE = 0,
89 IN = 1,
90 OUT = 2,
91 INOUT = 3,
92 OUTIN = 4
93 };
94
100 static const char *dirstring (direction d) {
101 switch (d) {
102 case Type::NONE: return ""; break;
103 case Type::IN: return "?"; break;
104 case Type::OUT: return "!"; break;
105 case Type::INOUT: return "?!"; break;
106 case Type::OUTIN: return "!?"; break;
107 }
108 return "-err-";
109 };
110
111 protected:
112 friend class TypeFactory;
113};
114
115#endif /* __ACT_BASETYPE_H__ */
The ActNamespace class holds all the information about a namespace.
Definition: namespaces.h:469
This is the data structure that holds all instances and their associated types within a scope....
Definition: namespaces.h:77
This is the class used to create all instance types. It also caches types to reduce memory usage.
Definition: types.h:1415
The abstract base class for all types in the system.
Definition: basetype.h:45
static const char * dirstring(direction d)
Definition: basetype.h:100
static void Init()
Type()
Definition: basetype.h:47
~Type()
constructor
Definition: basetype.h:48
direction
Definition: basetype.h:87
@ IN
direction flag is ?
Definition: basetype.h:89
@ OUTIN
direction flag is !?
Definition: basetype.h:92
@ NONE
no direction flag
Definition: basetype.h:88
@ INOUT
direction flag is ?!
Definition: basetype.h:91
@ OUT
direction flag is !
Definition: basetype.h:90
virtual int isEqual(const Type *t) const =0
virtual Type * Expand(ActNamespace *ns, Scope *s, int nt, inst_param *ip)=0
virtual const char * getName()=0
destructor
This holds a single template parameter. A template parameter is either an array expression,...
Definition: inst.h:52