SELs in arrays
SELs in arrays
- Subject: SELs in arrays
- From: Robert S Goldsmith <email@hidden>
- Date: Tue, 25 Sep 2001 17:48:07 +0100
Hi :)
I have a problem that would be best solved by creating an
NSArray holding a number of different objects - arrays,
numbers etc. which can act as a blueprint for configuring a
number of instances of a class. The problem is that part of
the class instance 'blueprint' is which methods to use.
Currently, these are stored in a normal C array and can
change at any time so I can't just build them in or index
them in any way. I need to send these SEL's along with the
rest of the blueprint so would like to be able to simply add
the SEL to an array. Is this possible? Can a SEL pretend to
be something else? Can anyone think of another way?
For a slight background, I don't have an array of SELs and
store an index because the part of the code that uses the
SELs is the core of the code and runs over millions of
calculations for hours at a time. Adding extra memory
accesses becomes noticable over this period so I'm trying to
keep the core code as lean as possible while still using the
dynamic method calling (as i don't actually always know
which methods are available at compile time).
At times (quite frequently) I need to read the current
configuration of one instance of my class and copy the
configuration (not the actual instance or any of its
internal stuff) to all the other instances. I figured
getting each member of the class instance that is to be
copied to create an array (so that the instance itself does
not have to worry about what it's member instances have in
them) and then create an array from these. Then tell all the
other instances to use the array (not copy it, just pass the
pointer) and reconfigure themselves. But, as i said above, I
need to store SEL information in there somehow.
Robert