BioDynaMo  v1.05.120-25dc9790
root.h
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 //
3 // Copyright (C) 2021 CERN & University of Surrey for the benefit of the
4 // BioDynaMo collaboration. All Rights Reserved.
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // See the LICENSE file distributed with this work for details.
10 // See the NOTICE file distributed with this work for additional information
11 // regarding copyright ownership.
12 //
13 // -----------------------------------------------------------------------------
14 
15 #ifndef CORE_UTIL_ROOT_H_
16 #define CORE_UTIL_ROOT_H_
17 
18 #if defined(USE_DICT)
19 
20 #include <Rtypes.h>
21 #include <TBuffer.h>
22 
23 #define BDM_CLASS_DEF(class_name, class_version_id) \
24  ClassDef(class_name, class_version_id)
25 #define BDM_CLASS_DEF_NV(class_name, class_version_id) \
26  ClassDefNV(class_name, class_version_id)
27 #define BDM_CLASS_DEF_OVERRIDE(class_name, class_version_id) \
28  ClassDefOverride(class_name, class_version_id)
29 
30 // NOLINT
31 
32 // -----------------------------------------------------------------------------
33 // -----------------------------------------------------------------------------
34 #else
35 
36 #include <TClass.h>
37 #include "core/util/log.h"
38 
39 #define BDM_DICT_ERROR_MSG \
40  "You tried to use a ROOT dictionary function, but " \
41  "compiled BioDynaMo without dictionary support. " \
42  "Please configure with cmake -Ddict=on .. and recompile."
43 
49 #define BDM_NULL_CLASS_DEF(class_name, class_version_id) \
50  public: \
51  static TClass* Class() { \
52  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
53  return nullptr; \
54  } \
55  static const char* Class_Name() { \
56  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
57  return nullptr; \
58  } \
59  static Version_t Class_Version() { \
60  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
61  return class_version_id; \
62  } \
63  static TClass* Dictionary() { \
64  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
65  return nullptr; \
66  } \
67  virtual TClass* IsA() const { \
68  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
69  return class_name::Class(); \
70  } \
71  virtual void ShowMembers(TMemberInspector& insp) const { \
72  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
73  } \
74  virtual void Streamer(TBuffer&) { \
75  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
76  } \
77  void StreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b) { \
78  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
79  } \
80  static const char* DeclFileName() { \
81  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
82  return nullptr; \
83  } \
84  static int ImplFileLine() { \
85  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
86  return -1; \
87  } \
88  static const char* ImplFileName() { \
89  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
90  return nullptr; \
91  } \
92  static int DeclFileLine() { \
93  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
94  return __LINE__; \
95  } \
96  \
97  private:
98 // NOLINT
99 
100 #define BDM_NULL_CLASS_DEF_NV(class_name, class_version_id) \
101  public: \
102  static TClass* Class() { \
103  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
104  return nullptr; \
105  } \
106  static const char* Class_Name() { \
107  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
108  return nullptr; \
109  } \
110  static Version_t Class_Version() { \
111  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
112  return class_version_id; \
113  } \
114  static TClass* Dictionary() { \
115  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
116  return nullptr; \
117  } \
118  TClass* IsA() const { return class_name::Class(); } \
119  void ShowMembers(TMemberInspector& insp) const { \
120  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
121  } \
122  void Streamer(TBuffer&) { Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); } \
123  void StreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b) { \
124  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
125  } \
126  static const char* DeclFileName() { \
127  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
128  return nullptr; \
129  } \
130  static int ImplFileLine() { \
131  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
132  return -1; \
133  } \
134  static const char* ImplFileName() { \
135  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
136  return nullptr; \
137  } \
138  static int DeclFileLine() { \
139  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
140  return __LINE__; \
141  } \
142  \
143  private:
144 // NOLINT
145 
146 #define BDM_NULL_CLASS_DEF_OVERRIDE(class_name, class_version_id) \
147  public: \
148  static TClass* Class() { \
149  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
150  return nullptr; \
151  } \
152  static const char* Class_Name() { \
153  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
154  return nullptr; \
155  } \
156  static Version_t Class_Version() { \
157  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
158  return class_version_id; \
159  } \
160  static TClass* Dictionary() { \
161  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
162  return nullptr; \
163  } \
164  TClass* IsA() const override { \
165  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
166  return class_name::Class(); \
167  } \
168  void ShowMembers(TMemberInspector& insp) const override { \
169  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
170  } \
171  void Streamer(TBuffer&) override { \
172  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
173  } \
174  void StreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b) { \
175  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
176  } \
177  static const char* DeclFileName() { \
178  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
179  return nullptr; \
180  } \
181  static int ImplFileLine() { \
182  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
183  return -1; \
184  } \
185  static const char* ImplFileName() { \
186  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
187  return nullptr; \
188  } \
189  static int DeclFileLine() { \
190  Log::Fatal("Dictionary", BDM_DICT_ERROR_MSG); \
191  return __LINE__; \
192  } \
193  \
194  private:
195 // NOLINT
196 
198 #define BDM_CLASS_DEF(class_name, class_version_id) \
199  BDM_NULL_CLASS_DEF(class_name, class_version_id)
200 #define BDM_CLASS_DEF_NV(class_name, class_version_id) \
201  BDM_NULL_CLASS_DEF_NV(class_name, class_version_id)
202 #define BDM_CLASS_DEF_OVERRIDE(class_name, class_version_id) \
203  BDM_NULL_CLASS_DEF_OVERRIDE(class_name, class_version_id)
204 
205 #endif // defined(USE_DICT)
206 
207 namespace bdm {
208 
209 // -----------------------------------------------------------------------------
211 void PrintDataMemberInfo(const std::string& class_name);
212 
213 } // namespace bdm
214 
215 #endif // CORE_UTIL_ROOT_H_
bdm
Definition: agent.cc:39
bdm::PrintDataMemberInfo
void PrintDataMemberInfo(const std::string &class_name)
Writes information of each data member of a class to cout.
Definition: root.cc:25
log.h