Functors

Functors are instantiations of the TDocumentFunctor class. They pass arguments from the context of a document surrogate to the original document, execute the procedure, and relay the results back to the calling client. The document functor is forwarded to the document whether it is remote or local. If the document instance is remote, the functor is streamed out and sent across to the remote document server process. (Refer to "Storing information" on page 10 for an explanation of streaming.)

An object that receives a functor does not have to "know" anything at all about what operation the functor performs in its Do member function. It simply executes the Do function.


Figure 2 shows how surrogates can mirror any subset of the interface (including the models) of a source document. Figure 2 also shows a surrogate capable of accessing two (A and B) of the source document's four member functions (A, B, C, D). The client has access to a document surrogate that references the source document.

In the example shown above, the client requests that one of the two member functions (function A) defined in the document surrogate be applied to one of the models (1) in the source document.

The functor passes this argument (the member function to be executed) from the context of the surrogate to the context of the source document. The functor executes the member function and then returns the result of the execution to the document surrogate.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker