On 2009-09-14, at 2:38 PM, dennisf486 wrote:
> For my C++ to Io binding library, when I get a method call come in
> from Io, and I have a bunch of Io objects as arguments, some of them
> will be native Io objects like Numbers and Strings, and other ones
> will actually wrap C++ objects that the addon previously packaged
> up. The data pointer of those 2nd type of objects should then point
> to a valid C++ object that I can cast to what I want, but how can I
> reliably tell the difference between objects I made and native Io
> objects?
Hi Dennis,
You can test for primitive types using the IOOBJECT_ISTYPE() macro.
Example:
IOOBJECT_ISTYPE(self, Seq)
> I'm thinking the "tag" string could be used for this purpose - is
> that what "tag" is for? Can the tag also tell me when it is a
> Number or String? Is there an Io C-api macro I should use like
> "IS_IONUMBER" or "IS_IOSEQUENCE"?
Yes, the tag contains the primitive type info. There are also
convenience macros like:
ISNUMBER(anObject)
ISSEQ(anObject)
ISMESSAGE(anObject)
etc.
Hope this helps,
Steve