[Ns-developers] [ns3] wrapper classes in the Attributes API
Raj Bhattacharjea
raj.b at gatech.edu
Wed May 21 07:29:38 PDT 2008
On Wed, May 21, 2008 at 6:28 AM, Gustavo Carneiro <gjcarneiro at gmail.com> wrote:
[snip]
> Regarding, DataRateValue (DataRate(100000)), I distinctly remember Mathieu
> probing this list if it was OK to do that. I was personally in favor of
> this approach because it improves consistency.
I really understand the consistency argument, and I happen to like
that argument myself. But, the downside is that the user sees
something which LOOKS more verbose than necessary.
...[snip]
>> These two issues independently make me think of templates immediately,
>> and it seems that using templates in both of these cases would work
>> really well together.
>
> I'm afraid you are being too vague. At least I can't comment without
> specific API proposal examples...
Yes, let me clarify:
All of the AttributeValue subclasses could be template
instantiations/specializations instead of some being macro-created,
and all the APIs which take an AttributeValue as a parameter could be
templated with the type. I'm envisioning the current AttributeValue
class to be renamed to AttributeValueBase, with
subclasses AttributeValue<T>, and APIs like AddAttribute and the
helper APIs maybe looking like the following:
p2p.SetChannelParameter<DataRate>("BitRate", DataRate(100000));
TypeId ("ns3::RajClass").AddAttribute<bool> ("TrueFalse", "help", false, ...);
The wrapper classes would still be used internally, they just
disappear from the user visible API, and they'd even disappear from
the TypeId API. I'll prototype a bit and post a repository with some
of these ideas more fully baked.
--
Raj Bhattacharjea
Georgia Institute of Technology
School of Electrical and Computer Engineering
Systems Analyst
404.894.2955
More information about the Ns-developers
mailing list