Version 1.11 of C++ Middleware Writer now on line

Discussion in 'C++' started by Brian, Feb 23, 2010.

  1. Brian

    Brian Guest

    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, Feb 23, 2010
    #1
    1. Advertising

  2. Brian

    Brian Guest

    On Feb 23, 2:34 pm, Brian <> 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
    Brian, Feb 23, 2010
    #2
    1. Advertising

  3. Brian

    Jorgen Grahn Guest

    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 .
    Jorgen Grahn, Feb 27, 2010
    #3
  4. Brian

    Brian Guest

    On Feb 27, 3:32 pm, Jorgen Grahn <> 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
    Brian, Feb 28, 2010
    #4
    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:
    356
  2. Replies:
    1
    Views:
    282
  3. Brian
    Replies:
    0
    Views:
    272
    Brian
    Nov 29, 2009
  4. Brian
    Replies:
    0
    Views:
    322
    Brian
    Apr 1, 2010
  5. Brian
    Replies:
    2
    Views:
    279
    Brian
    May 13, 2010
Loading...

Share This Page