Michael Hines proposed a solution based on the idea of printing the name of the objref'sI am trying to write a function that needs to either work on a sectionList or a list of SectionLists. Is there a way to ask an object its type?
class to a string, and then using a conditional based on a string comparison. The details
of this solution make use of classname(), a proc that is defined in stdlib.hoc
Code: Select all
{load_file("stdlib.hoc")}
func is_list() { localobj s
s = new String()
classname($o1, s.s)
return strcmp(s.s, "List") == 0
}
objref a, b
a = new List()
b = new Vector()
is_list(a)
is_list(b)
If the incessant creation/destruction of strings offends your sense of fastidiousness
then remove the
localobj s ...
and use a global strdef tstr
Apart from distinguishing object arguments see
http://www.neuron.yale.edu/neuron/stati ... ml#argtype