vrq
cportdir.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (C) 1997-2007, Mark Hummel
3  * This file is part of Vrq.
4  *
5  * Vrq is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * Vrq is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301 USA
19  *****************************************************************************
20  */
21 /******************************************************************************
22  *
23  *
24  * cportdir.hpp
25  * - class definition of port direction
26  * definition nodes
27  *
28  ******************************************************************************
29  */
30 
31 #ifndef CPORTDIR_HPP
32 #define CPORTDIR_HPP
33 
34 #include <stdio.h>
35 #include "glue.h"
36 #include "cnode.h"
37 #include "cdecl.h"
38 
39 
40 class CNode;
41 
45 class CPortDir : public CDecl
46 {
47 private:
48  CDecl* decl;
49  bool hasExpression;
50  CNode* expression;
51 public:
59  CPortDir( CSymbol* symbol, Coord_t* aLoc,
60  Decl_t type, CDataType* dataType );
66  virtual CDecl* Clone( CObstack* heap );
71  virtual void Dump( FILE* f );
76  CDecl* GetDecl( void ) { return decl; }
81  void SetDecl( CDecl* d ) { decl = d; }
86  CNode* GetExpression( void ) { return expression; }
91  void SetExpression( CNode* e ) { expression = e; }
96  bool GetHasExpression( void ) { return hasExpression; }
101  void SetHasExpression( bool f ) { hasExpression = f; }
102 protected:
108  void Copy( CObstack* heap, CPortDir& d );
109 private:
110  /*
111  * Disable copy constructor.
112  */
113  CPortDir( const CPortDir& );
114 public:
115  virtual void PreVisit1( int (*func)(CNode*,void*), void* data );
116  virtual void PostVisit1( void (*func)(CNode*, void*), void* data );
117  virtual void PostSubVisit1( CNode* (*func)(CNode*, void*), void* data );
118 };
119 
120 #endif // CPORT_HPP
bool GetHasExpression(void)
Get has expression flag.
Definition: cportdir.h:96
Decl_t
Declaration types.
Definition: cdecl.h:74
void SetHasExpression(bool f)
Set has expression flag.
Definition: cportdir.h:101
CNode * GetExpression(void)
Get expression.
Definition: cportdir.h:86
Base class for describing data types.
Definition: cdatatype.h:110
CPortDir(CSymbol *symbol, Coord_t *aLoc, Decl_t type, CDataType *dataType)
Create a port direction declaration.
Structure to hold file coordinates.
Definition: cdecl.h:47
Holder for character strings.
Definition: csymbol.h:44
Bulk object allocation object.
Definition: cobstack.h:46
void Copy(CObstack *heap, CPortDir &d)
Deep copy of declaration.
Primary data structure representing parse tree nodes.
Definition: cnode.h:197
void SetDecl(CDecl *d)
Set association to variable declaration.
Definition: cportdir.h:81
CDecl * GetDecl(void)
Get variable declaration associated with this.
Definition: cportdir.h:76
Base class for describing declaration objects.
Definition: cdecl.h:164
void SetExpression(CNode *e)
Set expression.
Definition: cportdir.h:91
Declaration object for input/output/inout statements.
Definition: cportdir.h:45
virtual void Dump(FILE *f)
Dump declaration to file descriptor.
virtual void PostVisit1(void(*func)(CNode *, void *), void *data)
virtual CDecl * Clone(CObstack *heap)
Create a clone of this declaration.
virtual void PostSubVisit1(CNode *(*func)(CNode *, void *), void *data)
virtual void PreVisit1(int(*func)(CNode *, void *), void *data)