|
Boost : |
From: Stjepan Rajko (stipe_at_[hidden])
Date: 2007-04-16 22:36:41
Well, I threw together a little hack of a marshalling wanna-be
framework... Files attached. Implementation is ..eh.., and the
results of the call (either returned or in the parameters) are not
marshalled back at all.
The usage example goes something like:
marshall::registry<int> reg;
reg.set<void (int, int)>(2, func2); // register function
reg.set<void (int)>(1, func1); // register function
reg.set<void ()>(0, func0); // register function
// embed the function id into the call as well as two parameters
std::string call2_5_6 = marshall::serialize<int, void (int, int)>(2, 5, 6);
// embed just two parameters
std::string call_5_6 = marshall::serialize<void (int, int)>(5, 6);
// embed just one parameter
std::string call_5 = marshall::serialize<void (int)>(7);
// embed nothing
std::string call = marshall::serialize<void ()>();
reg(call2_5_6); // call via the embedded function id; results in func2(5,6)
reg(2, call_5_6); // call by specifying the id; func2(5,6)
reg(1, call_5); // call by specifying the id; func1(5)
reg(1, call_5_6); // no checking to see if extra parameters are left
over; func1(5)
reg(0, call); // call by specifying the id; func0()
...not sure if anything beyond this will work with the current implementation.
Anyway, If Channel can already do this, cool... If not and someone
wants to lead getting a marshalling thing together, or finishing the
Boostification of Channel, I can help a little but I need to focus on
the signal network library for GSoC.
In any case, I'd be interested in getting some marshalling into boost
because that allows for distributed signal networks that can not only
pass signals from one computer to another but also execute RPCs.
Stjepan
On 4/16/07, Shams <shams_at_[hidden]> wrote:
> Hi,
>
> Here is one that the author is working towards Boosting it...
>
> http://channel.sourceforge.net/#boost
>
> Maybe a few of you interested parties could get together to develop it
> faster...
>
> Thanks
> Shams
>
> --
>
> "Hans Larsen" <hans_at_[hidden]> wrote in message
> news:7D55A7CC-F228-4BAA-A3F3-210D84D79901_at_poltras.com...
> > Is there a marshaling library in boost and is there an interest in
> > such a functionality? Is the serializing library any use to marshall
> > calls?
> >
> > I've not seen any mails concerning marshaling recently, though I
> > might have missed one.
> >
> > Thanks,
> > Hans
> >
> > I'm thinking something along the lines of the following. Although it
> > may not be possible, I think it is (maybe the function registry is
> > not necessary).
> >
> > int func( int i, int j )
> > {
> > using namespace std;
> > cout << "i: " << i << " j:" << k << endl;
> > return i + j;
> > }
> >
> > int main()
> > {
> > using m = boost::marshall;
> > using std;
> >
> > int funcid = 1;
> > m::register_function( funcid, func ); // Using same principles as in
> > boost::function for type safety.
> > m::call x(funcid, 1, 2);
> > string str = x.serialize();
> > m::call y( str );
> > try {
> > cout << y() << endl;
> > } catch( m::invalid_function x ) {
> > cout << x.what() << endl;
> > }
> > return 0;
> > }
> >
> > // ------
> > // Should output:
> > // i: 1 j: 2
> > // 3
> > _______________________________________________
> > Unsubscribe & other changes:
> > http://lists.boost.org/mailman/listinfo.cgi/boost
> >
>
>
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk