Inheritance diagram for oaCollection:
Public Methods | |
oaCollection (const oaCollection< obj, container > &coll) | |
oaBoolean | includes (const obj *o) |
Collections are an effective way to work with one-to-many relationships. Collections allow the caller to traverse the contents of a collection, determine the collection size, and search the contents of the collection.
Note that constructing a collection is very quick, because the collection object simply signifies the collection. It does not gather the objects in the collection. Hence it is reasonable to construct a collection just to call isEmpty() on it.
All collections support common functions:
It is often faster to determine if a collection is empty than to determine the exact size of the collection. As a result, always use isEmpty() rather than getCount() == 0. getCount() is not constant time for all collections.
The most common way to use an oaCollection is to use it inline in the construction of an oaIter, never explicitly declaring the oaCollection. In the following example, view->getNets() returns an oaCollection.
oaIter<oaNet> nIter(view->getNets()); while (oaNet *net = nIter.getNext()) { ... }
|
This is the oaCollection copy constructor. It constructs a copy of the collection specified by coll. |
|
This function determines if the given object is a member of this collection. Note: This function is not guaranteed to be fast. For some collections, the database walks over all the members of the collection until this function either finds the object or tries all members of the collection. |
Copyright © 2002 - 2010 Cadence Design Systems, Inc.
All Rights Reserved.