OMNeT++/OMNEST Bug Tracker - OMNeT++
View Issue Details
0000101OMNeT++command line toolspublic2009-09-02 14:212010-05-09 19:41
0000101: Add a message property @sizetype() to msgc to specify to specify the type of the array size variable
Currently msgc stores the size of an array in an "int". In OverSim we use msgc generated messages also for real world communication by serializing them with parsim pack()/unpack() methods. In this case using a 32 bit integer is a waste of network communication bandwidth, if we know that an array will only contain a few elements.

I've made a small patch to msgc to support the @sizetype property to specify the C++ type of the array size variable.


packet BaseRpcMessage
    unsigned int nonce;
    NodeHandle srcNode;
    AuthBlock authBlock[] @sizetype(uint8_t);

No tags attached.
patch msgc_sizetype.patch (949) 2009-09-02 14:21
Issue History
2009-09-02 14:21baumgartNew Issue
2009-09-02 14:21baumgartFile Added: msgc_sizetype.patch
2009-09-11 09:55baumgartNote Added: 0000173
2010-05-09 18:43andrasNote Added: 0000291
2010-05-09 18:43andrasStatusnew => resolved
2010-05-09 18:43andrasFixed in Version => 4.1rc1
2010-05-09 18:43andrasResolutionopen => fixed
2010-05-09 18:43andrasAssigned To => andras
2010-05-09 18:49andrasNote Edited: 0000291
2010-05-09 19:41andrasNote Added: 0000292

2009-09-11 09:55   
The above patch seems to break neddoc generation. For all messages which appear after a message with the new @sizetype property in the same .msg file, there is no neddoc generated.

BTW, I don't see any error messages or warnings (e.g. undocumented parameters) in the IDE when trying to generate neddoc. Is this not available or is it simply hidden in some place?
2010-05-09 18:43   
(edited on: 2010-05-09 18:49)
Implemented @sizetype() for array parameters. Unlike in the attached patch, the specified type is also used in the signatures of the field getter/setter methods (as index), and as return type and arg type in the array size getter/setter methods.

The IDE neddoc error seems to have been fixed since 4.0, as I could not reproduce it. Documentation from types containing @sizetype was correctly generated.

2010-05-09 19:41   
Update: I could reproduce the neddoc error: it occurred when @sizetype contained a keyword like "int", "short", "unsigned", etc. It was caused by a parse error: the grammar did not allow these keywords in property values. The workaround would have been to put these types in quotes (like this: @sizetype("unsigned char")). I extended the grammar to include these keywords, so it should now work without quotes as well.