1 ///////////////////////////////////////////////////////////////////////////////
2 // BSD 3-Clause License
3 //
4 // Copyright (c) 2020, The Regents of the University of California
5 // All rights reserved.
6 //
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions are met:
9 //
10 // * Redistributions of source code must retain the above copyright notice, this
11 //   list of conditions and the following disclaimer.
12 //
13 // * Redistributions in binary form must reproduce the above copyright notice,
14 //   this list of conditions and the following disclaimer in the documentation
15 //   and/or other materials provided with the distribution.
16 //
17 // * Neither the name of the copyright holder nor the names of its
18 //   contributors may be used to endorse or promote products derived from
19 //   this software without specific prior written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 // POSSIBILITY OF SUCH DAMAGE.
32 
33 // Generator Code Begin Cpp
34 #include "dbTechLayerEolExtensionRule.h"
35 
36 #include "db.h"
37 #include "dbDatabase.h"
38 #include "dbDiff.hpp"
39 #include "dbTable.h"
40 #include "dbTable.hpp"
41 #include "dbTechLayer.h"
42 // User Code Begin Includes
43 // User Code End Includes
44 namespace odb {
45 
46 template class dbTable<_dbTechLayerEolExtensionRule>;
47 
operator ==(const _dbTechLayerEolExtensionRule & rhs) const48 bool _dbTechLayerEolExtensionRule::operator==(
49     const _dbTechLayerEolExtensionRule& rhs) const
50 {
51   if (flags_.parallel_only_ != rhs.flags_.parallel_only_)
52     return false;
53 
54   if (spacing_ != rhs.spacing_)
55     return false;
56 
57   // User Code Begin ==
58   // User Code End ==
59   return true;
60 }
operator <(const _dbTechLayerEolExtensionRule & rhs) const61 bool _dbTechLayerEolExtensionRule::operator<(
62     const _dbTechLayerEolExtensionRule& rhs) const
63 {
64   // User Code Begin <
65   if (spacing_ >= rhs.spacing_)
66     return false;
67   // User Code End <
68   return true;
69 }
differences(dbDiff & diff,const char * field,const _dbTechLayerEolExtensionRule & rhs) const70 void _dbTechLayerEolExtensionRule::differences(
71     dbDiff& diff,
72     const char* field,
73     const _dbTechLayerEolExtensionRule& rhs) const
74 {
75   DIFF_BEGIN
76 
77   DIFF_FIELD(flags_.parallel_only_);
78   DIFF_FIELD(spacing_);
79   // User Code Begin Differences
80   // User Code End Differences
81   DIFF_END
82 }
out(dbDiff & diff,char side,const char * field) const83 void _dbTechLayerEolExtensionRule::out(dbDiff& diff,
84                                        char side,
85                                        const char* field) const
86 {
87   DIFF_OUT_BEGIN
88   DIFF_OUT_FIELD(flags_.parallel_only_);
89   DIFF_OUT_FIELD(spacing_);
90 
91   // User Code Begin Out
92   // User Code End Out
93   DIFF_END
94 }
_dbTechLayerEolExtensionRule(_dbDatabase * db)95 _dbTechLayerEolExtensionRule::_dbTechLayerEolExtensionRule(_dbDatabase* db)
96 {
97   uint32_t* flags__bit_field = (uint32_t*) &flags_;
98   *flags__bit_field = 0;
99   spacing_ = 0;
100   // User Code Begin Constructor
101   // User Code End Constructor
102 }
_dbTechLayerEolExtensionRule(_dbDatabase * db,const _dbTechLayerEolExtensionRule & r)103 _dbTechLayerEolExtensionRule::_dbTechLayerEolExtensionRule(
104     _dbDatabase* db,
105     const _dbTechLayerEolExtensionRule& r)
106 {
107   flags_.parallel_only_ = r.flags_.parallel_only_;
108   flags_.spare_bits_ = r.flags_.spare_bits_;
109   spacing_ = r.spacing_;
110   // User Code Begin CopyConstructor
111   // User Code End CopyConstructor
112 }
113 
operator >>(dbIStream & stream,_dbTechLayerEolExtensionRule & obj)114 dbIStream& operator>>(dbIStream& stream, _dbTechLayerEolExtensionRule& obj)
115 {
116   uint32_t* flags__bit_field = (uint32_t*) &obj.flags_;
117   stream >> *flags__bit_field;
118   stream >> obj.spacing_;
119   stream >> obj.extension_tbl_;
120   // User Code Begin >>
121   // User Code End >>
122   return stream;
123 }
operator <<(dbOStream & stream,const _dbTechLayerEolExtensionRule & obj)124 dbOStream& operator<<(dbOStream& stream,
125                       const _dbTechLayerEolExtensionRule& obj)
126 {
127   uint32_t* flags__bit_field = (uint32_t*) &obj.flags_;
128   stream << *flags__bit_field;
129   stream << obj.spacing_;
130   stream << obj.extension_tbl_;
131   // User Code Begin <<
132   // User Code End <<
133   return stream;
134 }
135 
~_dbTechLayerEolExtensionRule()136 _dbTechLayerEolExtensionRule::~_dbTechLayerEolExtensionRule()
137 {
138   // User Code Begin Destructor
139   // User Code End Destructor
140 }
141 
142 // User Code Begin PrivateMethods
143 // User Code End PrivateMethods
144 
145 ////////////////////////////////////////////////////////////////////
146 //
147 // dbTechLayerEolExtensionRule - Methods
148 //
149 ////////////////////////////////////////////////////////////////////
150 
setSpacing(int spacing)151 void dbTechLayerEolExtensionRule::setSpacing(int spacing)
152 {
153   _dbTechLayerEolExtensionRule* obj = (_dbTechLayerEolExtensionRule*) this;
154 
155   obj->spacing_ = spacing;
156 }
157 
getSpacing() const158 int dbTechLayerEolExtensionRule::getSpacing() const
159 {
160   _dbTechLayerEolExtensionRule* obj = (_dbTechLayerEolExtensionRule*) this;
161   return obj->spacing_;
162 }
163 
getExtensionTable(std::vector<std::pair<int,int>> & tbl) const164 void dbTechLayerEolExtensionRule::getExtensionTable(
165     std::vector<std::pair<int, int>>& tbl) const
166 {
167   _dbTechLayerEolExtensionRule* obj = (_dbTechLayerEolExtensionRule*) this;
168   tbl = obj->extension_tbl_;
169 }
170 
setParallelOnly(bool parallel_only)171 void dbTechLayerEolExtensionRule::setParallelOnly(bool parallel_only)
172 {
173   _dbTechLayerEolExtensionRule* obj = (_dbTechLayerEolExtensionRule*) this;
174 
175   obj->flags_.parallel_only_ = parallel_only;
176 }
177 
isParallelOnly() const178 bool dbTechLayerEolExtensionRule::isParallelOnly() const
179 {
180   _dbTechLayerEolExtensionRule* obj = (_dbTechLayerEolExtensionRule*) this;
181 
182   return obj->flags_.parallel_only_;
183 }
184 
185 // User Code Begin dbTechLayerEolExtensionRulePublicMethods
186 
addEntry(int eol,int ext)187 void dbTechLayerEolExtensionRule::addEntry(int eol, int ext)
188 {
189   _dbTechLayerEolExtensionRule* obj = (_dbTechLayerEolExtensionRule*) this;
190   obj->extension_tbl_.push_back({eol, ext});
191 }
192 
create(dbTechLayer * _layer)193 dbTechLayerEolExtensionRule* dbTechLayerEolExtensionRule::create(
194     dbTechLayer* _layer)
195 {
196   _dbTechLayer* layer = (_dbTechLayer*) _layer;
197   _dbTechLayerEolExtensionRule* newrule = layer->eol_ext_rules_tbl_->create();
198   return ((dbTechLayerEolExtensionRule*) newrule);
199 }
200 
201 dbTechLayerEolExtensionRule*
getTechLayerEolExtensionRule(dbTechLayer * inly,uint dbid)202 dbTechLayerEolExtensionRule::getTechLayerEolExtensionRule(dbTechLayer* inly,
203                                                           uint dbid)
204 {
205   _dbTechLayer* layer = (_dbTechLayer*) inly;
206   return (dbTechLayerEolExtensionRule*) layer->eol_ext_rules_tbl_->getPtr(dbid);
207 }
destroy(dbTechLayerEolExtensionRule * rule)208 void dbTechLayerEolExtensionRule::destroy(dbTechLayerEolExtensionRule* rule)
209 {
210   _dbTechLayer* layer = (_dbTechLayer*) rule->getImpl()->getOwner();
211   dbProperty::destroyProperties(rule);
212   layer->eol_ext_rules_tbl_->destroy((_dbTechLayerEolExtensionRule*) rule);
213 }
214 
215 // User Code End dbTechLayerEolExtensionRulePublicMethods
216 }  // namespace odb
217    // Generator Code End Cpp
218