A namespace refers to a set of rules for creating and interpreting legal names within an application. The OpenAccess database supports a number of commonly used namespaces, including VHDL, Verilog, CDBA, LEF, DEF, SPEF, SPF, UNIX, and Windows, as well as the oaNative OpenAccess namespace (the internal format for oaName objects).
Deriving a namespace to integrate your proprietary language with the OpenAccess database and other tools simplifies exporting your data to other systems.
This section includes the following topics:
Name spaces are derived from the abstract base class oaNameSpace. The oaNameSpace class defines the minimum amount of information you need to provide to the OpenAccess database in order to implement a namespace. Defining the required minimum input and output allows the OpenAccess database to interpret your data even though the database did not write the code.
When deriving a namespace, you must determine how to translate the names from the original language to the oaNative format, and vice versa. Because namespaces always know that any name they receive from the OpenAccess database is in the oaNative format, the namespaces really need to know only how to translate from oaNative to their language, and from their language to oaNative. Once that is implemented, names can then be translated into the correct format for any other derived namespace.
When creating a namespace, be sure to document what the namespace supports, what special characters are used, what keywords are required, any sequencing issues, and if there are any restrictions on characters used to begin or end the name.
The oaName object is used in conjunction with oaNameSpace to perform name mapping. oaName has the capability to represent scalar names, vectorBit names, vector names, and bundle names. The minimum name object you must support when creating a namespace is scalar names, which includes the minimal set of library names and cell names. Generally, about half of all names are scalar names, and slightly less than half are vector or vectorBit names.
Names are memory intensive as well as algorithmically intensive. When implementing a derived namespace, you must use a one-to-one name mapping algorithm. For example:
Additional information can be found in The Name Mapping Algorithm within the Name Mapping section of this Programmers Guide.
For specific examples of different name types, refer to the Examples of Name Mapping table within the Name Mapping section. These examples can help you understand fundamentally how your names map to oaNative and how oaNative maps to your names.
It is also helpful to study the namespaces that are already defined as OpenAccess classes for suggestions on implementing your own namespace. For example:
When implementing your derived namespace, mapping it to the oaNative format typically includes the following processes.
For information on how case sensitivity is handled, see
Understanding Case Sensitivity in the Name
Mapping section of this Programmers Guide.
Mapping from the oaNative namespace to your derived namespace typically includes the following processes.
For information on how case sensitivity is handled, see
Understanding Case Sensitivity in the Name
Mapping section of this Programmers Guide.
When converting from a derived namespace to the oaNative namespace, you must implement the following virtual functions from the abstract base class oaNameSpace. In addition to these functions, you must also implement the isEqual functions.
void getInternalMember(const oaChar *in, oaString &out, oaBoolean &caseSensitive, oaUInt4 len, oaUInt4 flags = 0) const = 0;
This function returns the input string, including the case sensitivity setting, mapped into the oaNative namespace. The specified number of characters of the input string are evaluated; the default is to evaluate the entire string. The data is returned in the string out. Flags has no valid values other than zero.
void getInternalScalar(const oaChar *in, oaScalarName &out) const = 0;
This function returns the input string mapped into the oaNative namespace. The data is returned in the string out.
When converting from the oaNative namespace to your derived namespace, youmust implement the following virtual functions from the abstract base classoaNameSpace. In addition to these functions, you must also implement the isEqual functions.
void get(const oaByte *data, oaString &out, oaUInt4 &loc) const = 0;
This function returns the input block data mapped into this namespace. The data is returned in the string out, beginning at the location loc.
The format for the data byte array is as follows:
If the name is a Simple Name: |
|
|
|
|
|
|
|
If the name is a Bundle Name: |
|
|
The oaCdbaNS namespace is an example of a namespace that represents all of the different kinds of names. Since the code for reading the byte array doesn't change from namespace to namespace, studying this namespace can give you a better understanding of how to read the data byte array.
The readUInt4() and readStr() methods in oaNameSpace are available to make it easy to process the array.
oaNameType getType(const oaChar *in) const = 0;
This function returns the type of name represented by the specified string in this namespace: scalar, vector bit, vector, or bundle. This function does not indicate if the name is valid.
void getMember(const oaChar *in, oaBoolean caseSensitive, oaString &out, oaUInt4 &loc, oaUInt4 flags = 0) const = 0;
This function returns the input name member, with the specified case sensitivity value, mapped into this namespace. It is assumed that the input name is in the oaNative namespace format. The data is returned in the string out, at the location loc. Flags has no valid values other than zero.
void getScalarName(const oaScalarName &in, oaString &out, oaUInt4 &loc) const = 0;
This function returns the input scalar name mapped into this namespace. It is assumed the input name is in the oaNative namespace format. The data is returned in the string out, at the location loc.
The following functions return a boolean value that indicates if two specified names match. Matching also includes case sensitivity for each member. You must implement all of the isEqual functions in your derived namespace. In general, if a name type is not supported in your namespace, the equivalent functions should throw the appropriate exception (for example, if vector names are not supported, throw the exception oacVectorNameInvalid).
oaBoolean isEqual(const oaNameMem &n1, const oaNameMem &n2) const = 0;
This function returns a boolean value that indicates if the two specified name members are equal in this namespace.
oaBoolean isEqual(const oaScalarName &n1, const oaScalarName &n2) const = 0;
This function returns a boolean value that indicates if the two specified scalar names are equal in this namespace.
oaBoolean isEqual(const oaVectorName &n1, const oaVectorName &n2) const = 0;
This function returns a boolean value that indicates if the two specified vector names are equal in this namespace.
oaBoolean isEqual(const oaVectorBitName &n1, const oaVectorBitName &n2) const = 0;
This function returns a boolean value that indicates if the two specified vector bit names are equal in this namespace.
oaBoolean isEqual(const oaBundleName &n1, const oaBundleName &n2) const = 0;
This function returns a boolean value that indicates if the two specified bundle names are equal in this namespace.
oaBoolean isEqual(const oaSimpleName &n1, const oaSimpleName &n2) const = 0;
This function returns a boolean value that indicates if the two specified simple names are equal in this namespace.
oaBoolean isEqual(const oaName &n1, const oaName &n2) const = 0;
This function returns a boolean value that indicates if the two specified names are equal in this namespace.
Return to Programmers Guide topics
Copyright © 2001-2010 Cadence Design Systems, Inc.
All rights reserved.