diff --git a/src/odb/include/odb/db.h b/src/odb/include/odb/db.h index bf2d747c1d6..53ea8f98d46 100644 --- a/src/odb/include/odb/db.h +++ b/src/odb/include/odb/db.h @@ -7460,9 +7460,13 @@ class dbGDSARef : public dbObject dbGDSSTrans getTransform() const; - void set_colRow(const std::pair& colRow); + void setNumRows(int16_t num_rows); - std::pair get_colRow() const; + int16_t getNumRows() const; + + void setNumColumns(int16_t num_columns); + + int16_t getNumColumns() const; // User Code Begin dbGDSARef dbGDSStructure* getStructure() const; diff --git a/src/odb/src/codeGenerator/schema/gds/dbGDSARef.json b/src/odb/src/codeGenerator/schema/gds/dbGDSARef.json index fef1666f796..d129c3c9346 100644 --- a/src/odb/src/codeGenerator/schema/gds/dbGDSARef.json +++ b/src/odb/src/codeGenerator/schema/gds/dbGDSARef.json @@ -25,9 +25,14 @@ "flags":[] }, { - "name":"_colRow", - "type":"std::pair", - "flags":["no-template"] + "name":"_num_rows", + "type":"int16_t", + "default":"1" + }, + { + "name":"_num_columns", + "type":"int16_t", + "default":"1" }, { "name":"_structure", diff --git a/src/odb/src/db/dbGDSARef.cpp b/src/odb/src/db/dbGDSARef.cpp index dff706aafac..8cabe3f9ce8 100644 --- a/src/odb/src/db/dbGDSARef.cpp +++ b/src/odb/src/db/dbGDSARef.cpp @@ -56,6 +56,12 @@ bool _dbGDSARef::operator==(const _dbGDSARef& rhs) const if (_ul != rhs._ul) { return false; } + if (_num_rows != rhs._num_rows) { + return false; + } + if (_num_columns != rhs._num_columns) { + return false; + } if (_structure != rhs._structure) { return false; } @@ -76,6 +82,8 @@ void _dbGDSARef::differences(dbDiff& diff, DIFF_FIELD(_origin); DIFF_FIELD(_lr); DIFF_FIELD(_ul); + DIFF_FIELD(_num_rows); + DIFF_FIELD(_num_columns); DIFF_FIELD(_structure); DIFF_END } @@ -86,6 +94,8 @@ void _dbGDSARef::out(dbDiff& diff, char side, const char* field) const DIFF_OUT_FIELD(_origin); DIFF_OUT_FIELD(_lr); DIFF_OUT_FIELD(_ul); + DIFF_OUT_FIELD(_num_rows); + DIFF_OUT_FIELD(_num_columns); DIFF_OUT_FIELD(_structure); DIFF_END @@ -93,6 +103,8 @@ void _dbGDSARef::out(dbDiff& diff, char side, const char* field) const _dbGDSARef::_dbGDSARef(_dbDatabase* db) { + _num_rows = 1; + _num_columns = 1; } _dbGDSARef::_dbGDSARef(_dbDatabase* db, const _dbGDSARef& r) @@ -100,6 +112,8 @@ _dbGDSARef::_dbGDSARef(_dbDatabase* db, const _dbGDSARef& r) _origin = r._origin; _lr = r._lr; _ul = r._ul; + _num_rows = r._num_rows; + _num_columns = r._num_columns; _structure = r._structure; } @@ -110,7 +124,8 @@ dbIStream& operator>>(dbIStream& stream, _dbGDSARef& obj) stream >> obj._ul; stream >> obj._propattr; stream >> obj._transform; - stream >> obj._colRow; + stream >> obj._num_rows; + stream >> obj._num_columns; stream >> obj._structure; return stream; } @@ -122,7 +137,8 @@ dbOStream& operator<<(dbOStream& stream, const _dbGDSARef& obj) stream << obj._ul; stream << obj._propattr; stream << obj._transform; - stream << obj._colRow; + stream << obj._num_rows; + stream << obj._num_columns; stream << obj._structure; return stream; } @@ -185,17 +201,30 @@ dbGDSSTrans dbGDSARef::getTransform() const return obj->_transform; } -void dbGDSARef::set_colRow(const std::pair& colRow) +void dbGDSARef::setNumRows(int16_t num_rows) +{ + _dbGDSARef* obj = (_dbGDSARef*) this; + + obj->_num_rows = num_rows; +} + +int16_t dbGDSARef::getNumRows() const +{ + _dbGDSARef* obj = (_dbGDSARef*) this; + return obj->_num_rows; +} + +void dbGDSARef::setNumColumns(int16_t num_columns) { _dbGDSARef* obj = (_dbGDSARef*) this; - obj->_colRow = colRow; + obj->_num_columns = num_columns; } -std::pair dbGDSARef::get_colRow() const +int16_t dbGDSARef::getNumColumns() const { _dbGDSARef* obj = (_dbGDSARef*) this; - return obj->_colRow; + return obj->_num_columns; } // User Code Begin dbGDSARefPublicMethods diff --git a/src/odb/src/db/dbGDSARef.h b/src/odb/src/db/dbGDSARef.h index 5258d8c719e..e97c132eb8d 100644 --- a/src/odb/src/db/dbGDSARef.h +++ b/src/odb/src/db/dbGDSARef.h @@ -70,7 +70,8 @@ class _dbGDSARef : public _dbObject Point _ul; std::vector> _propattr; dbGDSSTrans _transform; - std::pair _colRow; + int16_t _num_rows; + int16_t _num_columns; dbId<_dbGDSStructure> _structure; }; dbIStream& operator>>(dbIStream& stream, _dbGDSARef& obj); diff --git a/src/odb/src/gdsin/gdsin.cpp b/src/odb/src/gdsin/gdsin.cpp index eb612dcd5d1..0fc3b0a02d4 100644 --- a/src/odb/src/gdsin/gdsin.cpp +++ b/src/odb/src/gdsin/gdsin.cpp @@ -398,10 +398,9 @@ dbGDSARef* GDSReader::processARef(dbGDSStructure* structure) } if (_r.type == RecordType::COLROW) { - aref->set_colRow({_r.data16[0], _r.data16[1]}); + aref->setNumColumns(_r.data16[0]); + aref->setNumRows(_r.data16[1]); readRecord(); - } else { - aref->set_colRow({1, 1}); } std::vector points = processXY(); diff --git a/src/odb/src/gdsout/gdsout.cpp b/src/odb/src/gdsout/gdsout.cpp index 07ca6cab2b7..b354293e666 100644 --- a/src/odb/src/gdsout/gdsout.cpp +++ b/src/odb/src/gdsout/gdsout.cpp @@ -388,7 +388,6 @@ void GDSWriter::writeSRef(dbGDSSRef* sref) void GDSWriter::writeARef(dbGDSARef* aref) { record_t r; - auto colrow = aref->get_colRow(); r.type = RecordType::AREF; r.dataType = DataType::NO_DATA; writeRecord(r); @@ -403,11 +402,13 @@ void GDSWriter::writeARef(dbGDSARef* aref) writeSTrans(aref->getTransform()); } - if (colrow.first != 1 || colrow.second != 1) { + const int16_t cols = aref->getNumColumns(); + const int16_t rows = aref->getNumRows(); + if (cols != 1 || rows != 1) { record_t r4; r4.type = RecordType::COLROW; r4.dataType = DataType::INT_2; - r4.data16 = {colrow.first, colrow.second}; + r4.data16 = {cols, rows}; writeRecord(r4); }