oaAppDefs are Session Objects


OpenAccess 2.2 includes several enhancements to oaAppDefs:

In addition, the new oaAppDefs can be twice as fast as the 2.0 oaAppDefs.

oaAppDef Classes Renamed for Consistency

The oaAppDef classes have been renamed to be more consistent with oaProp and oaConstraint class names and to allow the string “AppDef” to appear in the name, for example:

oaAppDefs as Session Objects

In previous versions of OpenAccess, oaAppDefs were utility objects. Multiple oaAppDefs with the same name could refer to the same data.

In OpenAccess 2.2, oaAppDefs are managed oaSessionObjects. You can find or create oaAppDefs with the appropriate get() method. oaAppDefs should be declared before loading any oaDesigns, and the names for oaAppDefs must be unique.

If an oaDesign is loaded with an oaAppDef that has the same name and type as an existing oaAppDef, but the signatures of the two oaAppDefs do not match, the oaDesign’s oaAppDef data is discarded.

Examples

oaIntAppDef<oaModInst> *ival = oaIntAppDef<oaModInst>::get("ival", 7, true);

oaUInt4 value = ival->get(inst);

Default Values

The default value of an oaAppDef can be specified by the application. The default value is part of the signature of the oaAppDef. Different signatures imply different oaAppDefs, even if the names are identical.

The following oaAppDefs are different because they differ in default value. Their use would be considered a programming error.

oaIntAppDef<oaModInst> *val = oaIntAppDef<oaModInst>::get("value", 0, true); 
oaIntAppDef<oaModInst> *val = oaIntAppDef<oaModInst>::get("value", 1, true);

Using oaAppDefs

Using 2.2 oaAppDefs requires more planning than in previous release of OpenAccess. Components that share oaAppDefs must agree on type, name, default value, and persistence.

Do not query the database to determine the characteristics of oaAppDefs. This is to avoid inadvertently creating multiple appDefs with the same name but with different signatures in separate applications. The database will not warn you if this occurs and it can result in the destruction of existing appDef data.

 

Return to top of page

Return to What's New topics