Is it possible to extend more than one appication in simple module

33 views
Skip to first unread message

Karthick Subramanian

unread,
Jul 26, 2015, 5:43:34 AM7/26/15
to OMNeT++ Users
Hi all,

I would like to if it is possible to extend more than one application in simple module.

E.g simple TrafficApp extends UDPBasicApp, BGTrafficSourceApp
{

}

If it is possible, kindly let me know how can i do that.

Thanks in advance,
Karthick

Andreas Rain

unread,
Jul 27, 2015, 6:05:17 AM7/27/15
to OMNeT++ Users, karthick...@gmail.com
Hi,

you can create a compund module that uses both.
I don't think you can extend two different simple modules.

What is your intention? Do you really want to extend the code
and add functionality, combining both modules?

Or do you just want to use them?

Best regards,
Andreas

Karthick Subramanian

unread,
Jul 27, 2015, 1:48:11 PM7/27/15
to OMNeT++ Users, andrea...@gmail.com
HI Andreas,

My aim is to extend the code and add functionalities. If I create a compound module, it is not possible to add new functionalities. Thats the problem I have.

Thanks,
Karthick

Andreas Rain

unread,
Jul 27, 2015, 2:17:21 PM7/27/15
to OMNeT++ Users, karthick...@gmail.com
Hi,

you could extend each module individually and add functionality
separately. I mean:

simple MYUDPBasicApp extends UDPBasicApp{}
simple
MYBGTrafficSourceApp extends BGTrafficSourceApp {}

module MyModule{
   submodules
:
      myudpapp
: MYUDPBasicApp {}
      mybgtrafficapp
: MYBGTrafficSourceApp {}
}

Furthermore, if you add one additional class (which would not be a simple module), you could let both your apps
extend this class and the traffic apps (only in C++; check for instance
where multiple inheritance is described). With this approach you'd only have to implement
your additional functionality once, in your separate class. You'd have to call the parent methods respectively
in the order you wish them to be executed.

If you don't have a problem changing the INET Code directly, you can also
just edit the existing module's code and extend your separate class as well.

I'm not sure if what I mean is clear enough, let me know if I could help you.

Best regards,
Andreas

Karthick Subramanian

unread,
Jul 27, 2015, 2:50:20 PM7/27/15
to OMNeT++ Users, andrea...@gmail.com

HI Andreas,

I understand Multiple Inheritance. But multiple inheritance is not working as expected.
E.g:

simple A extends B,C{ }

But this not working in .ned.

Thanks,
Karthick

Ester Lopez

unread,
Jul 28, 2015, 3:40:50 AM7/28/15
to omn...@googlegroups.com
Hi Karthick,

Why dont you have class A extend B, C on c++ and then have on your ned file something like

simple A like IIPvXTrafficGenerator {
... (parameters & gates)
}

Cheers,
Ester

--
You received this message because you are subscribed to the Google Groups "OMNeT++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/omnetpp.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages