Forums > Dev

question about attributes

December 21, 2006 | 4:19 pm

Hi there,

let’s say I am coding an object similar to groove~ but
that uses attributes.
The object can be instantiated with 1, 2 or 4 output
channels. However the number of output channels is a
parameter that can be chosen only at creation time.
The user cannot change it once the object has been
instantiated, because it directly affects the number
of outlets of the object.

I want the user to be able to choose the ‘number of
channels’ parameter using attributes at creation time
(i.e. @numchan 4). After that, I DON’T want the user
to be able to change the parameter with a simple
message (numchan 2) like he would normally do, because
the object would simply crash.

Is there a flag or some technique that I can use to
accomplish that?

Thanks in advance for any advice.

- Luigi

————————————————————
THIS E-MAIL MESSAGE IS FOR THE SOLE USE OF THE INTENDED RECIPIENT AND MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. ANY UNAUTHORIZED REVIEW, USE, DISCLOSURE OR DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT THE INTENDED RECIPIENT, CONTACT THE SENDER BY E-MAIL AT SUPERBIGIO@YAHOO.COM AND DESTROY ALL COPIES OF THE ORIGINAL MESSAGE. WITHOUT PREJUDICE UCC1-207.
————————————————————

Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around

http://mail.yahoo.com


December 21, 2006 | 11:11 pm

Give your attribute a custom setter method. In your new method, after
processing attributes, just set some flag to true. In the custom
setter, if the flag is true, don’t do anything.

jb

Am 21.12.2006 um 17:19 schrieb Luigi Castelli:

> Is there a flag or some technique that I can use to
> accomplish that?


December 24, 2006 | 3:15 am

Thanks for the tip, Jeremy… works like a charm.

One last question for you…

The *class_new() method defined in ext_obex.h takes an
argument of type long for size. The old setup method
used to take an argument of type short for class size,
which was implying a limit of 32k. Does that mean that
with the new obex extension the object struct size is
no longer limited to 32k ?

Thank you much.

- Luigi

— Jeremy Bernstein wrote:

> Give your attribute a custom setter method. In your
> new method, after
> processing attributes, just set some flag to true.
> In the custom
> setter, if the flag is true, don’t do anything.
>
> jb
>
> Am 21.12.2006 um 17:19 schrieb Luigi Castelli:
>
> > Is there a flag or some technique that I can use
> to
> > accomplish that?
>
>

————————————————————
THIS E-MAIL MESSAGE IS FOR THE SOLE USE OF THE INTENDED RECIPIENT AND MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. ANY UNAUTHORIZED REVIEW, USE, DISCLOSURE OR DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT THE INTENDED RECIPIENT, CONTACT THE SENDER BY E-MAIL AT SUPERBIGIO@YAHOO.COM AND DESTROY ALL COPIES OF THE ORIGINAL MESSAGE. WITHOUT PREJUDICE UCC1-207.
————————————————————

Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around

http://mail.yahoo.com


December 24, 2006 | 11:45 am

Luigi Castelli wrote:
> Thanks for the tip, Jeremy… works like a charm.
>
> One last question for you…
>
> The *class_new() method defined in ext_obex.h takes an
> argument of type long for size. The old setup method
> used to take an argument of type short for class size,
> which was implying a limit of 32k.

Right, it seems this changed from short to long, also some A_GIMME type
functions now take long for argument count with the new API. However,
attr_args_process() still wants shorts, so I was also wondering whether
there still is a short limit somehwere or not.

Olaf


December 24, 2006 | 12:44 pm

I believe that, yes, new-style objects declared with class_new() and
allocated with object_alloc() can be larger as 32K. attr_args_process
() takes an atom array, and the number of atoms in the array is
represented by a short. You can’t put more than 32K atoms in a box,
anyway.

jb

Am 24.12.2006 um 12:45 schrieb Olaf Matthes:

> Luigi Castelli wrote:
>> Thanks for the tip, Jeremy… works like a charm.
>> One last question for you…
>> The *class_new() method defined in ext_obex.h takes an
>> argument of type long for size. The old setup method
>> used to take an argument of type short for class size,
>> which was implying a limit of 32k.
>
> Right, it seems this changed from short to long, also some A_GIMME
> type functions now take long for argument count with the new API.
> However, attr_args_process() still wants shorts, so I was also
> wondering whether there still is a short limit somehwere or not.
>
> Olaf


Viewing 5 posts - 1 through 5 (of 5 total)