1 ///////////////////////////////////////////////////////////////////////////////
2 // BSD 3-Clause License
3 //
4 // Copyright (c) 2019, Nefelus Inc
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 #pragma once
34
35 #include "dbCore.h"
36 #include "dbId.h"
37 #include "dbTypes.h"
38 #include "dbVector.h"
39 #include "odb.h"
40
41 namespace odb {
42
43 class _dbMPin;
44 class _dbTarget;
45 class _dbDatabase;
46 class _dbTechAntennaAreaElement;
47 class _dbTechAntennaPinModel;
48 class dbIStream;
49 class dbOStream;
50 class dbDiff;
51
52 struct _dbMTermFlags
53 {
54 dbIoType::Value _io_type : 4;
55 dbSigType::Value _sig_type : 4;
56 uint _mark : 1;
57 uint _spare_bits : 23;
58 };
59
60 class _dbMTerm : public _dbObject
61 {
62 public:
63 // PERSISTANT-MEMBERS
64 _dbMTermFlags _flags;
65 uint _order_id;
66 char* _name;
67 dbId<_dbMTerm> _next_entry;
68 dbId<_dbMTerm> _next_mterm;
69 dbId<_dbMPin> _pins;
70 dbId<_dbTarget> _targets;
71 dbId<_dbTechAntennaPinModel> _oxide1;
72 dbId<_dbTechAntennaPinModel> _oxide2;
73
74 dbVector<_dbTechAntennaAreaElement*> _par_met_area;
75 dbVector<_dbTechAntennaAreaElement*> _par_met_sidearea;
76 dbVector<_dbTechAntennaAreaElement*> _par_cut_area;
77 dbVector<_dbTechAntennaAreaElement*> _diffarea;
78
79 void* _sta_port; // not saved
80
81 friend dbOStream& operator<<(dbOStream& stream, const _dbMTerm& mterm);
82 friend dbIStream& operator>>(dbIStream& stream, _dbMTerm& mterm);
83
84 _dbMTerm(_dbDatabase* db);
85 _dbMTerm(_dbDatabase* db, const _dbMTerm& m);
86 ~_dbMTerm();
87
88 bool operator==(const _dbMTerm& rhs) const;
89 bool operator!=(const _dbMTerm& rhs) const { return !operator==(rhs); }
90 void differences(dbDiff& diff, const char* field, const _dbMTerm& rhs) const;
91 void out(dbDiff& diff, char side, const char* field) const;
92 };
93
_dbMTerm(_dbDatabase *)94 inline _dbMTerm::_dbMTerm(_dbDatabase*)
95 {
96 _flags._io_type = dbIoType::INPUT;
97 _flags._sig_type = dbSigType::SIGNAL;
98 _flags._mark = 0;
99 _flags._spare_bits = 0;
100 _order_id = 0;
101 _name = 0;
102 _par_met_area.clear();
103 _par_met_sidearea.clear();
104 _par_cut_area.clear();
105 _diffarea.clear();
106 _sta_port = nullptr;
107 }
~_dbMTerm()108 inline _dbMTerm::~_dbMTerm()
109 {
110 if (_name)
111 free((void*) _name);
112
113 /************************************ dimitri_note
114 *********************************** The following 4 vfields should change to
115 look like dbId<_dbTechAntennaPinModel> _oxide1;
116
117 dbVector<_dbTechAntennaAreaElement *> _par_met_area;
118 dbVector<_dbTechAntennaAreaElement *> _par_met_sidearea;
119 dbVector<_dbTechAntennaAreaElement *> _par_cut_area;
120 dbVector<_dbTechAntennaAreaElement *> _diffarea;
121 ************************************************************************************************/
122
123 /* dimitri_fix : cooment out delete loops because of the copiler warning
124 *************************** dbMTerm.h:97:15: warning: possible problem
125 detected in invocation of delete operator: [-Wdelete-incomplete] delete
126 *antitr;
127 ****************************************************************************************************/
128
129 /**********************************************************************************
130 dimitri_fix ********
131
132 dbVector<_dbTechAntennaAreaElement *>::iterator antitr;
133 for (antitr = _par_met_area.begin(); antitr != _par_met_area.end();
134 antitr++) delete *antitr; _par_met_area.clear();
135
136 for (antitr = _par_met_sidearea.begin(); antitr !=
137 _par_met_sidearea.end(); antitr++) delete *antitr; _par_met_sidearea.clear();
138
139 for (antitr = _par_cut_area.begin(); antitr != _par_cut_area.end();
140 antitr++) delete *antitr; _par_cut_area.clear();
141
142 for (antitr = _diffarea.begin(); antitr != _diffarea.end(); antitr++)
143 delete *antitr;
144 _diffarea.clear();
145 ***********************************************************************************************************/
146 }
147 } // namespace odb
148