Yes, these strings are used when making calls to the nesc "unique()
function'. A call to unique("SomeString") returns a unique number
each time it is called with the string "SimeString". Calls to
unique("SomeOtherString") will produce another set of unique numbers
associated with the "SomeOtherString" string.
These unique calls are used when creating multiple instantiations of a
parameterized interface. Sometimes you want to explicitly set the
parameter to a specific number (i.e. when specifying an AM type).
Other times you don't care as long as you receive some unique instance
of the interface. The 'unique()' function is used for this second case
so you don't have to keep track of all the different places a
parameterized interface has been instantiated (i.e. when wiring up
multiple clients to the ADC from different components).
By #defining the string to a name that the preprocessor recognizes,
compile time checks can be made to guarantee that you didn't
accidentally mistype the string supplied to a 'unique()' function,
thereby spawning off a new set of unique numbers which could
potentially conflict with set that maps to the string you originally
intended to supply.
All of this said, in most places in the tinyos tree, the use of unique
is hidden behind generic configurations which handle all of this magic
for you. Its worthwhile to know how its doing what its doing
though....
Kevin
On 8/20/07, Wei Ping Song <[EMAIL PROTECTED]> wrote:
> Hi all,
> what's the meaning of this sentence
> #define MSP430ADC12_RESOURCE "Msp430Adc12C.Resource"
>
> Is this means MSP430ADC12_RESOURCE is a string of "Msp430Adc12C.Resource"?
>
> thanks in advance
>
> weiping
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
--
~Kevin
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help