Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   Version 1.11 of C++ Middleware Writer now on line (http://www.velocityreviews.com/forums/t715887-version-1-11-of-c-middleware-writer-now-on-line.html)

Brian 02-23-2010 08:34 PM

Version 1.11 of C++ Middleware Writer now on line
 

Shalom

Release 1.11 of the C++ Middleware Writer is now on line.
This release has the following changes:

1. std::complex and boost::circular_buffer support added.

2. Support added for strongly-typed enums such as:
enum class Fruit : uint8_t
{ love = 1, joy, peace, patience, kindness,
goodness, faithfulness, gentleness,
self-control };

3. Bug fixes.


Comments welcome.


Brian Wood
http://webEbenezer.net
(651) 251-9384

Brian 02-23-2010 09:27 PM

Re: Version 1.11 of C++ Middleware Writer now on line
 
On Feb 23, 2:34*pm, Brian <c...@mailvault.com> wrote:
> Shalom
>
> Release 1.11 of the C++ Middleware Writer is now on line.
> This release has the following changes:
>
> *1. std::complex and boost::circular_buffer support added.
>
> *2. Support added for strongly-typed enums such as:
> * * *enum class Fruit : uint8_t
> * * * * * * * * *{ love = 1, joy, peace, patience, kindness,
> * * * * * * * * * *goodness, faithfulness, gentleness,
> * * * * * * * * * *self-control };
>


That should be self_control with an underscore rather
than a dash.

Brian Wood

Jorgen Grahn 02-27-2010 09:32 PM

Re: Version 1.11 of C++ Middleware Writer now on line
 
On Tue, 2010-02-23, Brian wrote:
>
> Shalom
>
> Release 1.11 of the C++ Middleware Writer is now on line.
> This release has the following changes:
>

....
>
> Comments welcome.


One comment -- What is it? "Middleware" is a word which fills some
people (like me) with dread, so a short description would have been
nice.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .

Brian 02-28-2010 04:27 AM

Re: Version 1.11 of C++ Middleware Writer now on line
 
On Feb 27, 3:32*pm, Jorgen Grahn <grahn+n...@snipabacken.se> wrote:
>
> One comment -- What is it? *"Middleware" is a word which fills some
> people (like me) with dread, so a short description would have been
> nice.
>


It is as an on line alternative to serialization
libraries. It writes marshalling code based on
user input. The following refers to a "File" type
that is here -- http://webEbenezer.net/misc/File.hh
This input:

msg_shepherd
(std::vector<File>, File*, uint32_t) @msg_id_direct
}


Results in this output:

// Generated by the C++ Middleware Writer version 1.11

#include <vector>
#include <MarshallingFunctions.hh>
#include <ReceiveCompressedBuffer.hh>
#include <SendCompressedBuffer.hh>

uint16_t const msg_id_direct = 1201;
uint16_t const msg_id_max = 1202;

extern uint32_t msg_length_max;

struct msg_shepherd
{

void
Send(SendCompressedBuffer* buf, const std::vector<File>& abt1, const
File* abt2, const uint32_t abt3)
{
buf->Receive(&msg_id_direct, sizeof(msg_id_direct));
Counter cntr(msg_length_max);
cntr.Add(sizeof(uint32_t));
groupCount(cntr, false, sizeof(uint16_t), abt1);
abt2->CalculateMarshallingSize(cntr);
cntr.Add(sizeof(uint32_t));
buf->Receive(&cntr.value_, sizeof(cntr.value_));

groupSend(buf, false, abt1);

abt2->Send(buf, true);

buf->Receive(&abt3, sizeof(uint32_t));
buf->Flush();
}


template <typename B>
void
Receive(B* buf, std::vector<File>& abt1, File*& abt2, uint32_t& abt3)
{
uint32_t headCount[1];
buf->Give(headCount[0]);
abt1.reserve(abt1.size() + headCount[0]);
while (headCount[0] > 0) {
--headCount[0];
File rep2(buf);
abt1.push_back(rep2);
}

abt2 = new File(buf);

buf->Give(abt3);
}

};


The Send function first sends a message id and then
it calculates how many bytes are in the message.
If there are more bytes than msg_length_max it throws
an exception. Then the function embeds the message
length in the stream and then it sends the data
from the message.

The Receive function assumes that other code has
received the message id and message length, so it
just receives the data from the message. There's an
example of that here --
http://webEbenezer.net/misc/receivesample.cc .

The C++ Middleware Writer automates the production
of serialization functions as is the case in languages
like C# and Java.

There's both a web interface to the C++ Middleware
Writer -- http://webEbenezer.net/cgi-bin/samb.cgi
and a command line interface that is much more
convenient in terms of development --
http://webEbenezer.net/build_integration.html.


I use the C++ Middleware Writer to develop new
versions of the software. The code above is used
in the command line interface. This line:

(std::vector<File>, File*, uint32_t) @msg_id_direct

is used to send/receive a variable number of header
files, then a Middle file, and then an integer
which is used to indicate what settings are
requested. The command line interface reads
a file like this:

Header-File File.hh
Middle-File direct.mdl
Output-Type Middleware
Compression Yes
Embed-Calls-to-Flush-Buffer Yes
Type-Used-for-Constants uint16_t


That file only has one header file, but there
could be multiple header files listed in the
file. The last 4 lines are the settings that
are encoded in the integer I mentioned.


Thanks for asking.

Brian Wood
http://webEbenezer.net
(651) 251-9384


All times are GMT. The time now is 08:49 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.