SectionRef

classes
   child          has_trueparent  parent        trueparent     
   exists         is_cas         root           
   has_parent     nchild         sec            

SYNTAX

section sref = new SectionRef()

DESCRIPTION

SectionRef keeps a pointer/reference to a section The reference is to the currently accessed section at the time the object was created.

This class allows sections to be referenced as normal object variables for assignment and passing as arguments.


sec

SectionRef

SYNTAX

sref.sec

DESCRIPTION

special syntax that makes the reference the currently accessed section. This class allows sections to be referenced as normal object variables for assignment and passing as arguments. The usage is execute following example
create soma, axon
axon.diam=2
soma.diam=10
access axon
objref s1, s2
soma s1 = new SectionRef()	// s1 holds a reference to the soma
print s1.sec.diam		// print the diameter of the soma
s2 = s1				// s2 also holds a reference to the soma
s2.sec { psection() }		// print all info about soma
axon s2 = new SectionRef()
proc c() {
	$o1.sec connect $o2.sec(0), 1
}
c(s1, s2)
topology()
This last is a procedure that takes two SectionRef args and connects them end to end.


parent

SectionRef

SYNTAX

sref.parent

DESCRIPTION

parent of sref.sec becomes the currently accessed section. Generally it is used in a context like sref.parent { statement } just like a normal section name and does NOT need a section_pop If there is a chance that a section does not have a parent then has_parent should be called first to avoid an execution error. Note that the parent is the current parent of sref.sec, not necessarily the parent when the SectionRef was created.


trueparent

SectionRef

SYNTAX

sref.trueparent

DESCRIPTION

trueparent of sref.sec becomes the currently accessed section. This is normally identical to parent except when the parent's parent_connection is equal to the parent's section_orientation . If there is a chance that a section does not have a trueparent then has_trueparent should be called first to avoid an execution error.


child

SectionRef

SYNTAX

sref.child[i]

DESCRIPTION

the ith child of sref.sec becomes the currently accessed section. Generally it is used in a context like
for i=0, sref.nchild-1 sref.child[i] { statement }
Note that the children are the current children of sref.sec, not necessarily the same as when the SectionRef was created since sections may be deleted or re-connected subsequent to the instantiation of the SectionRef.


root

SectionRef

SYNTAX

sref.root

DESCRIPTION

root of sref.sec becomes the currently accessed section.


has_parent

SectionRef

SYNTAX

boolean = sref.has_parent

DESCRIPTION

returns 1 if sref.sec has a parent and 0 if sref.sec is a root section. Invoking sref.parent when sref.sec is a root section will print an error message and halt execution.


has_trueparent

SectionRef

SYNTAX

boolean = sref.has_trueparent

DESCRIPTION

returns 1 if the sref.sec parent node is not the root node and 0 otherwise. Invoking sref.trueparent when it is the root node will print an error message and halt execution.


nchild

SectionRef

SYNTAX

integer = sref.nchild

DESCRIPTION

Return the number of child sections connected to sref.sec


is_cas

SectionRef

SYNTAX

boolean = sref.is_cas()

DESCRIPTION

Returns 1 if this section reference is the currently accessed section, 0 otherwise.


exists

SectionRef

SYNTAX

boolean = sref.exists()

DESCRIPTION

Returns 1 if the section has not been deleted, 0 otherwise.

SEE ALSO

delete_section section_exists


neuron/neuron/classes/secref.hel : May 13 2012