NEURON
hoccontext.h
Go to the documentation of this file.
1 #pragma once
2 
3 extern Object* hoc_thisobject;
6 extern Symlist* hoc_symlist;
7 
8 struct HocContext {
12 };
13 
15  hc->obj = hoc_thisobject;
16  hc->obd = hoc_objectdata;
17  hc->sl = hoc_symlist;
18  hoc_thisobject = 0;
21  return hc;
22 }
23 static void hc_restore_(HocContext* hc) {
24  hoc_thisobject = hc->obj;
25  hoc_objectdata = hc->obd;
26  hoc_symlist = hc->sl;
27 }
28 
29 // RAII guard for the top HOC context
31  private:
33  HocContext* hc_ = nullptr;
34 
35  public:
37  // ``hoc_thisobject`` is global
38  if (hoc_thisobject) {
40  }
41  }
43  if (hc_) {
45  }
46  }
47 };
HocContext hcref
Definition: hoccontext.h:32
HocContext * hc_
Definition: hoccontext.h:33
Objectdata * hoc_objectdata
Definition: hoc_oop.cpp:122
Symlist * hoc_top_level_symlist
Definition: symdir.cpp:16
static HocContext * hc_save_and_set_to_top_(HocContext *hc)
Definition: hoccontext.h:14
Symlist * hoc_symlist
Definition: symbol.cpp:34
Objectdata * hoc_top_level_data
Definition: hoc_oop.cpp:123
static void hc_restore_(HocContext *hc)
Definition: hoccontext.h:23
Object * hoc_thisobject
Definition: hoc_oop.cpp:121
Objectdata * obd
Definition: hoccontext.h:10
Symlist * sl
Definition: hoccontext.h:11
Object * obj
Definition: hoccontext.h:9
Definition: hocdec.h:173
Definition: hocdec.h:75