Release 1.13 of the C++ Middleware Writer now on line

Discussion in 'C++' started by Brian, May 8, 2010.

  1. Brian

    Brian Guest

    Shalom

    Release 1.13 of the C++ Middleware Writer is now on line. This
    release
    adds support for the following:

    1. A lil_string class which throws an exception if an operation
    would result in a string more than 255 characters. This
    guarantees that the length of the string can be marshalled
    with one byte. Lil_string is used, for example, to hold account
    passwords.

    2. Move semantics. A config file parameter, 'Permit-std::move',
    is used to indicate that the generated code may use std::move.
    The following shows an example of output when
    Permit-std::move is turned on.

    template <typename B>
    void
    Receive(B* buf, vector<deque<lil_string> >& abt1)
    {
    uint32_t headCount[2];
    buf->Give(headCount[0]);
    abt1.reserve(abt1.size() + headCount[0]);
    while (headCount[0] > 0) {
    --headCount[0];
    deque<lil_string> rep4;
    buf->Give(headCount[1]);
    while (headCount[1] > 0) {
    --headCount[1];
    lil_string rep5(buf);
    rep4.push_back(std::move(rep5));
    }
    abt1.push_back(std::move(rep4));
    }
    }

    I believe the C++ MIddleware Writer is the only marshalling/
    serialization option with std::move support.

    3. Bug fixes and refactoring of C++ Middleware Writer guts.

    Comments welcome.


    Brian Wood
    http://webEbenezer.net
    (651) 251-9384
    Brian, May 8, 2010
    #1
    1. Advertising

  2. Brian

    Brian Guest

    On May 8, 5:42 pm, Brian <> wrote:
    > Shalom
    >
    > Release 1.13 of the C++ Middleware Writer is now on line. This
    > release
    > adds support for the following:
    >
    > 1. A lil_string class which throws an exception if an operation
    >     would result in a string more than 255 characters. This
    >     guarantees that the length of the string can be marshalled
    >     with one byte. Lil_string is used, for example, to hold account
    >     passwords.
    >
    > 2. Move semantics. A config file parameter, 'Permit-std::move',
    >     is used to indicate that the generated code may use std::move.
    >     The following shows an example of output when
    >     Permit-std::move is turned on.
    >
    > template <typename B>
    > void
    > Receive(B* buf, vector<deque<lil_string> >& abt1)
    > {
    >   uint32_t headCount[2];
    >   buf->Give(headCount[0]);
    >   abt1.reserve(abt1.size() + headCount[0]);
    >   while (headCount[0] > 0) {
    >     --headCount[0];
    >     deque<lil_string> rep4;
    >     buf->Give(headCount[1]);
    >     while (headCount[1] > 0) {
    >       --headCount[1];
    >       lil_string rep5(buf);
    >       rep4.push_back(std::move(rep5));
    >     }
    >     abt1.push_back(std::move(rep4));
    >   }
    >
    > }
    >
    > I believe the C++ MIddleware Writer is the only marshalling/
    > serialization option with std::move support.
    >



    I've run some tests now with and without Permit-std::move
    turned on. I used a vector<deque<double> >.

    The Boost Serialization version is here --
    http://webEbenezer.net/posts/mvbst_test.cc

    The Ebenezer version is here --
    http://webEbenezer.net/posts/movingMsgs.hh
    http://webEbenezer.net/posts/mv_test.cc


    The Boost version was 1.3 times slower than the Ebenezer
    version with Permit-std::move turned off and 1.8 times
    slower the Ebenezer version when that flag was turned on.

    I've been trying to determine if Boost Serialization supports
    std::move. I grep'ed through the 1.43 libs/serialization
    subdirs for std::move but didn't find any uses. I also checked
    the "To Do" section of the documentation and didn't find any
    mention of std::move there. So I doubt that the 1.43 version
    is using std::move, but I don't think I grep'ed all the
    sources and know that the author makes use of his fair share
    of macros so am not 100% sure. I asked a question about this
    on the Boost Users list now as well but no answer there yet.


    Brian Wood
    Brian, May 10, 2010
    #2
    1. Advertising

  3. Brian

    Brian Guest

    On May 8, 5:42 pm, Brian <> wrote:
    > Shalom
    >
    > Release 1.13 of the C++ Middleware Writer is now on line. This
    > release
    > adds support for the following:
    >
    > 1. A lil_string class which throws an exception if an operation
    >     would result in a string more than 255 characters. This
    >     guarantees that the length of the string can be marshalled
    >     with one byte. Lil_string is used, for example, to hold account
    >     passwords.
    >
    > 2. Move semantics. A config file parameter, 'Permit-std::move',
    >     is used to indicate that the generated code may use std::move.
    >     The following shows an example of output when
    >     Permit-std::move is turned on.
    >
    > template <typename B>
    > void
    > Receive(B* buf, vector<deque<lil_string> >& abt1)
    > {
    >   uint32_t headCount[2];
    >   buf->Give(headCount[0]);
    >   abt1.reserve(abt1.size() + headCount[0]);
    >   while (headCount[0] > 0) {
    >     --headCount[0];
    >     deque<lil_string> rep4;
    >     buf->Give(headCount[1]);
    >     while (headCount[1] > 0) {
    >       --headCount[1];
    >       lil_string rep5(buf);
    >       rep4.push_back(std::move(rep5));
    >     }
    >     abt1.push_back(std::move(rep4));
    >   }
    >
    > }
    >


    I'm thinking about changing the iterating to this:

    template <typename B>
    void
    Receive(B* buf, vector<deque<lil_string> >& abt1)
    {
    uint32_t headCount[2];
    buf->Give(headCount[0]);
    abt1.reserve(abt1.size() + headCount[0]);
    for (; headCount[0] > 0; --headCount[0]) {
    deque<lil_string> rep4;
    buf->Give(headCount[1]);
    for (; headCount[1] > 0; --headCount[1]) {
    lil_string rep5(buf);
    rep4.push_back(std::move(rep5));
    }
    abt1.push_back(std::move(rep4));
    }
    }


    I know a post decrement could be used, but am loathe to
    do so.

    Also I know that I could add support for emplace and
    use that rather than the push_back with the lil_string.
    For now I'm happy to just be able to move them.
    Brian, May 13, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    340
  2. Replies:
    1
    Views:
    268
  3. Brian
    Replies:
    0
    Views:
    258
    Brian
    Nov 29, 2009
  4. Brian
    Replies:
    3
    Views:
    291
    Brian
    Feb 28, 2010
  5. Brian
    Replies:
    0
    Views:
    295
    Brian
    Apr 1, 2010
Loading...

Share This Page