void LinearMechanism::create() { int i; lmfree(); i = 0; Object* o = *hoc_objgetarg(++i); if (strcmp(o->ctemplate->sym->name, "PythonObject") == 0) { f_callable_ = o; hoc_obj_ref(o); c_ = matrix_arg(++i); } else { f_callable_ = NULL; c_ = matrix_arg(1); } g_ = matrix_arg(++i); y_ = vector_arg(++i); if (ifarg(i + 2) && hoc_is_object_arg(i + 2) && is_vector_arg(i + 2)) { y0_ = vector_arg(++i); } b_ = vector_arg(++i); if (ifarg(++i)) { #if HAVE_IV Oc oc; #endif if (hoc_is_double_arg(i)) { nnode_ = 1; nodes_ = new Node*[1]; double x = chkarg(i, 0., 1.); Section* sec = chk_access(); nodes_[0] = node_exact(sec, x); nrn_notify_when_double_freed(&NODEV(nodes_[0]), this); }else{ Object* o = *hoc_objgetarg(i); check_obj_type(o, "SectionList"); SectionList* sl = new SectionList(o); sl->ref(); Vect* x = vector_arg(i+1); Section* sec; nnode_ = 0; nodes_ = new Node*[x->capacity()]; for (sec = sl->begin(); sec; sec = sl->next()) { nodes_[nnode_] = node_exact(sec, x->elem(nnode_)); nrn_notify_when_double_freed(&NODEV(nodes_[nnode_]), this); ++nnode_; } if (ifarg(i+2)) { elayer_ = vector_arg(i+2); } sl->unref(); } } model_ = new LinearModelAddition(c_, g_, y_, y0_, b_, nnode_, nodes_, elayer_, f_callable_); }
OcPointer::OcPointer(const char* st, double* d) : Observer() { sti_ = NULL; s_ = new char[strlen(st)+1]; strcpy(s_, st); p_ = d; valid_ = true; nrn_notify_when_double_freed(p_, this); }
RandomPlay::RandomPlay(Rand* r, double* px) { //printf("RandomPlay\n"); r_ = r; px_ = px; random_play_list_->append(this); ref(); nrn_notify_when_double_freed(px_, this); nrn_notify_when_void_freed((void*)r->obj_, this); }
void LinearMechanism::update_ptrs() { if (nodes_) { nrn_notify_pointer_disconnect(this); for (int i=0; i < nnode_; ++i) { double* pd = nrn_recalc_ptr(&(NODEV(nodes_[i]))); if (pd != &(NODEV(nodes_[i]))) { nrn_notify_when_double_freed(pd, this); } } } }