OMNeT++/OMNEST Bug Tracker - OMNeT++
View Issue Details
0000432OMNeT++IDE / NED editorpublic2011-11-09 13:222011-11-09 14:46
michael 
 
normalfeaturehave not tried
newopen 
4.2rc1 
 
0000432: Extending vectorized submodule in inherited module
It would be nice if following would be possible:

module A
{
    parameters:
        string pType = default("aa");

    //#...
    submodules:
        low: BaseAny {
        }
        sub[0]: <pType> like IAny {
            //#...
        }
        upp: BaseAny {
        }

    connections:
        low.upperControlOut --> sub[0].lowerControlIn;
        low.upperControlIn <-- sub[0].lowerControlOut;

        for i=0..sizeof(sub)-2 {
            sub[i].upperControlOut --> sub[i+1].lowerControlIn;
            sub[i].upperControlIn <-- sub[i+1].lowerControlOut;
        }

        sub[sizeof(sub)-1].upperControlOut --> upp.lowerControlIn;
        sub[sizeof(sub)-1].upperControlIn <-- upp.lowerControlOut;
}

module B extends A
{
    parameters:
        string pAddOnType = default("aa");

    //#...
    submodules:
        sub[1]: <pAddOnType > like IAny {
            //#...
        }
}
No tags attached.
Issue History
2011-11-09 13:22michaelNew Issue
2011-11-09 13:48rhornigNote Added: 0000587
2011-11-09 14:46michaelNote Added: 0000588

Notes
(0000587)
rhornig   
2011-11-09 13:48   
It's not clear what you want to achieve. In the example the submodule vector is first declared as 0 size, then in the derived module it is declared as a 1 sized vector. Is the intention is to have a module vector where the elements of the vector have different type (but all implementing IAny)?
(0000588)
michael   
2011-11-09 14:46   
Yes and no, I want to increase the size of sub in B and sub[1] may have another type as sub[0].

I think following is currently allowed (but only in A):

module A
{
    //#...
    submodules:
        low: BaseAny {
        }
        sub[0]: <pType> like IAny {
            //#...
        }
        sub[1]: <pAnotherType> like IAny {
            //#...
        }
        upp: BaseAny {
        }
    //#...
}

the definition of "sub[]:..." results in an error yet and

... "sub++: <pAnotherType> {}" syntax is not correct but it is what I want: extending sub-vector and define other type/parameters for it (should also possible in B).