Getting Started

Writing IDL files

We will start from writing the idl file for each component.
   1. Create a directory named MyQuoter.
   2. In MyQuoter directory, create one directory for the basic idl; Stock_Base and for each component; Broker and Distributor. In MyQuoter/Stock_Base, place the idl file Stock_Base.idl that you could copy from this. This file defines the interfaces and events that will be used by both Stock Distributor and Stock Broker. We put together the common definitions so the generated base library can be shared by both components, thus reducing the size of "real" components.
   3. In MyQuoter/Distributor, place the idl file Distributor.idl that looks like this. This file defines the Stock Distributor component interfaces.
   4. In MyQuoter/Broker place the idl file for the stock broker; the Broker.idl that looks like this. This file defines the StockBroker component interface.

Importing IDL to PICML

   To quick start our Stock Quoter modeling process in GME, CoSMIC introduces idl_to_picml , which is an executable program that imports the IDL files you just created into modeling elements in PICML.
    1. Make sure %COSMIC_ROOT%\bin is included in the PATH variable.
    2. Open a command prompt, run VCVARS32.BAT from the MSVC .NET folder if you haven't done so. It will set the environment for using Microsoft Visual Studio .NET tools so that idl_to_picml works properly.
In my machine, VCVARS32.bat is in C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin
    3. Copy all three idl files, i.e. MyQuoter\Stock_Base\Stock_Base.idl MyQuoter\Broker\Broker.idl MyQuoter\Distributor\Distributor.idl  to the .\MyQuoter directory. And make sure you remove(or comment) the include declaration in Distributor.idl and Broker.idl, e.g., // #include "../Stock_Base/Stock_Base.idl. This step is important because idl_to_picml does not generate XML for included idls, so you have to parse the closure set of all included files into the command line.
    4. In the same command prompt, change directory to MyQuoter\, and type the following command:
      > idl_to_picml -x MyQuoter Stock_Base.idl Broker.idl Distributor.idl
   (if the above command does not work, you may also try this
   >idl_to_picml -x MyQuoter Stock_Base.idl Broker.idl Distributor.idl  -I %TAO_ROOT% -I %TAO_ROOT%\orbsvcs -I %CIAO_ROOT%\ciao)

        idl_to_picml will parse your IDL files and generated a MyQuoter.xme file in the MyQuoter directory. Note that if -x option is not used, the default xme file name will be PICML_default_xme_file.xme.
    5. Start GME, select File->Import xml.., and choose the xme file just generated. You should be able to see an imported PICML model similar to the one shown in Figure 2.



Figure 2
     In the Browser of the generated model, the PredefinedTypes folder contains a bunch of atomic datatype elements that will be referenced by other modeling parts later. You don't have to worry about them for now. The models in InterfaceDefinitions folder are the PICML representations ofthe IDL files you just imported. Double-click to open Broker, it will show you a white document-shaped entity which represents a <<FileRef>> instance and a yellow box-shaped entity representing a <<Package>> instance. Their equivalent representations in IDL files are "#include" and "module" respectively. Play around with them, and you will get familiar with PICML representation of IDL elements. Figure 3 gives you a clear view of GME representation of all the 3 idl files created.



Figure 3

Now we are ready to model the rest of the Stock Quoter systems by hand.


   

Ming Xiong
Last modified: