torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ParserHelpers.hpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 
5 // This program is free software: you can redistribute it and/or modify it under the terms of the
6 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 // the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program. If
14 // not, see <http://www.gnu.org/licenses/>.
15 
16 #ifndef TORC_GENERIC_EDIF_PARSERHELPERS_HPP
17 #define TORC_GENERIC_EDIF_PARSERHELPERS_HPP
18 
19 #include <string>
20 #include <vector>
21 #include <list>
22 
23 #include <boost/shared_ptr.hpp>
24 
26 #include "torc/generic/Value.hpp"
27 
28 namespace torc { namespace generic { class Parameter; } }
29 namespace torc { namespace generic { class PortAttributes; } }
30 namespace torc { namespace generic { class TimeStamp; } }
31 namespace torc { namespace generic { class Written; } }
32 namespace torc { namespace generic { class InterfaceAttributes; } }
33 namespace torc { namespace generic { class LogicValueAttributes; } }
34 
35 
36 namespace torc {
37 namespace generic {
38 
39 struct NameData {
42  std::vector<size_t> mIndices;
43 
44  ~NameData() throw () {
45  }
46 };
47 
48 struct ArrayData {
50  std::vector<size_t> mIndices;
51 };
52 
53 struct ViewRefData {
57 
58  ViewRefData() : mViewName(NULL), mCellName(NULL), mLibraryName(NULL) {
59  }
60 
62  delete mViewName;
63  delete mCellName;
64  delete mLibraryName;
65  }
66 };
67 
68 struct CellRefData {
71 
72  CellRefData() : mCellName(NULL), mLibraryName(NULL) {
73  }
74 
76  delete mCellName;
77  delete mLibraryName;
78  }
79 };
80 
81 struct LogicRefData {
84 
86  }
87 
89  delete mLogicName;
90  delete mLibraryName;
91  }
92 };
93 
98  mName(NULL), mView(NULL) {
99  }
100 };
101 
102 struct PortRefData {
107 
108  PortRefData() : mParentPort(NULL), mPortName(NULL), mInstanceName(NULL), mView(NULL) {
109  }
110 
112  delete mParentPort;
113  delete mPortName;
114  delete mInstanceName;
115  delete mView;
116  }
117 };
118 
119 struct NetRefData {
124 
125  NetRefData() : mParentNet(NULL), mNetName(NULL), mInstanceName(NULL), mView(NULL) {
126  }
127 
129  delete mParentNet;
130  delete mNetName;
131  delete mInstanceName;
132  delete mView;
133  }
134 };
135 
136 struct PortInstData {
139 
140  PortInstData() : mRefData(NULL), mAttribute(NULL) {
141  }
142 
144  delete mRefData;
145  }
146 };
147 
148 struct PortListData {
149  std::vector<PortRefData*> mPortRefs;
150 
152  }
153 
155  for(std::vector<PortRefData*>::iterator it = mPortRefs.begin(); it != mPortRefs.end();
156  ++it) {
157  delete *it;
158  }
159  }
160 };
161 
162 struct VersionData {
163  int32_t mFirst;
164  int32_t mSecond;
165  int32_t mThird;
166 };
167 
168 struct ValueData {
169  std::vector<Value> mValues;
170 };
171 
172 struct PairData {
173  int32_t mX;
174  int32_t mY;
175 
176  PairData(int32_t inX = 0, int32_t inY = 0) : mX(inX), mY(inY) {
177  }
178 };
179 
180 struct PairStrData {
183 
185  : mFirst(inFirst), mSecond(inSecond) {
186  }
187 };
188 
192 
193  ParamAssignInfo(NameData* inNameData = NULL, ValueData* inValueData = NULL)
194  : mNameData(inNameData), mValueData(inValueData) {
195  }
197  delete mNameData;
198  delete mValueData;
199  }
200 };
201 
202 struct InstanceInfo {
204  std::vector<ParamAssignInfo*> mParamAssign;
205  std::vector<PortInstData*> mPortInst;
206  std::vector<std::string> mUserData;
207  std::vector<std::string> mComment;
210 
212  mDesignator(), mTiming() {
213  }
214 
216  delete mViewRefData;
217  for(std::vector<ParamAssignInfo*>::iterator it = mParamAssign.begin();
218  it != mParamAssign.end(); it++) {
219  delete (*it);
220  }
221  for(std::vector<PortInstData*>::iterator it = mPortInst.begin(); it != mPortInst.end();
222  it++) {
223  delete (*it);
224  }
225  mUserData.clear();
226  mComment.clear();
227  }
228 };
229 
231  std::list<NameData*> mNameDataList;
232 
234  }
235 
237  for(std::list<NameData*>::iterator it = mNameDataList.begin(); it != mNameDataList.end();
238  ++it) {
239  delete *it;
240  }
241  }
242 };
243 
244 } //namespace generic
245 } //namespace torc
246 
247 #endif // TORC_GENERIC_EDIF_PARSERHELPERS_HPP
Represents attributes of a Port or PortReference object.
std::list< NameData * > mNameDataList
std::vector< std::string > mUserData
PairData(int32_t inX=0, int32_t inY=0)
std::vector< size_t > mIndices
std::vector< std::string > mComment
std::vector< size_t > mIndices
PairStrData(std::string inFirst=std::string(), std::string inSecond=std::string())
std::vector< Value > mValues
std::vector< ParamAssignInfo * > mParamAssign
std::string string
ParamAssignInfo(NameData *inNameData=NULL, ValueData *inValueData=NULL)
std::vector< PortRefData * > mPortRefs
std::vector< PortInstData * > mPortInst
boost::shared_ptr< Timing > TimingSharedPtr