Next: Encapsulating SPMD Libraries. Up: Thread Environment Classes. Previous: Communication Between Threads.

Constructors for TEClass Objects. Ver. 2.0

The examples from the previous sections, used only one type of constructor for TEClass Objects: one that that had a single Processors object parameter. This constructor is automatically generated by the compiler. User defined constructors can be of any standard C++ form. THE COMPILER WILL MODIFY THESE SO THAT THE PROCESSORS PARAMETER IS ADDED AS THE LAST ARGUMENT. For example,


TEClass A{
  int n;
  float data[100];
  A(int size){
     n = size;
     for(int i = 0; i < size; i++) data[i] = 0.0;
     }
};

main(){
 Processors P;
 A vectors(64,P);
 A *x = new A(32, P);  // another valid constructor.
 A *local = new A(32);  // generates a local object. (not supported in v.1.0)
}

In this case the system binds the value 64 to the size argument in the users constructor and uses the value P to map the objects to processor threads.

If a TEClass object is built without the processor parameter, as in the third declaration above, a single representative object is created that is identical to a single instance underlying class. (Not supported in version 1.0).


beckman@cica.indiana.edu
Mon Nov 21 09:49:54 EST 1994