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

B

Brian

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
 
B

Brian

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
 
B

Brian

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top