Limbo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
EbeamDataBase.h
Go to the documentation of this file.
1 
8 #ifndef EBEAMPARSER_DATABASE_H
9 #define EBEAMPARSER_DATABASE_H
10 
11 #include <string>
12 #include <vector>
13 #include <iostream>
14 #include <fstream>
15 #include <sstream>
16 #include <cassert>
17 
19 namespace EbeamParser {
20 
22 using std::cout;
23 using std::endl;
24 using std::cerr;
25 using std::string;
26 using std::vector;
27 using std::pair;
28 using std::make_pair;
29 using std::ostringstream;
30 typedef int int32_t;
31 typedef unsigned int uint32_t;
32 typedef long int64_t;
34 
35 
38 class IntegerArray : public vector<int>
39 {
40  public:
42  typedef vector<int> base_type;
43  using base_type::size_type;
44  using base_type::value_type;
45  using base_type::allocator_type;
47 
50  IntegerArray(const allocator_type& alloc = allocator_type())
51  : base_type(alloc) {}
56  IntegerArray(size_type n, const value_type& val, const allocator_type& alloc = allocator_type())
57  : base_type(n, val, alloc) {}
58 };
59 
62 class StringArray : public vector<string>
63 {
64  public:
66  typedef vector<string> base_type;
67  using base_type::size_type;
68  using base_type::value_type;
69  using base_type::allocator_type;
71 
74  StringArray(const allocator_type& alloc = allocator_type())
75  : base_type(alloc) {}
80  StringArray(size_type n, const value_type& val, const allocator_type& alloc = allocator_type())
81  : base_type(n, val, alloc) {}
82 };
83 
86 struct Item
87 {
89  virtual void print(ostringstream&) const {};
94  friend std::ostream& operator<<(std::ostream& os, Item const& rhs)
95  {
96  std::ostringstream ss;
97  rhs.print(ss);
98  os << ss.str();
99  return os;
100  }
105  friend ostringstream& operator<<(ostringstream& ss, Item const& rhs)
106  {
107  rhs.print(ss);
108  return ss;
109  }
110 };
112 struct EbeamBoundary : public Item
113 {
114  double offset;
115  double width;
116  double step;
117  vector<int32_t> vLayerId;
118  vector<string> vLayer;
119 
123  void reset()
124  {
125  offset = 0;
126  width = 0;
127  step = 0;
128  vLayerId.clear();
129  vLayer.clear();
130  }
133  virtual void print(ostringstream& ss) const
134  {
135  ss << "//////// EbeamBoundary ////////" << endl
136  << "offset = " << offset << endl
137  << "width = " << width << endl
138  << "step = " << step << endl
139  << "vLayerId = ";
140  for (vector<int32_t>::const_iterator it = vLayerId.begin(); it != vLayerId.end(); ++it)
141  ss << *it << "\t";
142  ss << endl;
143  ss << "vLayer = ";
144  for (vector<string>::const_iterator it = vLayer.begin(); it != vLayer.end(); ++it)
145  ss << *it << "\t";
146  }
147 };
149 struct ConfSite : public Item
150 {
151  string confsite_name;
152  int32_t layer_id;
153  string layer;
154  vector<int32_t> vSiteCnt;
155 
159  void reset()
160  {
161  confsite_name = "";
162  layer_id = -1;
163  layer = "";
164  vSiteCnt.clear();
165  }
168  virtual void print(ostringstream& ss) const
169  {
170  ss << "//////// ConfSite ////////" << endl;
171  ss << "confsite_name = " << confsite_name << endl;
172  ss << "layer_id = " << layer_id << endl;
173  ss << "layer = " << layer << endl;
174  ss << "vSiteCnt = ";
175  for (vector<int32_t>::const_iterator it = vSiteCnt.begin(); it != vSiteCnt.end(); ++it)
176  ss << *it << "\t";
177  ss << endl;
178  }
179 };
181 struct Macro : public Item
182 {
183  string macro_name;
184  vector<ConfSite> vConfSite;
185  void reset()
187  {
188  macro_name = "";
189  vConfSite.clear();
190  }
193  virtual void print(ostringstream& ss) const
194  {
195  ss << "//////// Macro ////////" << endl;
196  ss << "macro_name = " << macro_name << endl;
197  for (vector<ConfSite>::const_iterator it = vConfSite.begin(); it != vConfSite.end(); ++it)
198  ss << *it << endl;
199  }
200 };
201 
202 // forward declaration
207 {
208  public:
211  virtual void set_ebeam_unit(int) = 0;
213  virtual void set_ebeam_boundary(EbeamBoundary const&) = 0;
215  virtual void add_ebeam_macro(Macro const&) = 0;
216 };
217 
218 } // namespace EbeamParser
219 
220 #endif
void reset()
reset all data members
StringArray(const allocator_type &alloc=allocator_type())
Definition: EbeamDataBase.h:74
friend ostringstream & operator<<(ostringstream &ss, Item const &rhs)
virtual void set_ebeam_boundary(EbeamBoundary const &)=0
set ebeam boundary
double offset
offset of beam
virtual void print(ostringstream &ss) const
print data members
describe conflict sites for each standard cell type
Temporary data structures to hold parsed data. Base class for all temporary data structures.
Definition: EbeamDataBase.h:86
virtual void set_ebeam_unit(int)=0
set unit of micron in database, e.g., unit 1000 denotes 1000 in database unit is equal to 1 micron ...
void reset()
reset all data members
virtual void print(ostringstream &ss) const
print data members
double step
step of beam
friend std::ostream & operator<<(std::ostream &os, Item const &rhs)
Definition: EbeamDataBase.h:94
string confsite_name
name
IntegerArray(const allocator_type &alloc=allocator_type())
Definition: EbeamDataBase.h:50
bison does not support vector very well, so here create a dummy class for string array.
Definition: EbeamDataBase.h:62
vector< string > vLayer
array of layer name
vector< int32_t > vLayerId
array of layer id
ConfSite()
constructor
bison does not support vector very well, so here create a dummy class for integer array...
Definition: EbeamDataBase.h:38
void reset()
reset all data members
describe ebeam boundary
describe conflict sites
virtual void print(ostringstream &ss) const
print data members
virtual void add_ebeam_macro(Macro const &)=0
add ebeam macro for each standard cell
IntegerArray(size_type n, const value_type &val, const allocator_type &alloc=allocator_type())
Definition: EbeamDataBase.h:56
vector< int32_t > vSiteCnt
array of site indices that are conflicted
virtual void print(ostringstream &) const
print data members
Definition: EbeamDataBase.h:89
Base class for ebeam database. Only pure virtual functions are defined. User needs to inheritate this...
double width
width of beam
string layer
layer name
vector< ConfSite > vConfSite
string macro_name
standard cell type
namespace for EbeamParser
Definition: EbeamDataBase.h:19
StringArray(size_type n, const value_type &val, const allocator_type &alloc=allocator_type())
Definition: EbeamDataBase.h:80
int32_t layer_id
layer id