next up previous contents
Next: SIDL Bindings Up: FORTRAN 90 Bindings Previous: Accessing SIDL Arrays From   Contents

FORTRAN 90 objects with state

If you need to implement a FORTRAN 90 class with state, you can use SIDL arrays to store the state information. This is certainly not the only way to implement a FORTRAN 90 class with state, but it's one that will work wherever BABEL works. For example, if you have a class whose state requires three boolean variables and two double precision variables, your constructor might look something like the following:

users_guide/f90/code/f90_state_ctor.F90

Of course, it is up to your application to make the association between elements of the arrays and particular state variables. For example, you could say that element 0 of the double array is the kinematic viscosity and element 1 could be the airspeed velocity of an unladden swallow. Element 0 of the boolean array could specify African (true) or European (false). The destructor for this class could look something like this:

users_guide/f90/code/f90_state_dtor.F90

In this example, an accessor function for the airspeed velocity of an unladden swallow could be implemented as follows:

users_guide/f90/code/swallow.F90


next up previous contents
Next: SIDL Bindings Up: FORTRAN 90 Bindings Previous: Accessing SIDL Arrays From   Contents


babel-0.8.0
users_guide Last Modified 2003-01-14

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