NEURON
gui-redirect.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "hocdec.h"
4 #include "nrnpy.h"
5 
6 
8 
9 
10 #define TRY_GUI_REDIRECT_OBJ(name, obj) \
11  if (auto* const ngh_result = \
12  neuron::python::methods.try_gui_helper(name, static_cast<Object*>(obj))) { \
13  return static_cast<void*>(*ngh_result); \
14  }
15 
16 #define TRY_GUI_REDIRECT_METHOD_ACTUAL_DOUBLE(name, sym, v) \
17  { \
18  Object** guiredirect_result = NULL; \
19  if (neuron::python::methods.gui_helper) { \
20  Object* obj = nrn_get_gui_redirect_obj(); \
21  guiredirect_result = neuron::python::methods.gui_helper(name, obj); \
22  if (guiredirect_result) { \
23  return neuron::python::methods.object_to_double(*guiredirect_result); \
24  } \
25  } \
26  }
27 
28 #define TRY_GUI_REDIRECT_METHOD_ACTUAL_OBJ(name, sym, v) \
29  { \
30  Object** guiredirect_result = NULL; \
31  if (neuron::python::methods.gui_helper) { \
32  Object* obj = nrn_get_gui_redirect_obj(); \
33  guiredirect_result = neuron::python::methods.gui_helper(name, obj); \
34  if (guiredirect_result) { \
35  return (guiredirect_result); \
36  } \
37  } \
38  }
39 
40 #define TRY_GUI_REDIRECT_NO_RETURN(name, obj) \
41  if (auto* const ngh_result = \
42  neuron::python::methods.try_gui_helper(name, static_cast<Object*>(obj)); \
43  ngh_result) { \
44  return; \
45  }
46 
47 #define TRY_GUI_REDIRECT_DOUBLE(name, obj) \
48  if (auto* const ngh_result = \
49  neuron::python::methods.try_gui_helper(name, static_cast<Object*>(obj))) { \
50  hoc_ret(); \
51  hoc_pushx(neuron::python::methods.object_to_double(*ngh_result)); \
52  return; \
53  }
54 
55 #define TRY_GUI_REDIRECT_ACTUAL_DOUBLE(name, obj) \
56  if (auto* const ngh_result = \
57  neuron::python::methods.try_gui_helper(name, static_cast<Object*>(obj))) { \
58  return neuron::python::methods.object_to_double(*ngh_result); \
59  }
60 
61 #define TRY_GUI_REDIRECT_ACTUAL_STR(name, obj) \
62  { \
63  char** ngh_result; \
64  if (neuron::python::methods.gui_helper3_str) { \
65  ngh_result = \
66  neuron::python::methods.gui_helper3_str(name, static_cast<Object*>(obj), 0); \
67  if (ngh_result) { \
68  return ((const char**) ngh_result); \
69  } \
70  } \
71  }
72 
73 #define TRY_GUI_REDIRECT_ACTUAL_OBJ(name, obj) \
74  if (auto* const ngh_result = \
75  neuron::python::methods.try_gui_helper(name, static_cast<Object*>(obj))) { \
76  return ngh_result; \
77  }
78 
79 #define TRY_GUI_REDIRECT_DOUBLE_SEND_STRREF(name, obj) \
80  { \
81  Object** ngh_result; \
82  if (neuron::python::methods.gui_helper3) { \
83  ngh_result = neuron::python::methods.gui_helper3(name, static_cast<Object*>(obj), 1); \
84  if (ngh_result) { \
85  hoc_ret(); \
86  hoc_pushx(neuron::python::methods.object_to_double(*ngh_result)); \
87  return; \
88  } \
89  } \
90  }
Object * nrn_get_gui_redirect_obj()
Definition: hoc_oop.cpp:644
Definition: hocdec.h:173