ROOM » Core » C++ Classes » Block
Block Class
Topology container: geometry, child cell placements, and nets (for schematic views). More…
| Header: | #include "block.h" |
|---|---|
| CMake: | target_link_libraries(mytarget PRIVATE ROOM::room) |
Public Functions
| std::vector<Shape> & shapes() | Returns geometric shapes in this block for modification. |
| const std::vector<Shape> & shapes() const | Returns geometric shapes for read-only access. |
| std::vector<Instance> & instances() | Returns child cell placements for modification. |
| const std::vector<Instance> & instances() const | Returns child cell placements for read-only access. |
| std::vector<Net> & nets() | Returns electrical nets for modification (typically used in schematic views). |
| const std::vector<Net> & nets() const | Returns electrical nets for read-only access. |
| const Box & bbox() const | Returns the cached axis-aligned bounding box of this block. |
| void recomputeBBox() | Recalculates the bounding box from all shapes in this block. |
Detailed Description
A room::Block holds shapes, child Instance placements, and schematic Net / Term connectivity for one cell view.
In a .room file (v1.0), blocks are not stored directly on CellContent. They live inside CellContent.payload — for example payload.layout.block or payload.schematic.block (schema/views.capnp). In C++, use CellContent::block() on the parent view; serialization maps between the in-memory block and the payload arm selected by viewType.
Member Function Documentation
std::vector<Shape> & shapes()
Returns geometric shapes in this block for modification.
Returns: Mutable reference to the Shape vector (rectangles, polygons, paths, text).
const std::vector<Shape> & shapes() const
Returns geometric shapes for read-only access.
Returns: Const reference to the shape vector.
std::vector<Instance> & instances()
Returns child cell placements for modification.
Returns: Mutable reference to Instance entries (GDS SREF equivalents).
const std::vector<Instance> & instances() const
Returns child cell placements for read-only access.
Returns: Const reference to the instance vector.
std::vector<Net> & nets()
Returns electrical nets for modification (typically used in schematic views).
Returns: Mutable reference to Net objects.
const std::vector<Net> & nets() const
Returns electrical nets for read-only access.
Returns: Const reference to the net vector.
const Box & bbox() const
Returns the cached axis-aligned bounding box of this block.
Returns: Bounding box in DBU. Call recomputeBBox() after changing shapes to refresh the value.
void recomputeBBox()
Recalculates the bounding box from all shapes in this block.
Instance placements are not included in the bbox calculation. The result is stored internally and returned by bbox().
Example
room::Block block;
block.shapes().emplace_back(room::Shape::RectData{{0, 0, 500, 300}, 0});
block.instances().emplace_back("INV", room::Transform{2000, 2000, room::Orient::R0});
block.nets().emplace_back("VDD", room::SigType::Power);
block.recomputeBBox();
std::cout << block.bbox().urx << "\n";