ROOM » Utilities » C++ Classes » GdsImporter

GdsImporter Class

Reads a GDSII layout file into an in-memory Database. More…

Header:#include "gds_importer.h"
CMake:target_link_libraries(mytarget PRIVATE ROOM::room_utils)

Public Types

struct OptionsLibrary name and default DBU scale for import.

Public Functions

GdsImporter()Default constructor with default Options.
explicit GdsImporter(const Options & options)Constructs with custom import settings.
Database importFile(const std::string & gdsPath) constParses a GDSII file and returns a database.
const std::vector<std::string> & warnings() constNon-fatal messages from the last import.
const std::vector<std::string> & errors() constFatal error messages from the last import.

Detailed Description

Creates cells with ViewType::Layout, maps GDS layers to Lib::layers(), and attaches GDS user properties to shapes and instances. See also the gds_to_room walkthrough.

Member Type Documentation

struct Options

MemberDefaultDescription
std::string libName"gds_import"Name of the output Lib.
double defaultDbuPerMicron1000.0DBU per micron when the GDS file has no UNITS record.

Member Function Documentation

GdsImporter()

Default constructor. Creates an importer with default Options (libName = "gds_import", defaultDbuPerMicron = 1000.0).

explicit GdsImporter(const Options & options)

Constructs an importer with custom import settings.

ParameterDescription
optionsLibrary name and default DBU resolution used when the GDS file has no UNITS record.

Database importFile(const std::string & gdsPath) const

Parses a GDSII file and builds an in-memory database. Clears previous warning and error messages before parsing.

ParameterDescription
gdsPathPath to the input GDS or GDSII file to read.

Returns: A populated Database on success, or an empty database if parsing failed. Inspect errors() for failure details.

const std::vector<std::string> & warnings() const

Returns non-fatal messages from the most recent importFile() call.

Returns: Const reference to warning strings (for example unsupported records or recoverable issues).

const std::vector<std::string> & errors() const

Returns fatal error messages from the most recent importFile() call.

Returns: Const reference to error strings. Non-empty usually means import failed.

Supported GDS records

RecordResult
STRNAMECell
BOUNDARY, BOXShape::Polygon
PATHShape::Path
TEXTShape::Text
SREFInstance
UNITSdbuPerMicron

Private Variables

Private members are implementation details.

Options m_optionsImport settings.
mutable std::vector<std::string> m_warningsWarnings from last importFile().
mutable std::vector<std::string> m_errorsErrors from last importFile().

Example

room::GdsImporter::Options opts;
opts.libName = "demo_lib";
opts.defaultDbuPerMicron = 1000.0;

room::GdsImporter importer(opts);
room::Database db = importer.importFile("layout.gds");

for (const auto & w : importer.warnings())
    std::cerr << "warn: " << w << "\n";
for (const auto & e : importer.errors())
    std::cerr << "err: " << e << "\n";

db.saveToFile("layout.room");

See also the gds_to_room walkthrough.