Bug 1347

Summary: ns-3 should put each module's headers in a separate directory
Product: ns-3 Reporter: Vedran Miletić <vedran>
Component: build systemAssignee: Gustavo J. A. M. Carneiro <gjcarneiro>
Status: NEW ---    
Severity: normal CC: mathieu.lacage, nicola, ns-bugs, sebastien.deronne
Priority: P5    
Version: pre-release   
Hardware: All   
OS: All   

Description Vedran Miletić 2012-01-16 15:35:12 EST
Currently, ns-3 has a single dir ns3/ and all the headers are there. Once app store for models comes there are much more easily going to be name collisions, even unintentionally. We want to avoid this by design. A while ago this was proposed on the mailing list[1][2].

So, instead of single dir approach, ns-3 should have per-module headers in a separate dir, specifically ns3/<modulename>/<headername>.h

For example, one would have ns3/core/scheduler.h and ns3/network/node.h instead of ns3/scheduler.h and ns3/node.h.

I wouldn't move ns3/*-module.h since those headers will collide only if modules have the same name (and this is not very likely and should probably prevented from happening in some other way). This will keep high-level scripts intact, which is a good thing.

Changes to #include directives in module .h and .cc files can be handled automatically with one-off python script. I will try to do rough sketch version soon but can't promise anything.

Changes to waf are required as well, but on the first look this doesn't seem too hard.

[1] http://mailman.isi.edu/pipermail/ns-developers/2011-October/009547.html
[2] http://mailman.isi.edu/pipermail/ns-developers/2011-December/009666.html
Comment 1 Gustavo J. A. M. Carneiro 2012-01-16 20:17:43 EST
I remember Mathieu Lacage used to be pretty much against it in the early days of ns-3.  Did that change?

I think this is a very visible change and needs to be discussed in the mailing-list in a very clear way.  It requires changing all the includes, and the style of ns-3 programming changes slightly.  Wheres before you'd include "ns3/whatever" and not care which module defined it, now you need to say in which module the header is found.  And the headers file names are namespaced, but the C++ definitions are not, we only have a single ns3 C++ namespace for everything.

I am -0 for this change: it doesn't really solve any problem, so why bother.
Comment 2 Vedran Miletić 2012-01-17 02:34:47 EST
I understand. Would your opinion on it improve if we also suggested introducing namespaces for each module as well?

Mathieu's comment is in [2] in my original post:

"I think that no one said that they were against more modular headers
but I do not think anyone has cycles to spend on this so if you want
to make it happen, you need to come up with a concrete proposal that
takes into account the comments you got previously about it and that
lays out a plan for the necessary migration."
Comment 3 Mathieu Lacage 2012-03-23 04:14:04 EDT
(In reply to comment #2)

> "I think that no one said that they were against more modular headers
> but I do not think anyone has cycles to spend on this so if you want
> to make it happen, you need to come up with a concrete proposal that
> takes into account the comments you got previously about it and that
> lays out a plan for the necessary migration."

+1
Comment 4 sebastien.deronne 2018-03-08 15:38:08 EST
+1.
Any reason why this is pending? I guess this is not so much effort.