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 "dbDatabase.h" 37 #include "dbId.h" 38 #include "dbTypes.h" 39 #include "dbVector.h" // disconnect the child-iterm 40 #include "odb.h" 41 42 namespace odb { 43 44 class _dbBox; 45 class _dbInstHdr; 46 class _dbHier; 47 class _dbITerm; 48 class _dbRegion; 49 class _dbDatabase; 50 class _dbModule; 51 class _dbGroup; 52 class dbInst; 53 class dbIStream; 54 class dbOStream; 55 class dbDiff; 56 57 struct _dbInstFlags 58 { 59 dbOrientType::Value _orient : 4; 60 dbPlacementStatus::Value _status : 4; 61 uint _user_flag_1 : 1; 62 uint _user_flag_2 : 1; 63 uint _user_flag_3 : 1; 64 uint _size_only : 1; 65 uint _dont_touch : 1; 66 uint _dont_size : 1; 67 dbSourceType::Value _source : 4; 68 uint _eco_create : 1; 69 uint _eco_destroy : 1; 70 uint _eco_modify : 1; 71 uint _input_cone : 1; 72 uint _inside_cone : 1; 73 uint _level : 9; 74 }; 75 76 class _dbInst : public _dbObject 77 { 78 public: 79 enum Field // dbJournalField name 80 { 81 FLAGS, 82 ORIGIN, 83 INVALIDATETIMING 84 }; 85 86 _dbInstFlags _flags; 87 char* _name; 88 int _x; 89 int _y; 90 int _weight; 91 dbId<_dbInst> _next_entry; 92 dbId<_dbInstHdr> _inst_hdr; 93 dbId<_dbBox> _bbox; 94 dbId<_dbRegion> _region; 95 dbId<_dbModule> _module; 96 dbId<_dbGroup> _group; 97 dbId<_dbInst> _region_next; 98 dbId<_dbInst> _module_next; 99 dbId<_dbInst> _group_next; 100 dbId<_dbInst> _region_prev; 101 dbId<_dbHier> _hierarchy; 102 dbVector<uint> _iterms; 103 dbId<_dbBox> _halo; 104 105 _dbInst(_dbDatabase*); 106 _dbInst(_dbDatabase*, const _dbInst& i); 107 ~_dbInst(); 108 109 bool operator==(const _dbInst& rhs) const; 110 bool operator!=(const _dbInst& rhs) const { return !operator==(rhs); } 111 bool operator<(const _dbInst& rhs) const; 112 void differences(dbDiff& diff, const char* field, const _dbInst& rhs) const; 113 void out(dbDiff& diff, char side, const char* field) const; 114 static void setInstBBox(_dbInst* inst); 115 }; 116 117 dbOStream& operator<<(dbOStream& stream, const _dbInst& inst); 118 dbIStream& operator>>(dbIStream& stream, _dbInst& inst); 119 120 } // namespace odb 121