[Ns-developers] A question about object aggregate
craigdo@ee.washington.edu
craigdo at ee.washington.edu
Mon Jul 14 12:10:16 PDT 2008
>> From the code, it shows that aggregate objects have different TypeId
>> each other. Can someone explain to me that what is the reason that
>> only object with different TypeId can be aggregated?
> I think the main reason here is basically simplicity. If you had
> multiple objects of the same type, you'd have to provide an interface
> to access it. More importantly, every time you wanted to use an
> object you'd have to track & make sure it was the one you wanted,
> which could be impossible or very impractical in some cases, and
> annoying in an overwhelming percentage of use cases.
As Gustavo mentioned earlier, we're talking about an object aggregation and
runtime discovery system that is really (Microsoft) COM-like, but that has
different names.
COM has the concept of interface IDs (IID). You ask for an object
(QueryInterface) by providing an IID. Thus, there is no way to aggregate
multiple objects of the same IID (how do you differentiate them?).
In ns-3, we have basically taken the core concepts of COM and tied them into
ns-3 specific concepts such as big-O Objects and attributes. Our ns-3
Objects can have attributes which are specified using the TypeId system.
The TypeId does double duty and provides us with the ns-3 equivalent of an
interface ID.
Therefore only objects with different TypeId can be aggregated.
More information about the Ns-developers
mailing list