Boost logo

Boost :

Subject: Re: [boost] Interest in Remote Procedure Call Library?
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2010-02-08 18:28:31


On Mon, Feb 8, 2010 at 7:25 AM, Rutger ter Borg <rutger_at_[hidden]> wrote:
> OvermindDL1 wrote:
>
>> class myClass
>> {
>>     public:
>>     void _myMemberFunc(int i, float f);
>>     static RPCHandler::type_of_callback<myClass::_myMemberFunc>::type
>> myMemberFunc;
>> }
>>
>
> Hello,
>
> do you defer the completion of the full signature of the member function
> until it's called, or do you acquire it through some other trickery?

I do defer it until it is called (Boost.Bind'ish), fusion ensures that
everything matches (with 'near'-perfect forwarding to boot).

Basically, if you call the functor that is returned from register,
fusion packages up all the arguments into a fusion vector.
Then if it needs to take the path that requires it to be called
directly it is then passed to fusion's invoke and it is called
directly (this call path, even if not taken, still insures that the
type signature matches before it is ever serialized to be sent out, a
compile-time type check).
And/Or if it needs to take the path where it is packaged up it is then
sent to a recursive static struct::apply function (of the fusion
design) where each recursive call operates on the first parameter that
was passed into the function, then the next, then the next, etc...
until they are all consumed, and the fallback apply function is then
called which takes the completed packaged up data (this apply struct
is what you can customize to use your own serialization technique or
change to use a different form of communication) and either transmits
it on a network, passes it to the scripting engine, whatever, along
with the earlier registered ID name.
If it receives a remote request to run it locally, say from ASIO, then
it passes the data chunk and/or stream to it, it looks up in an
unordered_map the ID and gets a boost::function that it calls with the
data chunk and/or stream and calls that.
That boost::function is originally created at the time of the register
call (and is also contained in the struct that is returned from the
register call to skip a map lookup if you use it directly), but it
contains another fusion apply struct template that specializes on the
original passed in function, and dserializes each chunk in turn, then
fusion invokes the actual function with the deserialized generated
fusion vector of the arguments.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk