diff --git a/inst/include/cytolib/GatingHierarchy.hpp b/inst/include/cytolib/GatingHierarchy.hpp index f2ac774..4855a4e 100644 --- a/inst/include/cytolib/GatingHierarchy.hpp +++ b/inst/include/cytolib/GatingHierarchy.hpp @@ -89,6 +89,8 @@ struct OurVertexPropertyWriterR { class GatingHierarchy{ private: + unsigned short g_loglevel;// debug print is turned off by default + compensation comp; /*< compensation object */ /* compensation is currently done in R due to the linear Algebra @@ -104,7 +106,7 @@ class GatingHierarchy{ public: - + void set_loglevel(unsigned short _g_loglevel){g_loglevel = _g_loglevel;}; /** * load the in-memory copy of frm @@ -338,7 +340,7 @@ class GatingHierarchy{ * , customized copy and assignment constructor is required * */ - GatingHierarchy(const GatingHierarchy & _gh) + GatingHierarchy(const GatingHierarchy & _gh):g_loglevel(NO_LOG) { comp = _gh.comp; @@ -365,8 +367,8 @@ class GatingHierarchy{ * GatingHierarchy *curGh=new GatingHierarchy(); * \endcode */ - GatingHierarchy(){} - GatingHierarchy(compensation _comp, PARAM_VEC _transFlag, trans_local _trans):comp(_comp), transFlag(_transFlag),trans(_trans) {}; + GatingHierarchy():g_loglevel(NO_LOG){} + GatingHierarchy(compensation _comp, PARAM_VEC _transFlag, trans_local _trans):g_loglevel(NO_LOG),comp(_comp), transFlag(_transFlag),trans(_trans) {}; void convertToPb(pb::GatingHierarchy & gh_pb){ pb::populationTree * ptree = gh_pb.mutable_tree(); /* @@ -402,7 +404,7 @@ class GatingHierarchy{ } - GatingHierarchy(pb::GatingHierarchy & pb_gh, map & trans_tbl){ + GatingHierarchy(pb::GatingHierarchy & pb_gh, map & trans_tbl):g_loglevel(NO_LOG){ const pb::populationTree & tree_pb = pb_gh.tree(); int nNodes = tree_pb.node_size(); diff --git a/inst/include/cytolib/GatingSet.hpp b/inst/include/cytolib/GatingSet.hpp index ab55b65..34431ac 100644 --- a/inst/include/cytolib/GatingSet.hpp +++ b/inst/include/cytolib/GatingSet.hpp @@ -31,6 +31,7 @@ using namespace std; * */ class GatingSet{ + unsigned short g_loglevel;// debug print is turned off by default biexpTrans globalBiExpTrans; //default bi-exponential transformation functions linTrans globalLinTrans; @@ -52,6 +53,13 @@ class GatingSet{ return ghs.find(sampleName); } size_t erase ( const string& k ){return ghs.erase(k);} + + void set_loglevel(unsigned short _g_loglevel){ + g_loglevel = _g_loglevel; + for(auto & it :ghs) + it.second.set_loglevel(_g_loglevel); + }; + unsigned short get_loglevel(){return g_loglevel;}; /** * insert * @param sampleName @@ -122,7 +130,7 @@ class GatingSet{ } - GatingSet(){}; + GatingSet():g_loglevel(NO_LOG){}; /** * separate filename from dir to avoid to deal with path parsing in c++ @@ -204,7 +212,7 @@ class GatingSet{ * @param format * @param isPB */ - GatingSet(string filename) + GatingSet(string filename):g_loglevel(NO_LOG) { GOOGLE_PROTOBUF_VERIFY_VERSION; ifstream input(filename.c_str(), ios::in | ios::binary); @@ -423,7 +431,7 @@ class GatingSet{ * compensation and transformation,more options can be allowed in future like providing different * comp and trans */ - GatingSet(const GatingHierarchy & gh_template,vector sampleNames){ + GatingSet(const GatingHierarchy & gh_template,vector sampleNames):g_loglevel(NO_LOG){ @@ -458,7 +466,7 @@ class GatingSet{ } } - GatingSet(vector sampleNames){ + GatingSet(vector sampleNames):g_loglevel(NO_LOG){ vector::iterator it; for(it=sampleNames.begin();it!=sampleNames.end();it++) { diff --git a/inst/include/cytolib/global.hpp b/inst/include/cytolib/global.hpp index 63363ad..25093a2 100644 --- a/inst/include/cytolib/global.hpp +++ b/inst/include/cytolib/global.hpp @@ -8,13 +8,13 @@ #ifndef GLOBAL_HPP_ #define GLOBAL_HPP_ -#define GATING_SET_LEVEL 1 -#define GATING_HIERARCHY_LEVEL 2 -#define POPULATION_LEVEL 3 -#define GATE_LEVEL 4 - -extern unsigned short g_loglevel; -extern bool my_throw_on_error; +enum loglevel_t{ + NO_LOG = 0, + GATING_SET_LEVEL = 1, + GATING_HIERARCHY_LEVEL = 2, + POPULATION_LEVEL = 3, + GATE_LEVEL = 4 + }; #ifdef ROUT #include @@ -27,8 +27,6 @@ extern bool my_throw_on_error; #include 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 inline void PRINT(string a){ #ifdef ROUT