Debian Codegraph @

brian2/devices/cpp_standalone/templates/common_group.cpp

raw
1 {% macro before_run_cpp_file() %}
2 #include "code_objects/before_run_{{codeobj_name}}.h"
3 #include "objects.h"
4 #include "brianlib/common_math.h"
5 #include "brianlib/stdint_compat.h"
6 #include<cmath>
7 #include<ctime>
8 #include<iostream>
9 #include<fstream>
10 #include<climits>
11 {% for name in user_headers | sort %}
12 #include {{name}}
13 {% endfor %}
14
15 ////// SUPPORT CODE ///////
16 namespace {
17 {{support_code_lines|autoindent}}
18 }
19
20 void _before_run_{{codeobj_name}}()
21 {
22 using namespace brian;
23 ///// CONSTANTS ///////////
24 %CONSTANTS%
25 ///// POINTERS ////////////
26 {{pointers_lines|autoindent}}
27 {% block before_code %}
28 // EMPTY_CODE_BLOCK -- will be overwritten in child templates
29 {% endblock %}
30
31 }
32 {% endmacro %}
33
34 {% macro before_run_h_file() %}
35 #ifndef _INCLUDED_{{codeobj_name}}_before
36 #define _INCLUDED_{{codeobj_name}}_before
37
38 void _before_run_{{codeobj_name}}();
39
40 #endif
41 {% endmacro %}
42
43 {% macro cpp_file() %}
44 #include "code_objects/{{codeobj_name}}.h"
45 #include "objects.h"
46 #include "brianlib/common_math.h"
47 #include "brianlib/stdint_compat.h"
48 #include<chrono>
49 #include<cmath>
50 #include<ctime>
51 #include<iostream>
52 #include<fstream>
53 #include<climits>
54 {% block extra_headers %}
55 {% endblock %}
56 {% for name in user_headers | sort %}
57 #include {{name}}
58 {% endfor %}
59
60 ////// SUPPORT CODE ///////
61 namespace {
62 {{support_code_lines|autoindent}}
63 }
64
65 ////// HASH DEFINES ///////
66 {{hashdefine_lines|autoindent}}
67
68 void _run_{{codeobj_name}}()
69 {
70 using namespace brian;
71
72 {% if profiled %}
73 const auto _start_time = std::chrono::high_resolution_clock::now();
74 {% endif %}
75
76 ///// CONSTANTS ///////////
77 %CONSTANTS%
78 ///// POINTERS ////////////
79 {{pointers_lines|autoindent}}
80
81 {% block maincode %}
82 {# Will be overwritten in child templates #}
83 {% endblock %}
84
85 {% if profiled %}
86 const auto _end_time = std::chrono::high_resolution_clock::now();
87 const auto _run_time = std::chrono::duration_cast<std::chrono::nanoseconds>(_end_time - _start_time);
88 {{codeobj_name}}_profiling_info += _run_time;
89 {% endif %}
90 }
91
92 {% block extra_functions_cpp %}
93 {% endblock %}
94
95 {% endmacro %}
96
97
98 {% macro h_file() %}
99 #ifndef _INCLUDED_{{codeobj_name}}
100 #define _INCLUDED_{{codeobj_name}}
101
102 void _run_{{codeobj_name}}();
103
104 {% block extra_functions_h %}
105 {% endblock %}
106
107 #endif
108 {% endmacro %}
109
110 {% macro after_run_cpp_file() %}
111 #include "objects.h"
112 #include "code_objects/after_run_{{codeobj_name}}.h"
113 #include "brianlib/common_math.h"
114 #include "brianlib/stdint_compat.h"
115 #include<cmath>
116 #include<ctime>
117 #include<iostream>
118 #include<fstream>
119 #include<climits>
120 {% for name in user_headers | sort %}
121 #include {{name}}
122 {% endfor %}
123
124 ////// SUPPORT CODE ///////
125 namespace {
126 {{support_code_lines|autoindent}}
127 }
128
129 void _after_run_{{codeobj_name}}()
130 {
131 using namespace brian;
132 ///// CONSTANTS ///////////
133 %CONSTANTS%
134 ///// POINTERS ////////////
135 {{pointers_lines|autoindent}}
136 {% block after_code %}
137 // EMPTY_CODE_BLOCK -- will be overwritten in child templates
138 {% endblock %}
139
140 }
141 {% endmacro %}
142
143 {% macro after_run_h_file() %}
144 #ifndef _INCLUDED_{{codeobj_name}}_after
145 #define _INCLUDED_{{codeobj_name}}_after
146
147 void _after_run_{{codeobj_name}}();
148
149 #endif
150 {% endmacro %}