vrq
cinstance.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  * cinstance.hpp
25  * - class definition an instance
26  * of module, macromodules, and primitive
27  * definition nodes
28  *
29  ******************************************************************************
30  */
31 
32 #ifndef CINSTANCE_HPP
33 #define CINSTANCE_HPP
34 
35 #include <vector>
36 #include "glue.h"
37 #include "cdecl.h"
38 
39 
40 class CModule;
41 
45 class CInstance: public CDecl
46 {
47 private:
48  CModule* definition;
49  CNode* parameters;
50  CNode* arguments;
51  int isGate;
52  vector<CNode*> argumentVector;
53  unsigned long long timestamp;
54  unsigned long long cachedTimestamp;
56 public:
66  CInstance( CSymbol* aSymbol, CModule* definition,
67  CNode* parameters, CNode* arguments, Coord_t* aLoc );
73  virtual CDecl* Clone( CObstack* heap );
78  CModule* GetDefinition( void );
83  CNode* GetParameters( void );
88  void SetParameters( CNode* param );
93  CNode* GetArguments( void );
98  void SetArguments( CNode* n );
103  vector<CNode*>* GetArgumentVector( void );
108  int IsGate() { return isGate; }
113  virtual void Dump( FILE* f );
118  void PreVisit1( int (*func)(CNode*,void*), void* data );
119  void PostVisit1( void (*func)(CNode*, void*), void* data );
120  void PostSubVisit1( CNode* (*func)(CNode*, void*), void* data );
121 private:
122  void PushArgs( CNode* n, int level );
123  CInstance( const CInstance& );
127 };
128 
129 #endif // CINSTANCE_HPP
CNode * GetParameters(void)
Get instance parameters.
virtual CDecl * Clone(CObstack *heap)
Create a clone of this declaration.
virtual void PreVisit1(int(*func)(CNode *, void *), void *data)
CInstance(CSymbol *aSymbol, CModule *definition, CNode *parameters, CNode *arguments, Coord_t *aLoc)
Create an instance.
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
int IsGate()
Determine if instance is a gate.
Definition: cinstance.h:108
Primary data structure representing parse tree nodes.
Definition: cnode.h:197
CNode * GetArguments(void)
Get instance arguments.
CModule * GetDefinition(void)
Get module definition.
Declaration object for module and gate instances.
Definition: cinstance.h:45
void SetArguments(CNode *n)
Set instance arguments.
virtual void PostSubVisit1(CNode *(*func)(CNode *, void *), void *data)
Definition: cmodule.h:54
Base class for describing declaration objects.
Definition: cdecl.h:164
virtual void PostVisit1(void(*func)(CNode *, void *), void *data)
void SetParameters(CNode *param)
Set instance parameters.
virtual void Dump(FILE *f)
Dump instance info to file descriptor.
vector< CNode * > * GetArgumentVector(void)
Get array of argument nodes.