From bb55319675c3eafb597afd8b3262dc90f99ed773 Mon Sep 17 00:00:00 2001 From: mikejiang Date: Fri, 12 Jan 2018 16:58:56 -0800 Subject: [PATCH] add CYTOLIB_INIT() macro. #3 --- README.md | 4 +++- inst/include/cytolib/global.hpp | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 80c9f9c..646aed0 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ `cytolib` provides the c++ headers for users to use and interact with the `GatingSet` (the gated cytometry data structure) at c++ level. - +###Installation The **cytolib** package is installed via `R CMD INSTALL ...`. R packages wishing to use the libraries in `cytolib` only need to: @@ -13,5 +13,7 @@ e.g. ``` LinkingTo: cytolib ``` +###Usage +Make sure to call `CYTOLIB_INIT()` in user c code See **flowWorkspace** package for the example of using `cytolib`. diff --git a/inst/include/cytolib/global.hpp b/inst/include/cytolib/global.hpp index 63363ad..087e740 100644 --- a/inst/include/cytolib/global.hpp +++ b/inst/include/cytolib/global.hpp @@ -13,8 +13,6 @@ #define POPULATION_LEVEL 3 #define GATE_LEVEL 4 -extern unsigned short g_loglevel; -extern bool my_throw_on_error; #ifdef ROUT #include @@ -29,6 +27,9 @@ using namespace std; extern unsigned short g_loglevel;// debug print is turned off by default extern bool my_throw_on_error;//can be toggle off to get a partially parsed gating tree for debugging purpose +#define CYTOLIB_INIT() \ + bool my_throw_on_error = true;\ + unsigned short g_loglevel = 0;\ inline void PRINT(string a){ #ifdef ROUT