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.
| Type | Header | Implementation |
|---|---|---|
| Point | src/point.h | header only |
| Box | src/box.h | src/box.cpp |
| Transform | src/transform.h | header only |
| Property | src/property.h | header only |
| LayerSpec | src/layer_spec.h | header only |
| Enums | src/enums.h | src/enums.cpp (string helpers) |
| Umbrella | src/types.h | includes all headers above |
class Point class
src/point.h · #include "point.h" or #include "types.h"
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.
| Parameter | Description |
|---|---|
x_ | X coordinate. |
y_ | Y coordinate. |
class Box class
src/box.h · #include "box.h"
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.
| Parameter | Description |
|---|---|
llx, lly | Lower-left corner. |
urx, ury | Upper-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.
| Parameter | Description |
|---|---|
x | X coordinate in DBU. |
y | Y coordinate in DBU. |
void expand(const Box & other)
Grows this box to include the entire area of other. No-op if other is empty.
| Parameter | Description |
|---|---|
other | Bounding 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
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.
| Parameter | Description |
|---|---|
x_, y_ | Translation in DBU. |
o | Orient (default R0). |
m | Magnification factor (default 1.0). |
class Property class
src/property.h · Full class reference
Generic name/value metadata on libraries, cells, shapes, and instances.
Property(std::string n, std::string v)
Constructs a property pair.
| Parameter | Description |
|---|---|
n | Property name. |
v | Property value. |
class LayerSpec class
src/layer_spec.h
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.
| Parameter | Description |
|---|---|
ln | GDS layer number. |
dt | GDS datatype. |
n | Human-readable name (for example "MET1" or "L2/D0"). |
p | LayerPurpose (default Drawing). |
Enums and string helpers
src/enums.h · #include "enums.h" (after types.h for helper functions)
enum class Orient
| Value | Description |
|---|---|
R0, R90, R180, R270 | Rotation |
MY, MX, MX90, MY90 | Mirror and rotation |
enum class ViewType
| Value | String (viewTypeToString) |
|---|---|
Layout | layout |
Schematic | schematic |
Symbol | symbol |
Abstract | abstract |
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.
| Parameter | Description |
|---|---|
type | ViewType value. |
Returns: "layout", "schematic", "symbol", or "abstract".
std::string layerPurposeToString(LayerPurpose purpose)
Converts a layer purpose enum to a string.
| Parameter | Description |
|---|---|
purpose | LayerPurpose value. |
Returns: Lower-case string (for example "drawing").
std::string sigTypeToString(SigType type)
Converts a signal type enum to a string.
| Parameter | Description |
|---|---|
type | SigType 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()