I have just written a little piece on my blog about how a class in a library can be made to keep track of any objects of that class you create in your sketch. It's a very useful trick which can make object management an absolute breeze.
By using a combination of static member functions and variables, and linked lists, you can make a library maintain its own list of defined objects so it is able to perform operations on all those objects, or maybe such things as find an object by some other reference than it's pointer.
As an example I take a small rotary encoder library I wrote last night which keeps track of the encoders you have defined so it can attach itself to change notification interrupts properly.
1 post • Page 1 of 1