ROOM » Core » C++ Classes » Cell

Cell Class

Reference for room::Cell. More…

Header:#include "cell.h"
CMake:target_link_libraries(mytarget PRIVATE ROOM::room)

Public Functions

explicit Cell(std::string name)Constructs a cell with the given name and no view data yet.
const std::string & name() constReturns the cell name.
std::vector<Property> & properties()Returns cell-level metadata for modification.
const std::vector<Property> & properties() constReturns cell-level metadata for read-only access.
std::vector<CellContent> & contents()Returns all view data attached to this cell for modification.
const std::vector<CellContent> & contents() constReturns all view data for read-only access.
CellContent * findContent(ViewType type)Looks up view data for a specific view type.
const CellContent * findContent(ViewType type) constLooks up view data for a specific view type (const overload).

Detailed Description

Member Function Documentation

explicit Cell(std::string name)

Constructs a cell with the given name and no view data yet.

ParameterDescription
nameCell name (for example "TOP" or "NAND2"). Must be unique within the parent Lib.

const std::string & name() const

Returns the cell name.

Returns: The name assigned at construction or read from a file.

std::vector<Property> & properties()

Returns cell-level metadata for modification.

Returns: Mutable reference to Property pairs on this cell.

const std::vector<Property> & properties() const

Returns cell-level metadata for read-only access.

Returns: Const reference to cell properties.

std::vector<CellContent> & contents()

Returns all view data attached to this cell for modification.

Returns: Mutable reference to CellContent entries (layout, schematic, symbol, abstract).

const std::vector<CellContent> & contents() const

Returns all view data for read-only access.

Returns: Const reference to the contents vector.

CellContent * findContent(ViewType type)

Looks up view data for a specific view type.

ParameterDescription
typeViewType to search for (Layout, Schematic, Symbol, or Abstract).

Returns: Pointer to the matching content, or nullptr if that view has not been created.

const CellContent * findContent(ViewType type) const

Looks up view data for a specific view type (const overload).

ParameterDescription
typeViewType to search for.

Returns: Const pointer to the matching content, or nullptr if missing.

CellContent & getOrCreateContent(ViewType type, double dbuPerMicron = 1000.0)

Returns existing view data or creates a new CellContent entry.

ParameterDescription
typeView type for the content to retrieve or create.
dbuPerMicronDatabase units per micron. Used only when a new content entry is created; ignored if content for type already exists.

Returns: Reference to the existing or newly created content.

Example

room::Cell cell("NAND2");

room::Lib & lib = db.lib();
lib.layers().push_back({1, 0, "MET1", room::LayerPurpose::Drawing});

// layout view
room::CellContent & lay = cell.getOrCreateContent(room::ViewType::Layout, 1000.0);
lay.block().shapes().emplace_back(room::Shape::PolygonData{
    {{{0,0}, {100,0}, {100,50}}}, 0});

// schematic view (empty for now)
cell.getOrCreateContent(room::ViewType::Schematic);

if (cell.findContent(room::ViewType::Symbol) == nullptr) {
    // symbol view not created yet
}