正在加载图片...
4.如果需要,将结果以同样的方式返回。 1.2.2 DL(nterface Definition Language) IDL,接口定义语言,是 CORBA体系中的另一个重要概念。如果说ORB使 CORBA 做到平台无关,那么IDL,则使 CORBA做到语言无关。 正像其名字中显示的那样,IDL仅仅定义接口,而不定义实现,类似于C中的头文件 实际上它不是真正的编程语言。要用它编写应用,需要将它映射它相应的程序设计语言上去 如映射到C++或JAVA上去。映射后的代码叫 Client stub code和 Server skeleton code c IDL的好处是使高层设计人员不必考虑实现细节而只需关心功能描述。IDL可以说是描 述性语言。设计IDL的过程也是设计对象模型的过程。它是编写 CORBA应用的第一步 在整个软件设计过程中至关重要 IDL的语法很像C++,当然也像Java。很难想像一个程序设计人员是不懂C或Java的, 所以,几乎所有的程序设计人员都能迅速理解IDL。而这正是IDL设计者所希望的 下面是一个IDL定义的简单例子 // grid. ic // idl definition of a 2-d grid module simpleDemof interface grid I readon ly attr ibute short he ight; / he i ght of the grid readonly attr ibute short width: / width of the gr id // IDL operat ions // set the element [row, col] of the grid, to value void set (in short row, in short col, in long value) // return element [row, col] of the grid long get (in short row, in short col) This iDL def ines an interf ace for a gr id CoRBa object that maintains a grid or 2-D array of data values, which a client can access or modify remotely Module类似于Java中包( Package)的概念,实际上 module simpleDemo映射到JAVA 正是 package simpleDemo而 Interface类似于C++中的类(clas声明,或是Java中的 Interface 定义 附录中列出了IDL的全部语法。 1.2.3 Stub Code # FH Skeleton Code Stub code和 Skeleton Code是由 IDL Complier自动生成的,前者放在客户方,后者放3 4.如果需要,将结果以同样的方式返回。 1.2.2 IDL(Interface Definition Language) IDL,接口定义语言,是 CORBA 体系中的另一个重要概念。如果说 ORB 使 CORBA 做到平台无关,那么 IDL, 则使 CORBA 做到语言无关。 正像其名字中显示的那样,IDL 仅仅定义接口,而不定义实现,类似于 C 中的头文件。 实际上它不是真正的编程语言。要用它编写应用,需要将它映射它相应的程序设计语言上去, 如映射到 C++或 JAVA 上去。映射后的代码叫 Client Stub Code 和 Server Skeleton Code。 IDL 的好处是使高层设计人员不必考虑实现细节而只需关心功能描述。IDL 可以说是描 述性语言。设计 IDL 的过程也是设计对象模型的过程。它是编写 CORBA 应用的第一步, 在整个软件设计过程中至关重要。 IDL 的语法很像 C++,当然也像 Java。很难想像一个程序设计人员是不懂 C 或 Java 的, 所以,几乎所有的程序设计人员都能迅速理解 IDL。而这正是 IDL 设计者所希望的。 下面是一个 IDL 定义的简单例子: // grid.idl // IDL definition of a 2-D grid: module simpleDemo{ interface grid { readonly attribute short height; // height of the grid readonly attribute short width; // width of the grid // IDL operations // set the element [row,col] of the grid, to value: void set(in short row, in short col, in long value); // return element [row,col] of the grid: long get(in short row, in short col); }; }; This IDL defines an interface for a grid CORBA object that maintains a grid or 2-D array of data values, which a client can access or modify remotely. Module 类似于 Java 中包(Package)的概念,实际上 module simpleDemo 映射到 JAVA 正是package simpleDemo。而Interface类似于C++中的类(classs)声明,或是Java中的Interface 定义。 附录中列出了 IDL 的全部语法。 1.2.3 Stub Code 和 Skeleton Code Stub code 和 Skeleton Code 是由 IDL Complier 自动生成的,前者放在客户方,后者放
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有