Logo coherent WaveBurst  
Library Reference Guide
Logo
CWB_Plugin.h
Go to the documentation of this file.
1 #ifndef CWB_PLUGIN_H
2 #define CWB_PLUGIN_H
3 
4 // plugin macros, used to share parameters between Plugin and configPlugin
5 
6 #define CWB_PLUGIN_IMPORT(TYPE,VAR) { \
7  TGlobal* _global = (TGlobal*)gROOT->GetGlobal("__p"#VAR,true); \
8  if(_global!=NULL) { \
9  void* gPOINTER=NULL; \
10  memcpy((void*)&gPOINTER,(void*)_global->GetAddress(),sizeof(void*)); \
11  VAR = (TYPE)gPOINTER; \
12  } else { \
13  cout << "CWB_PLUGIN_IMPORT : global variable not found " << #VAR << endl; \
14  exit(1); \
15  } \
16 }
17 
18 #define CWB_PLUGIN_EXPORT(VAR) { \
19  char __cmdline[128]; \
20  TGlobal* _global = (TGlobal*)gROOT->GetGlobal("__p"#VAR,true); \
21  if(_global==NULL) sprintf(__cmdline,"void* __p"#VAR" = (void*)%p;",&VAR); \
22  else sprintf(__cmdline,"__p"#VAR" = (void*)%p;",&VAR); \
23  gROOT->ProcessLine(__cmdline); \
24 }
25 
26 #define CWB_PLUGIN_CHECK(TYPE,VAR,CHECK) { \
27  TGlobal* _global = (TGlobal*)gROOT->GetGlobal("__p"#VAR,true); \
28  if(_global!=NULL) { \
29  void* gPOINTER=NULL; \
30  memcpy((void*)&gPOINTER,(void*)_global->GetAddress(),sizeof(void*)); \
31  VAR = (TYPE)gPOINTER; \
32  CHECK = true; \
33  } else { \
34  CHECK = false; \
35  } \
36 }
37 
38 #endif