ROOM » Core » C++ Classes » CellContent
CellContent Class
Reference for room::CellContent. More…
| Header: | #include "cellcontent.h" |
|---|---|
| CMake: | target_link_libraries(mytarget PRIVATE ROOM::room) |
Public Functions
| ViewType viewType() const | Returns the view kind of this content. |
| void setViewType(ViewType type) | Changes the stored view type label. |
| double dbuPerMicron() const | Layout: DBU per micron (from GDS UNITS). |
| void setDbuPerMicron(double value) | Sets layout physical scale. |
| double dbuPerEditorUnit() const | Schematic/symbol: DBU per 1.0 native editor unit. |
| void setDbuPerEditorUnit(double value) | Sets schematic coordinate scale (0 = infer on read). |
| std::vector<Property> & properties() | Returns view-level metadata for modification. |
| const std::vector<Property> & properties() const | Returns view-level metadata for read-only access. |
| Block & block() | In-memory topology (maps to payload.<view>.block on disk). |
| const Block & block() const | Read-only topology (same mapping as above). |
| SourceInfo & sourceInfo() | Original tool format/version metadata. |
| layers(), opaque payload accessors | Per-view layer table; skip-friendly unknown views. |
Detailed Description
One view of a Cell (layout, schematic, symbol, or abstract).
On disk (.room v1.0), view geometry is stored in payload — a ViewPayload union (schema/views.capnp). The active arm matches viewType (layout, schematic, …) and contains per-view layers[] plus a nested block (shapes, instances, nets).
In C++, use block() as the ergonomic accessor for that nested topology. SourceInfo records provenance from importers (Xschem, Qucs, GDS). Database::saveToFile() / loadFromFile() map between block() and payload.*.block. Tools that do not understand a view type can copy the opaque arm without decoding geometry.
Layer indices in shapes and terms refer to Lib::layers() at import time; the per-view layers[] inside payload is the serialized copy for that view.
Integer coordinates in block() are always stored in DBU. Layout views use dbuPerMicron for physical microns; schematic and symbol views use dbuPerEditorUnit to map to Qucs/Xschem file coordinates. See Coordinate scale.
Member Function Documentation
CellContent(ViewType viewType, double dbuPerMicron = 1000.0)
Constructs view data for one cell view with an empty topology block (in memory; serialized under payload).
| Parameter | Description |
|---|---|
viewType | Kind of view: Layout, Schematic, Symbol, or Abstract. |
dbuPerMicron | Coordinate resolution: database units per micron (default 1000, matching typical GDS imports). |
ViewType viewType() const
Returns the view kind of this content.
Returns: One of Layout, Schematic, Symbol, or Abstract.
void setViewType(ViewType type)
Changes the stored view type label.
| Parameter | Description |
|---|---|
type | New ViewType value. |
double dbuPerMicron() const
Returns DBU per micron for layout views (from GDS UNITS or constructor default).
Returns: Typically 1000 for GDS imports.
void setDbuPerMicron(double value)
Sets DBU per micron for layout views.
double dbuPerEditorUnit() const
Returns DBU per one native editor coordinate unit for schematic and symbol views. Qucs uses 1; Xschem uses 1000 for sub-grid precision. Value 0 means unset — readers infer from SourceInfo.
See also: Coordinate scale, utils/coord_scale.h.
void setDbuPerEditorUnit(double value)
Persists schematic/symbol coordinate scale to disk (CellContent.dbuPerEditorUnit in Cap'n Proto).
std::vector<Property> & properties()
Returns view-level metadata for modification.
Returns: Mutable reference to name/value properties on this view.
const std::vector<Property> & properties() const
Returns view-level metadata for read-only access.
Returns: Const reference to view properties.
Block & block()
Returns the topology container for modification.
Returns: Mutable reference to the in-memory Block (shapes, instances, nets). Persisted as payload.<view>.block.
const Block & block() const
Returns the topology container for read-only access.
Returns: Const reference to the block.
Example
room::Lib & lib = db.lib();
lib.layers().push_back({2, 0, "L2/D0", room::LayerPurpose::Drawing});
lib.layers().push_back({3, 0, "L3/D0", room::LayerPurpose::Label});
room::CellContent content(room::ViewType::Layout, 1000.0);
room::Block & block = content.block();
block.shapes().emplace_back(room::Shape::TextData{
{100, 100}, "TOPCELL", 1, 200});
block.recomputeBBox();