Lars Luthman wrote: > That sounds OK. I suggest something like this: > struct URI_Mapper { > // call this with your URI and the host_data member - not RT safe > uint16_t (map_function*)(const char* uri, void* host_data); > // pass this as the second parameter to map_function() > void* host_data; > }; > It doesn't provide a way for the host to say "I'm out of IDs!" though. > Will that be needed?
What about using int32_t and returning -1 as "out of IDs"? There's no difference in CPU time spent anyway, because uint16_t is returned in the same 32-bit register as int32_t is (eax, on x86). Or you can use 0 (or 65535) for error. It doesn't look like something that requires lots of thinking. Also, a reverse mapping mechanism would be helpful at times (for debugging/data monitors). I put it in my proposal for that specific reason. It shouldn't be hard to implement, either (might be a waste of memory, but of acceptable kind). Or it might be a separate feature, so that certain people won't get too confused ;) Krzysztof _______________________________________________ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev