Next Previous Up Top

4 europa Level 0: The Proxy Model

4.1 Proxy generation

4.1.1 - The EC_Reflect Class
4.1.2 - The EC_Proxy Class
4.1.3 - The EC_Call Class

4.1 Proxy generation

4.1.1 The EC_Reflect Class

The EC_Reflect class allows classes to be defined that will be instantiated with a meta-object (a proxy); such an object is called a reified object (Figure 4.1).

EC_Reflect derived classes allow the definition of both object and proxy together, within the same class structure. It permits the end-users to use the proxies in a transparent way, just by inheriting from library classes in the usual way.

All the public calls issued to a reified object through a pointer, will trigger the execution of the method EC_reify of the proxy with the appropriate object of type EC_Call as a parameter.

namespace EC
	class EC_Reflect
		void* operator new(size_t s, etc.);
		// Optional

		virtual EC_Proxy* ec_proxy();
		// Definition of the proxy object:
		// class being instantiated as the meta-object (proxy).
		// Return type to be overridden by derived classes with
		// specific proxy class
	} ;

However, public member functions that statically show an access to the member function ec_pro2y are not reified, but directly called on the proxy.

4.1.2 The EC_Proxy Class

The EC_Proxy class is the only part of a reified object being instantiated automatically when such an object is created; the proxy object is instantiated locally, while the reified object can be instantiated remotely. Users are expected to define the proxy classes they need, inheriting from the EC_Proxy base class.

namespace EC
	class EC_Proxy
		// To be derived by EUROPA users as proxy classes
		EC_Proxy (...Allocator params..., EC_Class cl, EC_Call* c)
			// Proxy constructor
			// Called with reified object allocator parameters,
			// id of class to be created, reification of constructor

		virtual void ec_reify (EC_Call* c) { // A call reification
		// Called upon calls issued to the reified object
	} ;

For all classes that directly or indirectly inherit from EC_Reflect, upon a dynamic allocation of one of the two forms (europa implementation dependent):

robj=new(...allocator params...) Derived_EC_Reflect(...constructor params...);


robj = ec_new ( (allocator params), Derived_EC_Reflect, (constructor params))

the following actions take place:

All the classes publicly inheriting from EC_Reflect present this behaviour.

Please note that there must be a conformance between the allocator parameters of a reified class, and the constructor of the proxy being used for it. On a typical use of europa presented Figure 4.2, the conformity that must hold is:

Const. params of Rem_Proxy = Alloc. params of Remote + EC_Class + EC_Call

4.1.3 The EC_Call Class

Upon each occurrence of a call on a reified object, e.g.


an object of type EC_Call will represent the call being made, and be a parameter of member ec_reify, in classes derived from EC_Reflect.

namespace EC
	class EC_Call
		EC_Any* eff(); // Constructs a list of effective parameters
		EC_Mb_Fct mb(); // member function to be called
		EC_Any res; // address to put the result
		void execute (EC_Any obj);
		// Execute the member with the current effective parameters,
		// on the object obj; puts the result in res member.
		// Overriding resolution (Dynamic Binding),
		// but no overloading resolution here.
		EC_Call* clone ();
		// Return a shallow copy of the object
	} ;

Such an object is dynamically allocated; its lifetime extends only up to the end of the ec_reify function. The clone member can be used to get a copy if needed.

Copyright 1997 EUROPA WG

Last updated: 26 Nov 1997