Version 1.11 of C++ Middleware Writer now on line

B

Brian

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
 
B

Brian

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
 
J

Jorgen Grahn

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
 
B

Brian

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
 

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

No members online now.

Forum statistics

Threads
473,930
Messages
2,570,072
Members
46,522
Latest member
Mad-Ram

Latest Threads

Top