[PD] storing pointers (in C) to other objects?

Mike Wozniewski mike at ozmediasolutions.com
Wed Mar 16 17:43:09 CET 2005


A follow-up question that might provide a solution to this problem:

Perhaps I could create a 'list' during my obj_setup() method which would 
be accessible by all instances of my class?

Since obj_setup() is only called once when the library is loaded, the 
initial empty list would be created at that time. Then, in the obj_new() 
method - that is called whenever a new object is instantiated - I would 
just push an ID onto the list. Then I need to only search that list when 
I make 'links' between objects.

Is this possible? How would I go about creating this list? Where should 
the 'list' variable be defined?

Thanks,
Mike Wozniewski


> Hi.
>
> I have an custom object that I coded, and I would like to store 
> pointers to other instances of this object within the dataspace.
>
> To clarify, pretend I have 2 instances of the obj on my canvas. Then I 
> receive an input to obj_1 that calls a specific method. I would like 
> that method to be able to look into that object's dataspace to see if 
> it is 'linked' with any other objects, and execute methods in those 
> objects.
>
> I don't want to use regular pd send/receive/connections/etc because I 
> want to be able to dynamically specify these 'links' during runtime.
>
> Also, this technique should also hold if the objects are not on the 
> same canvas (possibly anywhere in other patches). I guess this means 
> that I have to pass an ID of some sort when I want to specify a 
> connection. For example, if each object has a unique numeric ID, I 
> would send a message 'connect 12345' to an object, and a handler would 
> search the entire pd object space for an object that had that ID and 
> then store a pointer to that object in the dataspace.
>
> Is this possible? Does anyone know how I can search the entire pd 
> object space? How do I find these pointers?





More information about the Pd-list mailing list