Home Help Center

Assertion when serializing a struct (Dynamic Ice)

cyrille_favreaucyrille_favreau Member Cyrille FavreauOrganization: ...Project: ...
Hi, I have the following simple struct
module StompPOC
   struct Message
      string description;
      int    value;

And when I run the following code, I get an assertion:
std::vector<Ice::Byte> data;
Ice::OutputStreamPtr dataOut = Ice::createOutputStream( communicator() );
StompPOC::Message msg;
msg.description = "This is a byte message (Dynamic Iced)";
msg.value = 999;
dataOut->write( msg ); ==> ASSERTION 
dataOut->finished( data );

The assertion is raised by the following piece of code, in the Ice/stream.h file:
template<StreamTraitType st>
struct StreamWriter
    template<typename T>
    static void write(const OutputStreamPtr&, const T&)
        // This asserts because we end up writing something for which
        // we never defined a trait.
What I am doing wrong?

Thanks in advance for any help.


  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi Cyrille,

    Welcome to the forum.

    Did you include the --stream option when you compiled your Slice definitions with slice2cpp?

  • cyrille_favreaucyrille_favreau Member Cyrille FavreauOrganization: ...Project: ...
    Hi Mark,

    No I did not, that does improve the situation :)

    Many thanks for your very quick response.

    Have a good weekend.
Sign In or Register to comment.