Glade Reference


dbObj class

The dbObj class is the base class of Glade database objects (it is derived from a lower level memory allocation class which caches objects, but the user need not be concerned about that). A dbObj is never created directly. Most access to dbObjs is at the derived class level.

 

db_Type type = d.objType()

Get the type of the object.

 

char * name = d.objName()

Get the print name of the object, e.g. "POLYGON".

 

bool val = d.isInst()

Returns True if the object is an inst or an array.

 

bool val = d.isShape()

Returns True if the object is a shape.

 

bool val = d.isViaInst()

Returns True if the object is a viaInst.

 

bool val = d.isSeg()

Retuens True is the object is a segment of some shape.

 

bool val = d.isVertex()

Returns True if the object is a vertex of some shape.

 

d.dbAddProp(char *propName, char *propVal)

d.dbAddProp(char *propName, int propVal)

d.dbAddProp(char *propName, double propVal)

d.dbAddProp(char *propName, bool propVal)

d.dbAddProp(char *propName, db_Orient propVal)

Add a property to a dbObject of the given type. If the property given by propName already exists, its value is updated to propVal .

 

d.dbReplaceProp(char *propName, char *propVal)

d.dbReplaceProp(char *propName, int propVal)

d.dbReplaceProp(char *propName, double propVal)

d.dbReplaceProp(char *propName, bool propVal)

d.dbReplaceProp(char *propName, db_Orient propVal)

Replace an existing property with one with a new value of a given type.

 

char * prop = d.dbGetStringProp(char *name)

int prop = d.dbGetIntProp(char *name)

double prop = d.dbGetFloatProp(char *name)

int prop = d.dbGetBoolProp(char *name)

db_Orient = d.dbGetOrientProp(char *name)

Get a property of a specified type by name.

 

int b = d.dbDeleteProp(char *name)

Delete a property by name.

 

Casting a dbObj to a derived class

In Python, there is no means of casting a base class to a derived class. So for example if you use the cellView::dbGetOverlaps() function to get a list of objects, these are returned as dbObj class. So to facilitate conversion, there are a set of global functions that convert a dbObj to a derived class e.g. rectangle.

arc *toArc()

array *toArray()

cell *toCell()

cellView *toCellView()

ellipse *toEllipse()

HSeg *toHSeg()

inst *toInst()

label *toLabel()

line *toLine()

path *toPath()

polygon *toPolygon()

rectangle *toRectangle()

segment *toSegment()

shape *toShape()

square *toSquare()

view *toView()

vertex *toVertex()

viaInst *toViaInst()

VSeg *toVSeg()

 

Getting bounding box coords

Note that these will only work to get the bounding box coordinates of shapes or instances.

int x = r.left();

int y = r.bottom();

int x = r.right();

int y = r.top();

Gets the specified bounding box coordinate.

 

Contents|Index

Copyright © Peardrop Design 2016.