Inheritance diagram for oaLibDefList:
Public Methods | |
void | open () |
void | save () |
void | saveAs (const oaString &path) |
void | getPath (oaString &path) const |
void | getFullPath (oaString &path) const |
oaChar | getMode () const |
void | destroy () |
oaCollection< oaLibDefListMem, oaLibDefList > | getMembers () const |
Static Public Methods | |
void | openLibs () |
void | openLibs (const oaString &path) |
oaLibDefList * | getTopList () |
void | getDefaultPath (oaString &path) |
void | getDefaultFileName (oaString &libDefName) |
oaLibDefList * | create (const oaString &filePath) |
oaLibDefList * | get (const oaString &filePath, oaChar mode) |
oaLibDefList * | find (const oaString &filePath) |
oaCollection< oaLibDefList, oaLibDefList > | getLibDefLists () |
The oaLibDefList class provides functions for:
An oaLibDefList object is associated with one library definition files. For each session, there is a top-level oaLibDef object, and possibly one or more lower-level library definition objects that are referenced by an oaLibDefListRef member in the list. In the library definition file representation this hierarchy is represented by the INCLUDE statement in the library definition files.
By default, the top-level library definition file name and path are defined by the LibDef plug-in and can be obtained by the ILibDef::getDefaultFileName and ILibDef::getDefaultPath respectively. A specific file name can be specified to the oaLibDefList.
It is important for any application using oaLibDefList::open() or oaLibDefList::get() to declare an observer derived from oaObserver<oaLibDefList> so that it will be notified of ILibDef::open() errors through the oaLibDefList observer's onLoadWarnings function. Failures related to library definition file can be very hard to diagnose without the use of this observer. For a simple code example of the use of an oaLibDefList observer, see oaLibDefList Observer Example.
An oaLibDefList object contains an ordered collection of oaLibDefListMem objects This includes two types of objects derived from the oaLibDefListMem:
In effect, library definition files can be nested by including a reference to another list as a list member. Multiple levels of references result in a hierarchy of oaLibDefLists.
The order of the oaLibDefListMem objects in an oaLibDefList is meaningful, and it is used by oaLibDefList::openLibs to resolve conflicts among library definitions included in an oaLibDefList hierarchy.
To add new members to an oaLibDefList object, use oaLibDef::create() or oaLibDefListRef::create(). To remove members, use oaLibDefListMem::destroy().
Sample Usage
For a sample user routine that gets and iterates through all the oaLibDefListMems in an oaLibDefList, see oaLibDefList::getMembers.
For a sample routine that appends a new library definition to the library definition file associated with the session's oaLibDefList, see oaLibDefList::getTopList.
|
This function creates an new library definition file at the specified full path (including the filename). |
|
This function destroys this oaLibDefList object. No files are deleted from disk. |
|
This function finds the oaLibDefList object associated with the specified filePath. A NULL pointer is returned if the list is not found.
|
|
This function finds, or creates, the library definition list associated with an oaLibDefList object according to the specified filePath and mode. This function returns a pointer to the oaLibDefList, which can be a new oaLibDefList parsed from the library definition file or pre-existing one. If an existing list is not found, this function constructs a new list of the library definitions (oaLibDefs) and library definition file references (oaLibDefListRefs) found in the specified library definition file only. It does not traverse the library definition list hierarchy and add library definitions contained in other referenced files to the list. For a sample user routine that gets and iterates through all the oaLibDefListMems listed in and referenced by an oaLibDefList object, see oaLibDefList::getMembers. The filePath specifies a library definition file to be associated with the returned list object. The library definition list will be read in from the file in 'r'ead-only or 'a'ppend mode, or an empty list will be created in 'w'rite mode. The list can later be saved to the file (with an oaLibDefList::save) only if the preceding get() specified the 'a'ppend' or 'w'rite mode.
Example Suppose the library definition listed in the file specified by filePath has already been constructed through a previous oaLibDefList::openLibs(filePath) call. Then, calling oaLibDefList::get(filePath, 'r') or oaLibDefList::get(filePath, 'a') will only affect the mode of the existing list, while oaLibDefList::get(filePath, 'w') also will truncate the list.
|
|
This function returns the default name for a library definition file when none is specified. For example the native OpenAccess library definition file name is "libs.def".
|
|
This function returns the path for the default library definition file. This path is defined by the LibDef plug-in.
|
|
This function returns the full path to the file associated with this oaLibDefList object.
|
|
This function returns a collection of all the oaLibDefList objects in this session. |
|
This function returns a collection of the oaLibDefList members in this library definition file. Note that the oaLibDefList members are ordered, which means the order of the oaLibDefListMem objects returned from the iterator is meaningful and persistent. Below is a sample recursive routine that gets and iterates through all the oaLibDefListMems in an oaLibDefList passed to the routine. The purpose of the routine is to process all the library definitions found in the user's library definition file hierarchy at and below the level of the oaLibDefList passed to the routine.
walkLibDefList(oaLibDefList *list) { oaType memType; oaScalarName libName; oaString tempString; oaIter<oaLibDefListMem> listIter(list->getMembers()); while (oaLibDefListMem *listMem = listIter.getNext()) { switch (memType = listMem->getType()) { case oacLibDefType : ((oaLibDef *)(listMem))->getLibName(libName); libName.get(tempString); cout << "Got Lib Def: Logical Library Name = "<< tempString << endl; //process lib def ... break; case oacLibDefListRefType : ((oaLibDefListRef *)(listMem))->getRefListPath(tempString); oaLibDefList *nextList = oaLibDefList::get(tempString,'r'); walkLibDefList(nextList); break; } } } |
|
This function returns the mode of this oaLibDefList object, which can be one of 'r'ead, 'a'ppend, or 'w'rite (see oaLibDefList::get() for a description of each mode). |
|
This function returns the path to the file associated with this oaLibDefList object.
|
|
This function gets the current top oaLibDefList for this session. The current top oaLibDefList for this session is established by the top-level oaLibDefList used in the most recent successful oaLibDefList::openLibs() call. If the openLibs() function has not been called in this session, or if the last call of this function failed this function returns NULL. Below is a sample routine that gets the top list for an oaLibDefList, changes its mode to append, creates a new library definition (which adds the new library definition to the end of the oaLibDefList object), then saves the updated list to the file on disk associated with the list.
oaLibDefList::openLibs("myLibDefFile") oaString libraryPath("./DesignLib"); oaString library("DesignLib"); oaScalarName libraryName(oaNs,library); oaLibDefList *list = oaLibDefList::getTopList(); if (list) { oaString topListPath; list->getPath(topListPath); list->get(topListPath,'a'); oaLibDef *newLibDef = oaLibDef::create(list,libraryName,libraryPath); list->save(); } |
|
This function opens all the libraries in this library definition file. If a library with the same name as one in the list but with a different definition is already open, the opened library is closed and the new definition is used to open a new library. This function issues onPreOpenLibs and onPostOpenLibs observer notifications. Failure to open specific libraries in the list results in onLoadWarnings notifications. However, such failure to open a particular library does not abort the operation.
|
|
This function loads the library definition file specified by filePath. If a relative path is specified, it should be relative to the current working directory. If the file is not found or cannot be read, an oacLibDefListFileNotReadable error is thrown. If the library definition is found, this function reads the library definitions listed in the file and any definitions listed in other library definition files included in the file and creates new oaLibDefList and oaLibDefListMem objects. If reading the library definition file was successful, the function then sets the topList and opens all the libraries based on the listed definitions. If a library with the same name as one in the list but with a different definition is already open, the open library is closed and the new definition is used to open the library. No libraries are opened if the plug-in ILibDef::open() function reports an error in reading and parsing the library definition file(s). In this case, oaObserver<oaLibDefList>::onLoadWarnings() are triggered by the plug-in to notify the application of the errors encountered while reading the file. Note: It is important for any application using openLibs() to declare an observer derived from oaObserver<oaLibDefList> so that it can receive notification of errors through the oaLibDefList observer's onLoadWarnings function. Library-related failures can be very hard to diagnose without the use of this observer. For a simple code example of the use of an oaLibDefList observer, see oaLibDefList Observer Example.
|
|
This function searches for a default library definition file in the default library definition path as defined by the LibDef plug-in. If the file is not found or cannot be read, an oacLibDefListFileNotReadable error is thrown. If the library definition is found, this function reads the library definitions listed in the file and any definitions listed in other library definition files included in the file and creates new oaLibDefList and oaLibDefListMem objects. If reading the library definition file was successful, the function then sets the topList and opens all the libraries based on the listed definitions. If a library with the same name as one in the list but with a different definition is already open, the open library is closed and the new definition is used to open the library. No libraries are opened if the plug-in ILibDef::open() function reports an error in reading and parsing the library definition file(s). In this case, oaObserver<oaLibDefList>::onLoadWarnings() are triggered by the plug-in to notify the the application of the errors encountered while reading the file. Note: It is important for any application using openLibs() to declare an observer derived from oaObserver<oaLibDefList> so that it can receive notification of errors through the oaLibDefList observer's onLoadWarnings function. Library-related failures can be very hard to diagnose without the use of this observer. For a simple code example of the use of an oaLibDefList observer, see oaLibDefList Observer Example. |
|
This function saves this oaLibDefList object to the file associated with it. Note that this oaLibDefList object must be in a 'w'rite or 'a'ppend mode. This function issues onPreSave and onPostSave notifications to oaLibDefList observers.
|
|
This function saves this oaLibDefList object to the file specified by the path. Note that this oaLibDefList object must be in a 'w'rite or 'a'ppend mode. This function issues onPreSaveAs and onPostSaveAs notifications to oaLibDefList observers.
|
Copyright © 2002 - 2010 Cadence Design Systems, Inc.
All Rights Reserved.