next up previous contents
Next: C Bindings Up: C++ Bindings Previous: Implementing SIDL Classes in   Contents

Accessing SIDL Arrays From C++

Although it is feasible to expose the underlying C array API to create, destroy and access array elements and meta-data, the C++ bindings provide a SIDL::array<T> template mechanism that is more in keeping with C++ idioms.

For SIDL built-in types, template specializations of SIDL::array<T> are defined in SIDL_cxx.hh. For SIDL interface and classes, the array template is again specialized in the corresponding stub header. The reason for the extensive use of template specialization is an effort to hide the detail that the array implementation is really templated on three terms: the type of the C struct that represents the array internally, the internal representation of each item in the array, and the C++ representation of each item in the array. (See array_mixin in SIDL_cxx.hh for grungy implementation details.)

An example is given below.

users_guide/cxx/code/array_example.cc

Of course, the example above is only one way to create an array. The list of member functions for all C++ array classes is:

users_guide/cxx/code/array_example.hh

where


next up previous contents
Next: C Bindings Up: C++ Bindings Previous: Implementing SIDL Classes in   Contents


babel-0.8.0
users_guide Last Modified 2003-01-14

http://www.llnl.gov/CASC/components
components@llnl.gov