Prev Up Next
Go backward to IDL Complex Types
Go up to Overview of the IDL Data Types
Go forward to Arrays

Sequence

In IDL, you can declare a sequence of any IDL data type. An IDL sequence is similar to a one-dimensional array of elements, but it does not have a fixed length. If the sequence has a fixed maximum length, then the sequence is bounded. Otherwise, the sequence is unbounded. For example, the following code shows how to declare bounded and unbounded sequences as members of an IDL struct:


    module Finance { 
      interface Account { 
      ... 
      }; 

      struct LimitedAccounts { 
        string bankSortCode<10>; 
        // Maximum length of sequence is 50. 
        sequence<Account, 50> accounts; 
      }; 

      struct UnlimitedAccounts { 
        string bankSortCode<10>; 
        // No maximum length of sequence. 

      sequence<Account> accounts; 
      }; 
    }; 

A sequence must be named by an IDL typedef declaration (to be described) before it can be used as the type of an IDL attribute or operation parameter. The following code illustrates this:


    module Finance { 
      typedef sequence<string> CustomerSeq; 
      interface Bank { 
        void getCustomerList(out CustomerSeq names); 
        ... 
      }; 
    }; 

 

Prev Up Next