APGen Documentation Previous Topic: APGen Developer's Guide Next Topic: APG Script Intrinsic Objects Parent Topic: APGen Developer's Guide    APGen Developer's Guide
APGen Object Model
See Also:

APGen has two object models: An internal object model, and an external object model.  The internal object model is used by APG scripts.  The external object model is used to programmatically execute APG scripts.

Internal Object Model

Figure 1 shows the objects available to APG script code:

Figure 1: Internal Object Model

As Figure 1 shows, six intrinsic objects are available to APG script code: APGen, Output, Script, Log, Util, and ObjectContext.  See APG Script Intrinsic Objects for detailed descriptions.

External Object Model

The APGen external object model is used to manipulate and execute APG scripts.  It is accessible by code external to the script. The external object model consists of two object classes: APGen and APGScript.

To programmatically execute an APG script, first create an APGen object:

Figure 2: APGen Object
 

The APGen object is used to execute and/or manipulate one or more APG scripts.  It includes two methods for executing APG scripts: Run() and RunArgs().

If you want more control over script execution, or if you want to run a script several times, then use APGen.OpenScript() to obtain an APGScript object.  Figure 3 shows a diagram of the APGScript object:

Figure 3: APGScript Object
 

As shown in figure 3, the APGScript object encapsulates an APG script.  The interface to the APGScript object is IAPGScript. 

Figure 3 also shows that the IAPGScript interface is connected to the intrinsic Script object.  The intrinsic Script object and the external APGScript interface both refer to the same object.  This is why they expose common properties and methods.

The two-sided nature of the Script/APGScript object provides a way to pass data in to and out of a script.  For example, data can be passed in using the APGScript.Values and/or APGScript.Arguments collections.  Within the script, the passed-in data can be are accessed using the Script.Values and Script.Arguments collections.