Basic types

namespace ROOM · layout coordinates in DBU (schematic views may use 1 unit = 1 pixel)

Geometry and metadata types live in separate headers under src/. #include "types.h" is a convenience umbrella that pulls in all of them.

TypeHeaderImplementation
Pointsrc/point.hheader only
Boxsrc/box.hsrc/box.cpp
Transformsrc/transform.hheader only
Propertysrc/property.hheader only
LayerSpecsrc/layer_spec.hheader only
Enumssrc/enums.hsrc/enums.cpp (string helpers)
Umbrellasrc/types.hincludes all headers above

class Point class

src/point.h · #include "point.h" or #include "types.h"

class Point { std::int64_t x = 0; std::int64_t y = 0; Point(); Point(std::int64_t x_, std::int64_t y_); };

A point in 2D space. Public data members (POD-style).

Point()

Default constructor. Sets x and y to 0.

Point(std::int64_t x_, std::int64_t y_)

Constructs a point at the given coordinates.

ParameterDescription
x_X coordinate.
y_Y coordinate.

class Box class

src/box.h · #include "box.h"

class Box { std::int64_t llx, lly, urx, ury; Box(); Box(std::int64_t llx, std::int64_t lly, std::int64_t urx, std::int64_t ury); void expand(std::int64_t x, std::int64_t y); void expand(const Box & other); bool empty() const; };

Axis-aligned bounding box: lower-left (llx, lly) and upper-right (urx, ury).

Box()

Default constructor. All corners set to 0 (empty box).

Box(std::int64_t llx, std::int64_t lly, std::int64_t urx, std::int64_t ury)

Constructs a box from corner coordinates.

ParameterDescription
llx, llyLower-left corner.
urx, uryUpper-right corner.

void expand(std::int64_t x, std::int64_t y)

Grows the box to include the point (x, y). If the box was empty, it becomes a degenerate box at that point.

ParameterDescription
xX coordinate in DBU.
yY coordinate in DBU.

void expand(const Box & other)

Grows this box to include the entire area of other. No-op if other is empty.

ParameterDescription
otherBounding box to merge into this one.

bool empty() const

Checks whether the box has no valid area.

Returns: true when llx >= urx or lly >= ury.

class Transform class

src/transform.h · requires enums.h for Orient

class Transform { std::int64_t x, y; Orient orient = Orient::R0; double mag = 1.0; Transform(); Transform(std::int64_t x_, std::int64_t y_, Orient o = Orient::R0, double m = 1.0); };

Placement transform for Instance (offset, orientation, magnification).

Transform()

Default: origin, R0, magnification 1.0.

Transform(std::int64_t x_, std::int64_t y_, Orient o, double m)

Constructs a transform with explicit offset, orientation, and scale.

ParameterDescription
x_, y_Translation in DBU.
oOrient (default R0).
mMagnification factor (default 1.0).

class Property class

src/property.h · Full class reference

class Property { std::string name; std::string value; Property(); Property(std::string n, std::string v); };

Generic name/value metadata on libraries, cells, shapes, and instances.

Property(std::string n, std::string v)

Constructs a property pair.

ParameterDescription
nProperty name.
vProperty value.

class LayerSpec class

src/layer_spec.h

class LayerSpec { std::uint16_t layerNum, dataType; std::string name; LayerPurpose purpose = LayerPurpose::Drawing; LayerSpec(); LayerSpec(std::uint16_t ln, std::uint16_t dt, std::string n, LayerPurpose p = LayerPurpose::Drawing); };

GDS layer description. The index in Lib::layers() is used as layerId in shapes and terms.

LayerSpec(std::uint16_t ln, std::uint16_t dt, std::string n, LayerPurpose p)

Constructs a layer entry from GDS layer/datatype numbers and a display name.

ParameterDescription
lnGDS layer number.
dtGDS datatype.
nHuman-readable name (for example "MET1" or "L2/D0").
pLayerPurpose (default Drawing).

Enums and string helpers

src/enums.h · #include "enums.h" (after types.h for helper functions)

enum class Orient

ValueDescription
R0, R90, R180, R270Rotation
MY, MX, MX90, MY90Mirror and rotation

enum class ViewType

ValueString (viewTypeToString)
Layoutlayout
Schematicschematic
Symbolsymbol
Abstractabstract

Stored in CellContent::viewType().

enum class LayerPurpose

Drawing, Pin, Label, Boundary, Blockage, Wire, Fill, Other

enum class SigType

Signal, Power, Ground, Clock — used by Net.

Helper functions

Declared in enums.h (implementation in enums.cpp). Include enums.h after the type headers, or use types.h plus enums.h.

std::string viewTypeToString(ViewType type)

Converts a view type enum to its serialized string name.

ParameterDescription
typeViewType value.

Returns: "layout", "schematic", "symbol", or "abstract".

std::string layerPurposeToString(LayerPurpose purpose)

Converts a layer purpose enum to a string.

ParameterDescription
purposeLayerPurpose value.

Returns: Lower-case string (for example "drawing").

std::string sigTypeToString(SigType type)

Converts a signal type enum to a string.

ParameterDescription
typeSigType value.

Returns: Lower-case string (for example "power").

Example

#include "types.h"
#include "enums.h"

room::Point p{1000, 2000};

room::Box box{0, 0, 1000, 500};
box.expand(2000, 3000);

room::Transform xf{2000, 2000, room::Orient::R90, 1.0};

room::LayerSpec layer{2, 0, "MET1", room::LayerPurpose::Drawing};
// layerId 0 = first entry in Lib::layers()