Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Release 1.13 of the C++ Middleware Writer now on line

Reply
Thread Tools

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

 
 
Brian
Guest
Posts: n/a
 
      05-08-2010
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
 
Reply With Quote
 
 
 
 
Brian
Guest
Posts: n/a
 
      05-10-2010
On May 8, 5:42*pm, Brian <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
 
Brian
Guest
Posts: n/a
 
      05-13-2010
On May 8, 5:42*pm, Brian <(E-Mail Removed)> 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Release 1.12 of the C++ Middleware Writer on line Brian C++ 0 04-01-2010 09:10 PM
Version 1.11 of C++ Middleware Writer now on line Brian C++ 3 02-28-2010 04:27 AM
C++ Middleware Writer version 1.10 is now on line Brian C++ 0 11-29-2009 07:43 AM
New version of C++ Middleware Writer now on line woodbrian77@gmail.com C++ 1 05-20-2009 06:02 PM
Isn't DataGrid.Render(writer) supposed to automatically call RenderBeginTag(writer) and RenderEndTag(writer)? Henri ASP .Net Building Controls 1 07-13-2004 10:27 PM



Advertisments