[Next] [Up] [Previous]
Next: Remote Method Invocation Up: The Basic Programming Model Previous: The Basic Programming Model

Global Object Pointers

Global object pointers are implemented by a generic ObjectPtr class. Instances of ObjectPtr strictly follow the C++ type rules regarding ordinary pointers. If a pointer to type Derived is compatible to a pointer to type Base, then an instance of ObjectPtr<Derived> is also compatible to an instance of ObjectPtr<Base>.

class Base {...};
class Derived: public Base {...};
void foo(ObjectPtr<Base> p) {...}


ObjectPtr<Derived> dp = ...;
ObjectPtr<Base> bp(dp); // ok, constructor
bp = dp; // ok, assignment operator
dp = bp; // error
foo(dp); // ok, exact match
foo(bp); // ok, conversion constructor

Furthermore, local pointers are compatible to global pointers to a compatible type. The local pointer is then automatically expanded to a global pointer filling in the local node address. This makes it possible to export references to local objects into the global object space in accordance to C++ type rules. Any local object can therefore potentially be exported to the global space and from any space any other object is also potentially accessible.

Originally C++ inherited pointer arithmetic from C and for all practical purposes we considered it worthwhile to retain this concept for TACO, too. A ArrayPtr class adds pointer arithmetic and subscript operators to object pointers, such that indexed remote array access is possible. Thus, the ArrayPtr class resembles C/C++ style pointers in a distributed environment and can be applied for remote method invocation as well. Both the ObjectPtr class as well as the ArrayPtr class originated from the GlobalPtr class provided by the Multiple Threads Template Library (MTTL), that already exploited most of the basic concepts but did not support polymorphism very well.


[Next] [Up] [Previous]
Next: Remote Method Invocation Up: The Basic Programming Model Previous: The Basic Programming Model