[Click] practices for singleton elements
Eddie Kohler
kohler at cs.ucla.edu
Thu Dec 18 18:39:17 EST 2008
Hi Marco, sorry for the delay.
Yes, Router::attachment() can be used to enforce single instances, and for
example that's how we make sure there's only one FromDevice per device.
However, the Click practice has been to avoid true singleton elements when
possible. For example, a config can have multiple AddressInfo elements; Click
combines their info, and also keeps AddressInfos local per compound element
when appropriate.
In the end, just do what's easiest, and then make your element smarter as
required.
Hope this helps.
Eddie
Marco Canini wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello,
>
> what are the current practices for singleton elements?
> is it up to the programmer to enforce a single instance or can click
> take care of guaranteeing a single instance is created?
> is Router.attachment() designed for this? (if not what is it for)
> cheers
>
>
> - --
> Marco Canini
> Ph.D. Candidate
> Department of Communication, Computer and System Sciences
> University of Genoa
> Via all'Opera Pia 13
> 16145 Genoa Italy
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.5 (MingW32)
>
> iD8DBQFJNp8EK52QDm/mFCkRAr5TAJ9LhPYREjrgtpQcVbNRi55Py7al1QCgg53p
> JNSzaFNZbwlXCe5RrjKm5d0=
> =pF25
> -----END PGP SIGNATURE-----
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
More information about the click
mailing list