Boost logo

Boost :

From: brass goowy (brass_at_[hidden])
Date: 2008-02-06 16:59:53


Shalom A possibly easier to read version of this note is here - http://home.seventy7.com/misc/range_postfeb608. Previously I suggested there should be serialization support wrt the Range library - http://lists.boost.org/Archives/boost/2008/01/132294.php. I'm writing to inform you of my plans in this regard. This input: Msgs (sub_range<list<short> >) @OUT } to the C++ Middleware Writer, http://home.seventy7.com/cgi-bin/samb.cgi, results in this output: #include <boost/range/sub_range.hpp> #include <list> #include <Buffer.hh> using boost::sub_range; struct Msgs { inline Msgs() {} inline ~Msgs() {} inline int Send(Buffer* buf, const sub_range<list<short> >& about1) { unsigned int headCount = 0; headCount = about1.size(); if (!buf->Receive(&headCount, sizeof(int))) { buf->ews_.SetErrorWords(1, __FILE__, __LINE__); return 0; } list<short>::const_iterator rit1 = boost::begin(about1); list<short>::const_iterator rit2 = boost::end(about1); for (; rit1 != rit2; ++rit1) { if (!buf->Receive(&(*rit1), sizeof(short))) { buf->ews_.SetErrorWords(1, __FILE__, __LINE__); return 0; } } if (!buf->SendStoredData()) { buf->ews_.SetErrorWords(2, __FILE__, __LINE__); return 0; } return 1; } }; This functionality isn't available online yet. G-d willing, it will be available by the middle of next month. The file Buffer.hh is here - http://home.seventy7.com/misc/Buffer.hh. There's also a version that calculates and sends the total message length here - http://home.seventy7.com/misc/rangeMsg.hh. (An option on the front end is checked to obtain this functionality.) This thread on clc++m, http://preview.tinyurl.com/218cnh, convinced me of the need to support total message lengths. The @OUT used above as input to the C++ Middleware Writer indicates you only want a Send function--by default both a Send and Receive function are generated. I believe sub_range supports operator << but not operator >>. So the @OUT option is necessary when using sub_range. A container could be used to receive data sent via the above Send function; as Middle code it would look something like this: Msgs (sub_range<list<short> >) @OUT (vector<short>) @IN } Brian Wood Ebenezer Enterprises www.webebenezer.net Keep your heart with all diligence; for out of it are the issues of life. Proverbs 4:23


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