ACT Library
Loading...
Searching...
No Matches
value.h
Go to the documentation of this file.
1/*************************************************************************
2 *
3 * This file is part of the ACT library
4 *
5 * Copyright (c) 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_VALUE_H__
25#define __ACT_VALUE_H__
26
27
28class InstType;
29class ValueIdx;
30struct act_attr;
31
32#include <act/basetype.h>
33
114public:
125
126
129
132
136
139
145
146
150
151 bool isglobal();
153
156
163 bool isPrimary() { return (up == NULL) ? 1 : 0; }
164
176 bool isPrimary(int i) { return a[i] && (a[i]->isPrimary()); }
177
178
186 act_connection *getsubconn(int idx, int sz);
187
200
206 int myoffset () { return parent->suboffset (this); }
207
214 bool hasDirectconnections() { return next != this; }
215
222
230 bool hasDirectconnections(int i) { return a && a[i] && a[i]->hasDirectconnections(); }
231
236 bool hasSubconnections() { return a != NULL; }
237
244 bool hasSubconnections(int i) { return a && a[i]; }
245
246
257
265
278
288 unsigned int getctype();
289
296
305
310 bool disconnect ();
311
317
322 void Print (FILE *fp);
323};
324
325
342class ValueIdx {
343public:
346
347 struct act_attr *a;
350
351 unsigned int init:1;
353
354 unsigned int immutable:1;
357
361
362 union {
363 long idx;
365 struct {
369
370 const char *name;
372
373 } obj;
375
376 } u;
377
378
385 bool hasConnection() { return init && (u.obj.c != NULL); }
386
393 bool hasAnyConnection() { if (!hasConnection()) return false; else return u.obj.c->hasAnyConnection(); }
394
402 bool hasConnection(int i) { return init && (u.obj.c != NULL) && (u.obj.c->a) && (u.obj.c->a[i]); }
403
410
416 bool isPrimary() { return !hasConnection() || (u.obj.c->isPrimary()); }
417
424 bool isPrimary(int i) { return !hasConnection(i) || (u.obj.c->a[i]->isPrimary()); }
425
431 act_connection *connection() { return init ? u.obj.c : NULL; }
432
437 const char *getName() { return u.obj.name; }
438
442 act_attr *getAttr() { return a; }
443
450 act_attr *getAttrIdx(int i) { return array_spec ? array_spec[i] : NULL; }
451
456 bool haveAttrIdx() { return array_spec ? true : false; }
457
463};
464
479 ActId *id2, act_connection *c2);
480
494 struct act_attr **x, struct act_attr *a);
495
504
510void act_print_attributes (FILE *fp, act_attr *a);
511
512#endif /* __ACT_VALUE_H__ */
513
This class is used to store Act identifiers that correspond to instances. Identifiers have an optiona...
Definition: act_id.h:56
The ActNamespace class holds all the information about a namespace.
Definition: namespaces.h:469
An instance type.
Definition: inst.h:92
direction
Definition: basetype.h:87
UserDef stores information that is common to all user-defined types. User-defined types are more comp...
Definition: types.h:310
This class is used to create an instance in a scope. The name comes from the fact that this is used t...
Definition: value.h:342
ActNamespace * global
Definition: value.h:358
const char * getName()
Definition: value.h:437
InstType * t
Definition: value.h:344
act_attr * getAttrIdx(int i)
Definition: value.h:450
act_connection * c
Definition: value.h:366
act_connection * connection()
Definition: value.h:431
bool hasConnection(int i)
Definition: value.h:402
bool hasAnyConnection()
Definition: value.h:393
act_attr * getAttr()
Definition: value.h:442
bool isPrimary(int i)
Definition: value.h:424
struct act_attr ** array_spec
Definition: value.h:348
struct act_attr * a
instance attributes for the value
Definition: value.h:347
bool haveAttrIdx()
Definition: value.h:456
int numAttrIdx()
bool hasSubconnections()
Definition: value.h:409
bool hasConnection()
Definition: value.h:385
unsigned int immutable
Definition: value.h:354
bool isPrimary()
Definition: value.h:416
const char * name
Definition: value.h:370
union ValueIdx::@40 u
the value associated with this instance
long idx
Definition: value.h:363
unsigned int init
Definition: value.h:351
Connections.
Definition: value.h:113
act_connection * next
Definition: value.h:133
bool hasDirectconnections(int i)
Definition: value.h:230
bool hasSubconnections(int i)
Definition: value.h:244
act_connection * parent
Definition: value.h:127
void Print(FILE *fp)
act_connection * primary()
bool hasSubconnections()
Definition: value.h:236
bool hasAnyConnection()
ValueIdx * getvx()
act_connection * up
Definition: value.h:130
act_connection ** a
Definition: value.h:137
bool isPrimary()
Definition: value.h:163
int myoffset()
Definition: value.h:206
bool disconnectable()
int numTotSubconnections()
bool isPrimary(int i)
Definition: value.h:176
int numSubconnections()
ValueIdx * vx
Definition: value.h:115
ActId * toid()
Type::direction getDir()
act_connection * getsubconn(int idx, int sz)
bool hasDirectconnections()
Definition: value.h:214
ActNamespace * getnsifglobal()
int suboffset(act_connection *c)
unsigned int getctype()
act_connection(act_connection *_parent=NULL)
Attribute list associated with an instance.
Definition: lang.h:44
void act_mk_connection(UserDef *ux, ActId *id1, act_connection *c1, ActId *id2, act_connection *c2)
void _act_mk_raw_connection(act_connection *c1, act_connection *c2)
void act_print_attributes(FILE *fp, act_attr *a)
void act_merge_attributes(ValueIdx *vx1, ValueIdx *vx2, struct act_attr **x, struct act_attr *a)