Title: CORBA IDL version 2.3.1
1CORBA IDLversion 2.3.1
2What is IDL?
- The Interface Definition Language
- Used to specify the capabilities of distributed
objects (CORBA interfaces) - map to different programming languages for
implementation, eg - C
- Java
- COBOL
- Smalltalk
- etc
3Interface Example
interface Account attribute double
Balance void Deposit(in double amount)
4What's in an interface?
- type declarations
- constant declarations
- exception declarations
- attribute declarations
- operation declarations
- nothing (sometimesmore later in course)
5Types
- Basic
- Template
- Complex Declarators
- Constructed
6Basic Types
- Integer
- Floating Point
- Char
- Other
7Integer Types
- short (16 bits)
- unsigned short
- long (32 bits)
- unsigned long
- long long (64 bits)
- unsigned long long
- NOT int!
8Float Types
9Char Types
- char (8 bit)
- wchar
- encodes wide characters from any character set
- but size is implementation dependent
10Other Types
- boolean
- octet
- 8 bit quantity
- not converted when passed over the wire
- any
- represents any IDL type
- allows for dynamic typing
11Template Types
- string
- wstring
- string of wchar instead of just char
- fixed
- typedef fixedlt5,2gt numb
- const numb FNumber 0123.450d
12Template Types cont.
- sequence
- one-dimensional
- variable sized
- bounded or unbounded
- typedef sequenceltAccount,10gt AccountList
- typedef sequenceltTransactiongt TransactionHistory
13Complex Declarators
- Array
- can be multi-dimensional
- fixed sized
- typedef Account AccountList10
- typedef short Matrix1010
14Constructed Types
- Enumerated Type
- Structure
- Union
15Enumerated Type
enum CustomerType INDIVIDUAL, BUSINESS,
OTHER
16Structure
union CustomerInfo... typedef sequenceltAccountgt
AccountList struct CustomerRecord
CustomerInfo info AccountList accounts
17Union
union CustomerInfo switch(CustomerType) case
INDIVIDUAL struct indiv_s string
surname string first_name
indiv_info case BUSINESS struct
business_s long ABN string
business_name business_info default
string name
18Constants and Literals
19Constants and Literals
20Literals
21Operator Precedence
22Operations
interface Account // ... oneway void
deposit(in double amount) void
withdrawal(inout double amount) double
getBalance() void getCustomerRecord(out
CustomerRecord cr)
23User Exceptions
exception InsufficientFund exception
NotPermitted string reason interface
Account // ... void withdrawal(inout double
amount) raises(InsufficientFund,
NotPermitted) // ...
24System Exceptions
enum completion_status COMPLETED_YES,
COMPLETED_NO, COMPLETED_MAYBE define
SYSEX(NAME) exception NAME \
unsigned long minor \
completion_status completed\ SYSEX(BA
D_PARAM) SYSEX(NO_PERMISSION) .... IDL
defines 29 system exceptions.
25Inheritance
interface Account void deposit(in double
amount) void withdrawal(inout double
amount) raises(EInsufficientFund,
ENotPermitted) // ... interface
TermDepositAccount Account long
withdrawal() long getExpiryDate()
26Names and Scopes
- Modules
- Interfaces
- Structures
- Unions
- Exceptions
- Operation Definitions
27Names and Scopes
module Bank interface Bank ...
//error interface TermDepositAccount Account
... interface Customer struct
CustomerInfo ... CustomerInfo getInfo(in
AcCount acc) interface cuStomer ...
//error module ATM boolean
verifyPIN( in BankCustomerCustomerInfo
ci, in string pin)
28Passing Objects By Value
- valuetype
- Different from
- interface reference to remote object
- struct no operations nor inheritance
29Value Type
enum CustomerType ... union CustomerInfo
switch (CustomerType) ... typedef
sequenceltAccountgt AccountList valuetype
CustomerRecord private CustomerInfo
info public AccountList accounts readonly
attribute string ReportName readonly attribute
string SearchName Account MergeAccounts(in
AccountList accts)
30Abstract Value Type
typedef sequenceltAccountgt AccountList abstract
valuetype CustomerRecord readonly attribute
string ReportName readonly attribute string
SearchName Account MergeAccounts(in AccountList
accts)
31Single Inheritance
typedef sequenceltAccountgt AccountList valuetype
IndividualRecord CustomerRecord private
string surname private string first_name
32Preprocessing
- Based on ANSI C preprocessing
- include source file inclusion
- define macro substitution
- ifdef, endif conditional compilation
- pragma used to include RepositoryIds, and for
non-critical implementation-dependent directives
33Features Omitted
- Native Types
- DynAny type
- Abstract Interfaces
- Boxed Value Types
- Context parameter of Operations
34Further Information
- Object Management Group. 1999. The Common Object
Request Broker Architecture and Specification.
Revision 2.3.1., Chapter 3 ftp//www.omg.org/pub/d
ocs/formal/99-10-07.pdf - Henning, M., and S. Vinoski. 1999. Advanced CORBA
Programming with C. Addison-Wesley. - Jon Siegel. 2000. CORBA 3 Fundamentals and
Programming, 2nd Edition. OMG Press, John Wiley
Sons.